📄 portletservletrequest.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: PortletServletRequest.java
package org.apache.struts2.portlet.servlet;
import java.io.*;
import java.security.Principal;
import java.util.*;
import javax.portlet.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.*;
import org.apache.struts2.portlet.PortletActionConstants;
// Referenced classes of package org.apache.struts2.portlet.servlet:
// PortletHttpSession, PortletServletInputStream, PortletServletRequestDispatcher
public class PortletServletRequest
implements HttpServletRequest, PortletActionConstants
{
private PortletRequest portletRequest;
private PortletContext portletContext;
public PortletServletRequest(PortletRequest portletRequest, PortletContext portletContext)
{
this.portletRequest = portletRequest;
this.portletContext = portletContext;
}
public String getAuthType()
{
return portletRequest.getAuthType();
}
public String getContextPath()
{
return portletRequest.getContextPath();
}
public Cookie[] getCookies()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getCookies();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public long getDateHeader(String name)
{
throw new IllegalStateException("Not allowed in a portlet");
}
public String getHeader(String name)
{
return portletRequest.getProperty(name);
}
public Enumeration getHeaderNames()
{
return portletRequest.getPropertyNames();
}
public Enumeration getHeaders(String name)
{
return portletRequest.getProperties(name);
}
public int getIntHeader(String name)
{
throw new IllegalStateException("Not allowed in a portlet");
}
public String getMethod()
{
return null;
}
public String getPathInfo()
{
return null;
}
public String getPathTranslated()
{
return null;
}
public String getQueryString()
{
return null;
}
public String getRemoteUser()
{
return portletRequest.getRemoteUser();
}
public String getRequestURI()
{
throw new IllegalStateException("Not allowed in a portlet");
}
public StringBuffer getRequestURL()
{
throw new IllegalStateException("Not allowed in a portlet");
}
public String getRequestedSessionId()
{
return portletRequest.getRequestedSessionId();
}
public String getServletPath()
{
String actionPath = getParameter("struts.portlet.action");
if (actionPath != null && !actionPath.endsWith(".action"))
actionPath = (new StringBuilder()).append(actionPath).append(".action").toString();
return actionPath;
}
public HttpSession getSession()
{
return new PortletHttpSession(portletRequest.getPortletSession());
}
public HttpSession getSession(boolean create)
{
return new PortletHttpSession(portletRequest.getPortletSession(create));
}
public Principal getUserPrincipal()
{
return portletRequest.getUserPrincipal();
}
public boolean isRequestedSessionIdFromCookie()
{
throw new IllegalStateException("Not allowed in a portlet");
}
public boolean isRequestedSessionIdFromURL()
{
throw new IllegalStateException("Not allowed in a portlet");
}
public boolean isRequestedSessionIdFromUrl()
{
throw new IllegalStateException("Not allowed in a portlet");
}
public boolean isRequestedSessionIdValid()
{
return portletRequest.isRequestedSessionIdValid();
}
public boolean isUserInRole(String role)
{
return portletRequest.isUserInRole(role);
}
public Object getAttribute(String name)
{
if ("javax.servlet.include.servlet_path".equals(name))
return getServletPath();
else
return portletRequest.getAttribute(name);
}
public Enumeration getAttributeNames()
{
return portletRequest.getAttributeNames();
}
public String getCharacterEncoding()
{
if (portletRequest instanceof ActionRequest)
return ((ActionRequest)portletRequest).getCharacterEncoding();
else
throw new IllegalStateException("Not allowed in render phase");
}
public int getContentLength()
{
if (portletRequest instanceof ActionRequest)
return ((ActionRequest)portletRequest).getContentLength();
else
throw new IllegalStateException("Not allowed in render phase");
}
public String getContentType()
{
if (portletRequest instanceof ActionRequest)
return ((ActionRequest)portletRequest).getContentType();
else
throw new IllegalStateException("Not allowed in render phase");
}
public ServletInputStream getInputStream()
throws IOException
{
if (portletRequest instanceof ActionRequest)
return new PortletServletInputStream(((ActionRequest)portletRequest).getPortletInputStream());
else
throw new IllegalStateException("Not allowed in render phase");
}
public String getLocalAddr()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getLocalAddr();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public String getLocalName()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getLocalName();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public int getLocalPort()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getLocalPort();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public Locale getLocale()
{
return portletRequest.getLocale();
}
public Enumeration getLocales()
{
return portletRequest.getLocales();
}
public String getParameter(String name)
{
return portletRequest.getParameter(name);
}
public Map getParameterMap()
{
return portletRequest.getParameterMap();
}
public Enumeration getParameterNames()
{
return portletRequest.getParameterNames();
}
public String[] getParameterValues(String name)
{
return portletRequest.getParameterValues(name);
}
public String getProtocol()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getProtocol();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public BufferedReader getReader()
throws IOException
{
if (portletRequest instanceof ActionRequest)
return ((ActionRequest)portletRequest).getReader();
else
throw new IllegalStateException("Not allowed in render phase");
}
public String getRealPath(String path)
{
return portletContext.getRealPath(path);
}
public String getRemoteAddr()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getRemoteAddr();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public String getRemoteHost()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getRemoteHost();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public int getRemotePort()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getRemotePort();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public RequestDispatcher getRequestDispatcher(String path)
{
return new PortletServletRequestDispatcher(portletContext.getRequestDispatcher(path));
}
public String getScheme()
{
return portletRequest.getScheme();
}
public String getServerName()
{
return portletRequest.getServerName();
}
public int getServerPort()
{
if (portletRequest instanceof HttpServletRequest)
return ((HttpServletRequest)portletRequest).getServerPort();
else
throw new IllegalStateException("Not allowed in a portlet");
}
public boolean isSecure()
{
return portletRequest.isSecure();
}
public void removeAttribute(String name)
{
portletRequest.removeAttribute(name);
}
public void setAttribute(String name, Object o)
{
portletRequest.setAttribute(name, o);
}
public void setCharacterEncoding(String env)
throws UnsupportedEncodingException
{
if (portletRequest instanceof ActionRequest)
((ActionRequest)portletRequest).setCharacterEncoding(env);
else
throw new IllegalStateException("Not allowed in render phase");
}
public PortletRequest getPortletRequest()
{
return portletRequest;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -