org.apache.struts2.portlet.servlet
Class PortletServletRequest

java.lang.Object
  extended by org.apache.struts2.portlet.servlet.PortletServletRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, PortletActionConstants

public class PortletServletRequest
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest, PortletActionConstants

Wrapper object exposing a PortletRequest as a HttpServletRequest instance. Clients accessing this request object will in fact operate on the PortletRequest object wrapped by this request object.


Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Fields inherited from interface org.apache.struts2.portlet.PortletActionConstants
ACTION_MAPPING, ACTION_PARAM, ACTION_RESET, DEFAULT_ACTION_FOR_MODE, DEFAULT_ACTION_NAME, DEFAULT_DISPATCHER_SERVLET_NAME, DISPATCH_TO, ERROR_ACTION, EVENT_ACTION, EVENT_PHASE, MODE_NAMESPACE_MAP, MODE_PARAM, PHASE, PORTLET_CONFIG, PORTLET_NAMESPACE, RENDER_DIRECT_LOCATION, RENDER_PHASE, REQUEST, RESPONSE, STACK_FROM_EVENT_PHASE
 
Constructor Summary
PortletServletRequest(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletContext portletContext)
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Gets an attribute value on the PortletRequest.
 java.util.Enumeration getAttributeNames()
           
 java.lang.String getAuthType()
           
 java.lang.String getCharacterEncoding()
          Can only be invoked in the event phase.
 int getContentLength()
          Can only be invoked in the event phase.
 java.lang.String getContentType()
          Can only be invoked in the event phase.
 java.lang.String getContextPath()
           
 javax.servlet.http.Cookie[] getCookies()
          Not allowed in a portlet.
 long getDateHeader(java.lang.String name)
          Not allowed in a portlet.
 java.lang.String getHeader(java.lang.String name)
          Gets a property from the PortletRequest.
 java.util.Enumeration getHeaderNames()
          Gets the property names from the PortletRequest.
 java.util.Enumeration getHeaders(java.lang.String name)
          Gets the values for the specified property from the PortletRequest.
 javax.servlet.ServletInputStream getInputStream()
          Can only be invoked in the event phase.
 int getIntHeader(java.lang.String name)
          Not allowed in a portlet.
 java.lang.String getLocalAddr()
          Not allowed in a portlet.
 java.util.Locale getLocale()
           
 java.util.Enumeration getLocales()
           
 java.lang.String getLocalName()
          Not allowed in a portlet.
 int getLocalPort()
          Not allowed in a portlet.
 java.lang.String getMethod()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map getParameterMap()
           
 java.util.Enumeration getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 java.lang.String getPathInfo()
           
 java.lang.String getPathTranslated()
           
 javax.portlet.PortletRequest getPortletRequest()
          Get the wrapped PortletRequest instance.
 java.lang.String getProtocol()
          Not allowed in a portlet.
 java.lang.String getQueryString()
           
 java.io.BufferedReader getReader()
          Can only be invoked in the event phase.
 java.lang.String getRealPath(java.lang.String path)
           
 java.lang.String getRemoteAddr()
          Not allowed in a portlet.
 java.lang.String getRemoteHost()
          Not allowed in a portlet.
 int getRemotePort()
          Not allowed in a portlet.
 java.lang.String getRemoteUser()
           
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
          Get the PortletRequestDispatcher as a PortletServletRequestDispatcher instance.
 java.lang.String getRequestedSessionId()
           
 java.lang.String getRequestURI()
          Not allowed in a portlet.
 java.lang.StringBuffer getRequestURL()
          Not allowed in a portlet.
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
          Not allowed in a portlet.
 java.lang.String getServletPath()
          A PortletRequest has no servlet path.
 javax.servlet.http.HttpSession getSession()
          Get the PortletSession as a PortletHttpSession instance.
 javax.servlet.http.HttpSession getSession(boolean create)
          Get the PortletSession as a PortletHttpSession instance.
 java.security.Principal getUserPrincipal()
           
 boolean isRequestedSessionIdFromCookie()
          Not allowed in a portlet.
 boolean isRequestedSessionIdFromUrl()
          Not allowed in a portlet.
 boolean isRequestedSessionIdFromURL()
          Not allowed in a portlet.
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(java.lang.String role)
           
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object o)
           
 void setCharacterEncoding(java.lang.String env)
          Can only be invoked in the event phase.
 void setExtension(java.lang.String extension)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletServletRequest

public PortletServletRequest(javax.portlet.PortletRequest portletRequest,
                             javax.portlet.PortletContext portletContext)
Method Detail

getAuthType

public java.lang.String getAuthType()
Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest

getContextPath

public java.lang.String getContextPath()
Specified by:
getContextPath in interface javax.servlet.http.HttpServletRequest

getCookies

public javax.servlet.http.Cookie[] getCookies()
Not allowed in a portlet.

Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getDateHeader

public long getDateHeader(java.lang.String name)
Not allowed in a portlet.

Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getHeader

public java.lang.String getHeader(java.lang.String name)
Gets a property from the PortletRequest. Note that a PortletRequest is not guaranteed to map properties to headers.

Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest
See Also:
PortletRequest.getProperty(String), HttpServletRequest.getHeader(java.lang.String)

getHeaderNames

public java.util.Enumeration getHeaderNames()
Gets the property names from the PortletRequest. Note that a PortletRequest is not guaranteed to map properties to headers.

Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest
See Also:
PortletRequest.getPropertyNames(), HttpServletRequest.getHeaderNames()

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Gets the values for the specified property from the PortletRequest. Note that a PortletRequest is not guaranteed to map properties to headers.

Specified by:
getHeaders in interface javax.servlet.http.HttpServletRequest
See Also:
PortletRequest.getProperties(String), HttpServletRequest.getHeaders(String)

getIntHeader

public int getIntHeader(java.lang.String name)
Not allowed in a portlet.

Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getMethod

public java.lang.String getMethod()
Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest

getPathInfo

public java.lang.String getPathInfo()
Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest

getPathTranslated

public java.lang.String getPathTranslated()
Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest

getQueryString

public java.lang.String getQueryString()
Specified by:
getQueryString in interface javax.servlet.http.HttpServletRequest

getRemoteUser

public java.lang.String getRemoteUser()
Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest

getRequestURI

public java.lang.String getRequestURI()
Not allowed in a portlet.

Specified by:
getRequestURI in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getRequestURL

public java.lang.StringBuffer getRequestURL()
Not allowed in a portlet.

Specified by:
getRequestURL in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest

getServletPath

public java.lang.String getServletPath()
A PortletRequest has no servlet path. But for compatibility with Struts 2 components and interceptors, the action parameter on the request is mapped to the servlet path.

Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest
See Also:
HttpServletRequest.getServletPath()

getSession

public javax.servlet.http.HttpSession getSession()
Get the PortletSession as a PortletHttpSession instance.

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
See Also:
HttpServletRequest.getSession()

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
Get the PortletSession as a PortletHttpSession instance.

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
See Also:
HttpServletRequest.getSession(boolean)

getUserPrincipal

public java.security.Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Not allowed in a portlet.

Specified by:
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Not allowed in a portlet.

Specified by:
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Not allowed in a portlet.

Specified by:
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest

isUserInRole

public boolean isUserInRole(java.lang.String role)
Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Gets an attribute value on the PortletRequest. If the attribute name is javax.servlet.include.servlet_path, it returns the same as getServletPath()

Specified by:
getAttribute in interface javax.servlet.ServletRequest
See Also:
ServletRequest.getAttribute(java.lang.String)

getAttributeNames

public java.util.Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface javax.servlet.ServletRequest

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Can only be invoked in the event phase.

Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - If the portlet is not in the event phase.
See Also:
ServletRequest.getCharacterEncoding()

getContentLength

public int getContentLength()
Can only be invoked in the event phase.

Specified by:
getContentLength in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - If the portlet is not in the event phase.
See Also:
ServletRequest.getContentLength()

getContentType

public java.lang.String getContentType()
Can only be invoked in the event phase.

Specified by:
getContentType in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - If the portlet is not in the event phase.
See Also:
ServletRequest.getContentType()

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Can only be invoked in the event phase. When invoked in the event phase, it will wrap the portlet's InputStream as a PortletServletInputStream.

Specified by:
getInputStream in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - If the portlet is not in the event phase.
java.io.IOException
See Also:
ServletRequest.getInputStream()

getLocalAddr

public java.lang.String getLocalAddr()
Not allowed in a portlet.

Specified by:
getLocalAddr in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getLocalName

public java.lang.String getLocalName()
Not allowed in a portlet.

Specified by:
getLocalName in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getLocalPort

public int getLocalPort()
Not allowed in a portlet.

Specified by:
getLocalPort in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface javax.servlet.ServletRequest

getLocales

public java.util.Enumeration getLocales()
Specified by:
getLocales in interface javax.servlet.ServletRequest

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.servlet.ServletRequest

getParameterMap

public java.util.Map getParameterMap()
Specified by:
getParameterMap in interface javax.servlet.ServletRequest

getParameterNames

public java.util.Enumeration getParameterNames()
Specified by:
getParameterNames in interface javax.servlet.ServletRequest

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.servlet.ServletRequest

getProtocol

public java.lang.String getProtocol()
Not allowed in a portlet.

Specified by:
getProtocol in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Can only be invoked in the event phase.

Specified by:
getReader in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - If the portlet is not in the event phase.
java.io.IOException
See Also:
ServletRequest.getReader()

getRealPath

public java.lang.String getRealPath(java.lang.String path)
Specified by:
getRealPath in interface javax.servlet.ServletRequest

getRemoteAddr

public java.lang.String getRemoteAddr()
Not allowed in a portlet.

Specified by:
getRemoteAddr in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getRemoteHost

public java.lang.String getRemoteHost()
Not allowed in a portlet.

Specified by:
getRemoteHost in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getRemotePort

public int getRemotePort()
Not allowed in a portlet.

Specified by:
getRemotePort in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Get the PortletRequestDispatcher as a PortletServletRequestDispatcher instance.

Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest
See Also:
ServletRequest.getRequestDispatcher(java.lang.String)

getScheme

public java.lang.String getScheme()
Specified by:
getScheme in interface javax.servlet.ServletRequest

getServerName

public java.lang.String getServerName()
Specified by:
getServerName in interface javax.servlet.ServletRequest

getServerPort

public int getServerPort()
Not allowed in a portlet.

Specified by:
getServerPort in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - Not allowed in a portlet.

isSecure

public boolean isSecure()
Specified by:
isSecure in interface javax.servlet.ServletRequest

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface javax.servlet.ServletRequest

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)
Specified by:
setAttribute in interface javax.servlet.ServletRequest

setCharacterEncoding

public void setCharacterEncoding(java.lang.String env)
                          throws java.io.UnsupportedEncodingException
Can only be invoked in the event phase.

Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Throws:
java.lang.IllegalStateException - If the portlet is not in the event phase.
java.io.UnsupportedEncodingException
See Also:
ServletRequest.setCharacterEncoding(String)

getPortletRequest

public javax.portlet.PortletRequest getPortletRequest()
Get the wrapped PortletRequest instance.

Returns:
The wrapped PortletRequest instance.

setExtension

public void setExtension(java.lang.String extension)


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.