oracle.portal.provider.v1.http
Class ServletPortletRenderRequest

java.lang.Object
  |
  +--oracle.portal.provider.v1.http.ServletPortletRenderRequest

public class ServletPortletRenderRequest
extends java.lang.Object
implements PortletRenderRequest, PortletExecutionTracker, PerformanceLoggerAccessor

ServletPortletRenderRequest is the JPDK's base implementation of the PortletRenderRequest interface. It represents a PortletRenderRequest running in a servlet environment.

The interfaces PortletExecutionTracker and PerformanceLoggerAccessor are used for tracking the execution time of a portlet, and for logging performance stats about it.


Constructor Summary
ServletPortletRenderRequest(PortletReference ref, ServletProviderRequest request)
          Constructs a ServletPortletRenderRequest.
 
Method Summary
 java.lang.String[] getAcceptContentTypes()
           
 java.lang.Object getAttribute(java.lang.String name)
          Data can be passed between object in a request via attr/value pairs hung off the RequestContext.
 java.util.Enumeration getAttributeNames()
          returns the names of this request's attributes
 java.lang.String getBackURL()
           
 java.lang.String getCharacterEncoding()
          The default IANA character encoding to be used for this request's response.
 java.lang.String getContentType()
          Gets the current contentType for this request's response.
 java.lang.Object[] getCookies()
          A session is an object that maintains state across requests.
 java.util.Locale getDefaultLocale()
          Returns the Portal's default Locale.
 java.lang.String getDesignURL()
           
 DeviceInfo getDeviceInfo()
           
 java.util.Locale getLocale()
          The preferred Java Locale to be used for this response.
 java.util.Enumeration getLocales()
          Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
 java.lang.String getLoginServerURL()
           
 int getMode()
           
 java.lang.String getOriginalHeader(java.lang.String name)
          If this is a mobile request iAS Wireless will have overwritten some of the client's original HTTP headers: specifically the Accept and the UserAgent header.
 java.lang.String getPageURL()
           
 java.lang.String getParameter(java.lang.String name)
          Returns the request parameter of the given name.
 java.lang.String getParameterCharacterEncoding()
          The IANA character encoding of the parameters passed with this request.
 java.util.Locale getParameterLocale()
          The Java Locale of the parameters passed with this request.
 java.util.Enumeration getParameterNames()
          Returns an enumeration containing the parameter names passed in this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the values for the named request parameter.
 PerformanceLogger getPerformanceLogger()
          Returns a performance logger object.
 PortletPersonalizationManager getPersonalizationManager()
          Gets the PortletPersonalizationManager controlling this request.
 PortalConfig getPortalConfig()
           
 Portlet getPortlet()
          Gets the Portlet associated with this request.
 long getPortletKillTimeout()
          Returns the maximum time that a portlet may take to execute, after which it should be forcefully terminated.
 PortletReference getPortletReference()
          Gets the portlet reference for the instance we are intended to render.
 long getPortletStartTime()
          Returns the time at which the request started.
 long getPortletTimeout()
          Returns the maximum time that the portlet should take to be rendered.
 java.lang.String getPreferredContentType()
           
 Provider getProvider()
          Gets the Provider associated with this request.
 java.util.ResourceBundle getProviderResource()
          Returns the Provider resource associated with the Locale of this request.
 java.lang.String getQualifiedParameter(java.lang.String name)
          Returns the qualified request parameter of the given non-qualified name.
 java.util.Enumeration getQualifiedParameterNames()
          Returns an enumeration containing only those parameter names that match this portlets fully qualified name.
 java.lang.String[] getQualifiedParameterValues(java.lang.String name)
          Returns the qualified request parameter values of the given non-qualified name.
 java.lang.String getRequestURL()
           
 java.lang.String getScheme()
          The scheme we are running in.
 PortletSecurityManager getSecurityManager()
          Gets the PortletSecurityManager controlling this request.
 java.lang.String getServerName()
          Server name.
 int getServerPort()
          Port used by this server.
 ProviderSession getSession()
          A session is an object that maintains state across requests.
 java.lang.String getURLCharSet()
          Returns the character set that was used when the parameters of the request were encoded.
 ProviderUser getUser()
          Gets the user making this request.
 java.lang.String getUserAgent()
          The user agent that originated this request.
 java.io.PrintWriter getWriter()
          Returns a PrintWriter used to emit this request's response.
 java.io.PrintWriter getWriter(java.lang.String contentType)
          Returns a PrintWriter used to emit this request's response.
 java.io.PrintWriter getWriter(java.lang.String contentType, java.lang.String encoding)
          Returns a PrintWriter used to emit this request's response.
 boolean hasBorder()
           
 boolean hasPortletKillTimeoutElapsed()
          Indicates whether this request has exceeded its 'kill time', i.e, the time after which the thread should be forcefully stopped.
 boolean hasPortletTimeoutElapsed()
          Indicates whether this request has exceeded an execution timeout.
 boolean hasTitle()
           
 void removeAttribute(java.lang.String name)
          Removes an existing attribute.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Data can be passed between object in a request via attr/value pairs hung off the RequestContext.
 void setCharacterEncoding(java.lang.String encoding)
          Sets the IANA character encoding to be used for this request's response.
 void setContentType(java.lang.String contentType)
          Sets the contentType for this request's response.
 boolean translateDefaultCustomizations()
          The Portal supports an edit mode that allows a page developer to create multiple language versions of a page including the default customizations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletPortletRenderRequest

public ServletPortletRenderRequest(PortletReference ref,
                                   ServletProviderRequest request)
Constructs a ServletPortletRenderRequest.
Parameters:
ref - a PortletReference.
request - a ServletProviderRequest.
Method Detail

getDesignURL

public java.lang.String getDesignURL()
                              throws java.lang.IllegalStateException
Specified by:
getDesignURL in interface PortletRenderRequest
Returns:
a URL that returns one to the portal page that invoked this portlet.Note: Query string is included if applicable.

getPageURL

public java.lang.String getPageURL()
                            throws java.lang.IllegalStateException
Specified by:
getPageURL in interface PortletRenderRequest
Returns:
the URL of the page that invoked this portlet. Portlets use this to (re)write URLs in their response that should redisplay the portlet in this page. Note: Query string is included if applicable.

getBackURL

public java.lang.String getBackURL()
                            throws java.lang.IllegalStateException
Specified by:
getBackURL in interface PortletRenderRequest
Returns:
the URL of the page that caused this page to display.

getRequestURL

public java.lang.String getRequestURL()
                               throws java.lang.IllegalStateException
Specified by:
getRequestURL in interface PortletRenderRequest
Returns:
the URL that invoked this portlet. Portlets use this to (re)write HREFs in their response as these references must be absolute paths since the client browser considers the current target the portal. Note: request parameters are always returned as part of the URLs querystring regardless of whether the request was received via an HTTP GET or POST.

getLoginServerURL

public java.lang.String getLoginServerURL()
                                   throws java.lang.IllegalStateException
Specified by:
getLoginServerURL in interface PortletRenderRequest
Returns:
the URL ....

getAcceptContentTypes

public java.lang.String[] getAcceptContentTypes()
                                         throws java.lang.IllegalStateException
Specified by:
getAcceptContentTypes in interface PortletRenderRequest
Returns:
an array of mime-types in preference order being requested. I.e. the portal may pass a list of valid mime-types it accepts for the target device. The Portlet must emit its response in one of these mime-types. The list is ordered by reference with the first being the highest preference.

getPreferredContentType

public java.lang.String getPreferredContentType()
                                         throws java.lang.IllegalStateException
Specified by:
getPreferredContentType in interface PortletRenderRequest
Returns:
the most preferred mime-type beign requested.

hasTitle

public boolean hasTitle()
                 throws java.lang.IllegalStateException
Specified by:
hasTitle in interface PortletRenderRequest
Returns:
an indicator of whether this portlet should draw a title or not.

hasBorder

public boolean hasBorder()
                  throws java.lang.IllegalStateException
Specified by:
hasBorder in interface PortletRenderRequest
Returns:
an indicator of whether this portlet should draw its border or not.

translateDefaultCustomizations

public boolean translateDefaultCustomizations()
The Portal supports an edit mode that allows a page developer to create multiple language versions of a page including the default customizations. The boolean return value from this call indicates whether or not the Portlet is in this mode. If false the Portlet should save all edit_default customizations in the default (language) customization. If true the Portlet should save all edit_default customizations in the current language customization.
Specified by:
translateDefaultCustomizations in interface PortletRenderRequest

getMode

public int getMode()
            throws java.lang.IllegalStateException
Specified by:
getMode in interface PortletRenderRequest
Returns:
the rendering mode. The mode is defined in the various constants in PortletRenderingMode.

getPortletReference

public PortletReference getPortletReference()
Gets the portlet reference for the instance we are intended to render.
Specified by:
getPortletReference in interface PortletRenderRequest
Tags copied from interface: PortletRenderRequest
Returns:
the portlet reference for the instance we are intended to render. This is the object that represents what (the instance) we are rendering.

getUser

public ProviderUser getUser()
Gets the user making this request.
Specified by:
getUser in interface PortletRenderRequest
Tags copied from interface: PortletRenderRequest
Returns:
the user making this request.

getDeviceInfo

public DeviceInfo getDeviceInfo()
Specified by:
getDeviceInfo in interface PortletRenderRequest
Returns:
the device information for this request.

getPortalConfig

public PortalConfig getPortalConfig()
Specified by:
getPortalConfig in interface PortletRenderRequest
Returns:
an object containing information pertinent to the portlet about how the portal is currently configured. Currently, only a single state is defined: mobileEnabled. Portlets may use this information to add customization fields to its screens or help information that pertain to mobile.

getOriginalHeader

public java.lang.String getOriginalHeader(java.lang.String name)
If this is a mobile request iAS Wireless will have overwritten some of the client's original HTTP headers: specifically the Accept and the UserAgent header. These routines give you access to the original values. Note: if the values haven't been overwritten then its assumed that the standard headers contain the original values. In this situation these methods return the values for the standard headers. In this way these methods always give you access to the header values as they originated from the client whether or not they have been overwritten.
Specified by:
getOriginalHeader in interface PortletRenderRequest
Parameters:
name - the header name you want the original value for. I.e. if you pass "Accept" you will receive the original value of "Accept" whether its been overwritten or not.

getProvider

public Provider getProvider()
Gets the Provider associated with this request. This is equivalent to calling getPortletReference().getPortlet().getProvider().
Specified by:
getProvider in interface PortletRenderRequest
Tags copied from interface: PortletRenderRequest
Returns:
the Provider associated with this request. This is equivalent to calling getPortletReference().getPortlet().getProvider().

getPortlet

public Portlet getPortlet()
Gets the Portlet associated with this request. This is equivalent to calling getPortletReference().getPortlet().
Specified by:
getPortlet in interface PortletRenderRequest
Tags copied from interface: PortletRenderRequest
Returns:
the Portlet associated with this request. This is equivalent to calling getPortletReference().getPortlet().

getSecurityManager

public PortletSecurityManager getSecurityManager()
Gets the PortletSecurityManager controlling this request. This is equivalent to getPortletReference().getPortlet().getSecurityManager();
Specified by:
getSecurityManager in interface PortletRenderRequest
Tags copied from interface: PortletRenderRequest
Returns:
the PortletSecurityManager controlling this request. This is equivalent to getPortletReference().getPortlet().getSecurityManager();

getPersonalizationManager

public PortletPersonalizationManager getPersonalizationManager()
Gets the PortletPersonalizationManager controlling this request. This is equivalent to getPortletReference().getPortlet().getPortletPersonalizationManager();
Specified by:
getPersonalizationManager in interface PortletRenderRequest
Tags copied from interface: PortletRenderRequest
Returns:
the PortletPersonalizationManager controlling this request. This is equivalent to getPortletReference().getPortlet().getPortletPersonalizationManager();

getScheme

public java.lang.String getScheme()
The scheme we are running in. Most commonly this will return http. Return value will be null if not running in any scheme. This can occur if running outside the context of a request as in a batch program filling a cache on the server.
Specified by:
getScheme in interface PortletRenderRequest

getUserAgent

public java.lang.String getUserAgent()
The user agent that originated this request. May be null if user-agent is local.
Specified by:
getUserAgent in interface PortletRenderRequest

getServerName

public java.lang.String getServerName()
Server name. Used to reconstruct absolute paths back to server.
Specified by:
getServerName in interface PortletRenderRequest

getServerPort

public int getServerPort()
Port used by this server. Used to reconstruct absolute paths back to server.
Specified by:
getServerPort in interface PortletRenderRequest

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the request parameter of the given name. If there are duplicates the first value is returned. Returned Parameter values are encoded using the RequestContext's encoding. By default this is ISO-8859-1.
Specified by:
getParameter in interface PortletRenderRequest
Parameters:
name - the name of the parameter whose value is requested.

getQualifiedParameter

public java.lang.String getQualifiedParameter(java.lang.String name)
Returns the qualified request parameter of the given non-qualified name. Because all portlets on a page share the same query string, portlets will often fully qualify their parameter names to the portlet instance to ensure the instance can distinguish its parameters from the others. This qualification is of the form providerId.portletId.instanceName.paramName. Utility methods are provided in PortletRendererUtil and HttpPortletRendererUtil to construct these fully qualified names.

Fully-qualified parameter names are somewhat inconvenient to use because they are dynamic. I.e. they are isntance-based. This method helps to overcome this inconvenience by allowing you to retrieve the fully qualified parameter name value passing only the non-qualified name. E.g. calling request.getQualifiedParameter("symbol") will return the value for the parameter named "curProviderId.curPortletId.curInstanceName.symbol".

As with getParameter(), if there are duplicates the first value is returned. Returned Parameter values are encoded using the RequestContext's encoding. By default this is ISO-8859-1.

Specified by:
getQualifiedParameter in interface PortletRenderRequest
Parameters:
name - the unqualfied name of the parameter whose value is requested.
Returns:
the value corresponding to the fully qualified name constructed by prepending the portlet reference information to the passed parameter name.

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns the values for the named request parameter. Returned Parameter values are encoded using the RequestContext's encoding. By default this is ISO-8859-1.
Specified by:
getParameterValues in interface PortletRenderRequest
Parameters:
name - the name of the parameter whose value is requested.
Returns:
an array of Strings; one element per value associated with this parameter name.

getQualifiedParameterValues

public java.lang.String[] getQualifiedParameterValues(java.lang.String name)
Returns the qualified request parameter values of the given non-qualified name. Because all portlets on a page share the same query string, portlets will often fully qualify their parameter names to the portlet instance to ensure the instance can distinguish its parameters from the others. This qualification is of the form providerId.portletId.instanceName.paramName. Utility methods are provided in PortletRendererUtil and HttpPortletRendererUtil to construct these fully qualified names.

Fully-qualified parameter names are somewhat inconvenient to use because they are dynamic. I.e. they are isntance-based. This method helps to overcome this inconvenience by allowing you to retrieve the fully qualified parameter name value passing only the non-qualified name. E.g. calling request.getQualifiedParameterValues("symbol") will return the values for the parameter named "curProviderId.curPortletId.curInstanceName.symbol".

Returned Parameter values are encoded using the RequestContext's encoding. By default this is ISO-8859-1.

Specified by:
getQualifiedParameterValues in interface PortletRenderRequest
Parameters:
name - the unqualfied name of the parameter whose value is requested.
Returns:
the values corresponding to the fully qualified name constructed by prepending the portlet reference information to the passed parameter name.

getParameterNames

public java.util.Enumeration getParameterNames()
Returns an enumeration containing the parameter names passed in this request.
Specified by:
getParameterNames in interface PortletRenderRequest

getQualifiedParameterNames

public java.util.Enumeration getQualifiedParameterNames()
Returns an enumeration containing only those parameter names that match this portlets fully qualified name. I.e. only those parameters that are prefixed by this portlet's curProviderId.curPortletId.curInstanceName. The return values remain fully qualified. I.e. the names in the enumeration remain fully qualified -- hence you use the regular methods to access (getParameter() vs. getQualifiedParameter())
Specified by:
getQualifiedParameterNames in interface PortletRenderRequest

setContentType

public void setContentType(java.lang.String contentType)
Sets the contentType for this request's response. After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.
Specified by:
setContentType in interface PortletRenderRequest

getContentType

public java.lang.String getContentType()
Gets the current contentType for this request's response. After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.
Specified by:
getContentType in interface PortletRenderRequest

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
Sets the IANA character encoding to be used for this request's response. After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.
Specified by:
setCharacterEncoding in interface PortletRenderRequest

getCharacterEncoding

public java.lang.String getCharacterEncoding()
The default IANA character encoding to be used for this request's response. After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.
Specified by:
getCharacterEncoding in interface PortletRenderRequest

getWriter

public java.io.PrintWriter getWriter(java.lang.String contentType,
                                     java.lang.String encoding)
                              throws java.io.IOException
Returns a PrintWriter used to emit this request's response. If applicable the passed contentType and character encoding are used to prepare the response (header).

Note:

if null is passed for the content type of the response is defaulted to "text/html".

if null is passed for the character encoding and the encoding has not previously been set by calling setCharacterEncoding() it will be defaulted using the default encoding of the request.

After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.

Specified by:
getWriter in interface PortletRenderRequest

getWriter

public java.io.PrintWriter getWriter(java.lang.String contentType)
                              throws java.io.IOException
Returns a PrintWriter used to emit this request's response. If applicable the passed contentType is used to prepare the response (header).

Note:

if null is passed the content type of the response is set to "text/html". Also, if the contentType doesn't contain character set information (or is null), this routine sets the character set information based on the default encoding of the request.

After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.

Specified by:
getWriter in interface PortletRenderRequest

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Returns a PrintWriter used to emit this request's response. If applicable the passed contentType is used to prepare the response (header).

Note:

Uses the content type specified by calling setContentType() or defaults the content type of the response to "text/html". Uses the character encoding set by calling setCharacterEncoding() or the default character encoding from the request

After the first call to any of the getWriter() methods the content type and character encoding cannot be changed.

Specified by:
getWriter in interface PortletRenderRequest

getLocale

public java.util.Locale getLocale()
The preferred Java Locale to be used for this response.
Specified by:
getLocale in interface PortletRenderRequest

getLocales

public java.util.Enumeration getLocales()
Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
Specified by:
getLocales in interface PortletRenderRequest

getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns the Portal's default Locale. Used by portlets/personalization managers to properly default to the correct language when preferred languages aren't supported. This value may be null. When null or when the portlet doesn't support this locale the Portlet's default Locale should be used. This is accessible via the Portlet interface (getDefaultLocale()).

Alternatively, you might consider using the getDefaultLocale() method in the PortletReference interface. This method is defined to return the Portlet's default locale if the Portal hasn't passed one.

Specified by:
getDefaultLocale in interface PortletRenderRequest

getParameterCharacterEncoding

public java.lang.String getParameterCharacterEncoding()
The IANA character encoding of the parameters passed with this request.
Specified by:
getParameterCharacterEncoding in interface PortletRenderRequest

getParameterLocale

public java.util.Locale getParameterLocale()
The Java Locale of the parameters passed with this request.
Specified by:
getParameterLocale in interface PortletRenderRequest

getProviderResource

public java.util.ResourceBundle getProviderResource()
Returns the Provider resource associated with the Locale of this request. This resource contains locale specific strings for the title bar.
Specified by:
getProviderResource in interface PortletRenderRequest

getSession

public ProviderSession getSession()
A session is an object that maintains state across requests. We use the Servlet Session abstraction as it really is Http independent and is the most commonly used session object in this model anyway.
Specified by:
getSession in interface PortletRenderRequest

getCookies

public java.lang.Object[] getCookies()
A session is an object that maintains state across requests. We use the Servlet Session abstraction as it really is Http independent and is the most commonly used session object in this model anyway.
Specified by:
getCookies in interface PortletRenderRequest

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Data can be passed between object in a request via attr/value pairs hung off the RequestContext. Clients are encouraged to prefix attribute names with fully qualified class names to avoid collisions. E.g. setAttribute("oracle.jdeveloper.chart.color", chartColor);
Specified by:
setAttribute in interface PortletRenderRequest
Parameters:
name - the name of the attribute.
value - the value for the attribute.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Data can be passed between object in a request via attr/value pairs hung off the RequestContext. Clients are encouraged to prefix attribute names with fully qualified class names to avoid collisions. E.g. setAttribute("oracle.jdeveloper.chart.color", chartColor);
Specified by:
getAttribute in interface PortletRenderRequest
Parameters:
name - the name of the attribute.
Returns:
value the value for the attribute.

getAttributeNames

public java.util.Enumeration getAttributeNames()
Description copied from interface: PortletRenderRequest
returns the names of this request's attributes
Specified by:
getAttributeNames in interface PortletRenderRequest

removeAttribute

public void removeAttribute(java.lang.String name)
Removes an existing attribute.
Specified by:
removeAttribute in interface PortletRenderRequest
Parameters:
name - the name of the attribute.

getURLCharSet

public java.lang.String getURLCharSet()
Returns the character set that was used when the parameters of the request were encoded. Used when encoding parameters for inclusion in a URL
Specified by:
getURLCharSet in interface PortletRenderRequest

getPortletStartTime

public long getPortletStartTime()
Returns the time at which the request started. Time is defined in number of milliseconds since January 1, 1970 UTC. return start time of the request
Specified by:
getPortletStartTime in interface PortletExecutionTracker

getPortletTimeout

public long getPortletTimeout()
Returns the maximum time that the portlet should take to be rendered.
Specified by:
getPortletTimeout in interface PortletExecutionTracker
Returns:
the portlet timeout in milliseconds

hasPortletTimeoutElapsed

public boolean hasPortletTimeoutElapsed()
Indicates whether this request has exceeded an execution timeout. The execution timeout is picked up from an initialisation argument or from a system default (in that order of preference.
Specified by:
hasPortletTimeoutElapsed in interface PortletExecutionTracker
Returns:
true if the portlet has timed out, false otherwise

getPortletKillTimeout

public long getPortletKillTimeout()
Returns the maximum time that a portlet may take to execute, after which it should be forcefully terminated.
Specified by:
getPortletKillTimeout in interface PortletExecutionTracker
Returns:
the portlet maximum execution time in milliseconds

hasPortletKillTimeoutElapsed

public boolean hasPortletKillTimeoutElapsed()
Indicates whether this request has exceeded its 'kill time', i.e, the time after which the thread should be forcefully stopped.
Specified by:
hasPortletKillTimeoutElapsed in interface PortletExecutionTracker
Returns:
true if the kill time has been exceeded, false otherwise.

getPerformanceLogger

public PerformanceLogger getPerformanceLogger()
Returns a performance logger object.
Specified by:
getPerformanceLogger in interface PerformanceLoggerAccessor
Returns:
a reference to a PerformanceLogger object.