|
Oracle Fusion Middleware Java API Reference for Oracle PDK Java 11g Release 1 (11.1.1) E10691-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.portal.provider.v2.render.PortletRendererUtil oracle.portal.provider.v2.render.http.HttpPortletRendererUtil
public class HttpPortletRendererUtil
The HttpPortletRendererUtil class provides many useful utility methods designed
to simplify coding your renderer. HttpPortletRendererUtil extends PortletRendererUtil.
It implements those utilities that have a dependency on the (Http) servlet
interfaces. These are grouped into three categories: wrappers for
PortletRendererUtil utilities, utilities to managing caching, and covers for
servlet function. The wrappers for PortletRendererUtil utilities are provided
as a convenience for renderers implemented as JSPs or servlets. They give
you the convenience of passing servlet objects thus avoiding extracting the
PortletRenderRequest that is required in the PortletRendererUtil utilities. The
caching utilities simplify enabling either the validation or expiry based
caching provided by the Portal. As for servlet covers, there is currently
only one, sendRedirect
, that allows you send a redirect response
without directly accessing the servlet response object.
Field Summary |
---|
Fields inherited from class oracle.portal.provider.v2.render.PortletRendererUtil |
---|
BACK_LINK, DESIGN_LINK, EVENT_LINK, LOGIN_LINK, PAGE_LINK, PORTLET_PARAMETER_PREFIX, REQUEST_LINK |
Constructor Summary | |
---|---|
HttpPortletRendererUtil()
|
Method Summary | |
---|---|
static java.lang.String |
absoluteLink(javax.servlet.http.HttpServletRequest request,
java.lang.String relativePath)
Returns a fully-qualified URI for a path relative to the current request. |
static void |
addGeneratesESIHeader(PortletRenderRequest request)
Adds response header that enables processing of ESI tags by Web Cache. |
static int |
getCachedLevel(javax.servlet.http.HttpServletRequest request)
Gets the (cached) level passed by the portal for the current request. |
static int |
getCachedLevel(PortletRenderRequest request)
Gets the (cached) level passed by the portal for the current request. |
static java.lang.String |
getCachedVersion(javax.servlet.http.HttpServletRequest request)
Gets the (cached) version Id passed by the portal for the current request. |
static java.lang.String |
getCachedVersion(PortletRenderRequest request)
Gets the (cached) version Id passed by the portal for the current request. |
static java.lang.Object |
getEditData(javax.servlet.http.HttpServletRequest request)
Retrieves this requests customization data object. |
static void |
handleEditAction(PortletRenderRequest pr,
java.lang.String action)
Utility for generating redirects after processing edit/edit default forms |
static java.lang.String |
htmlFormActionLink(javax.servlet.http.HttpServletRequest request,
int linkType)
Transforms one of the various URIs known to the request into the appropriate form to be used in a FORM action tag. |
static java.lang.String |
htmlFormHiddenFields(javax.servlet.http.HttpServletRequest request,
int linkType)
Encodes the parameters in the query string of the passed URL as hidden form fields. |
static java.lang.String |
parameterizeLink(javax.servlet.http.HttpServletRequest request,
int linkType,
java.lang.String queryString)
Adds new parameters to an existing link. |
static java.lang.String |
portletParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String param)
Utility that turns a query string parameter name into fully qualified (unique) name. |
static void |
renderPortletFooter(javax.servlet.http.HttpServletRequest request,
java.io.Writer writer)
Closes rendering of the portlet container. |
static void |
renderPortletHeader(javax.servlet.http.HttpServletRequest request,
java.io.Writer writer,
java.lang.String title)
Opens rendering of the portlet's container. |
static void |
renderPortletTitlebar(javax.servlet.http.HttpServletRequest request,
java.io.Writer writer,
java.lang.String title)
Renders a portlet's titlebar. |
static void |
sendRedirect(PortletRenderRequest pr,
java.lang.String url)
|
static void |
setCachedVersion(javax.servlet.http.HttpServletResponse response,
java.lang.String version,
int level)
Sets the response (cached) version Id and level. |
static void |
setCachedVersion(PortletRenderRequest request,
java.lang.String version,
int level)
Sets the response (cached) version Id and level. |
static void |
setCacheExpires(javax.servlet.http.HttpServletResponse response,
int level,
int minutes)
Sets the expiration duration of the current response. |
static void |
setCacheExpires(PortletRenderRequest request,
int level,
int minutes)
Sets the expiration duration of the current response. |
static void |
submitEditData(javax.servlet.http.HttpServletRequest request,
java.lang.Object o)
Updates this requests customization data object creating the customization instance if necessary. |
static void |
useCachedVersion(javax.servlet.http.HttpServletResponse response)
Indicates to the portal that the cached version should be used to respond to the client. |
static void |
useCachedVersion(PortletRenderRequest request)
Indicates to the portal that the cached version should be used to respond to the client. |
static void |
useInvalidationCaching(PortletRenderRequest request)
Set the response header to cache content in Web Cache. |
static void |
useInvalidationCaching(PortletRenderRequest request,
int minutes)
Set the response header to cache the content for a specified duration in Web Cache. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpPortletRendererUtil()
Method Detail |
---|
public static void renderPortletHeader(javax.servlet.http.HttpServletRequest request, java.io.Writer writer, java.lang.String title) throws java.io.IOException
This is a convenience routine for use by renderers written as servlets or JSPs. I.e. those whose code objects are the servlet objects not the WebProvider objects.
request
- the servlet request.writer
- the response writer.title
- the titlebar label. If null the portlet's static title is used.
java.io.IOException
public static void renderPortletFooter(javax.servlet.http.HttpServletRequest request, java.io.Writer writer) throws java.io.IOException
This is a convenience routine for use by renderers written as servlets or JSPs. I.e. those whose code objects are the servlet objects not the WebProvider objects.
request
- the servlet request.writer
- the response writer.
java.io.IOException
public static void renderPortletTitlebar(javax.servlet.http.HttpServletRequest request, java.io.Writer writer, java.lang.String title) throws java.io.IOException
This is a convenience routine for use by renderers written as servlets or JSPs. I.e. those whose code objects are the servlet objects not the WebProvider objects.
request
- the servlet request.writer
- the response writer.title
- the label that should be displayed as the title. if null then
the method will render the static title retrieved via Portlet.getTitle();
java.io.IOException
public static java.lang.String parameterizeLink(javax.servlet.http.HttpServletRequest request, int linkType, java.lang.String queryString) throws java.lang.IllegalArgumentException
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
request
- the servlet request.linkType
- the id for the link we want to parameterize. ID constants are defined
in PortletRendererUtil.queryString
- the parameters to be added in properly encodes queryString form.
The string should begin with the first parameter name not a "?".
java.lang.IllegalArgumentException
public static java.lang.String absoluteLink(javax.servlet.http.HttpServletRequest request, java.lang.String relativePath)
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
request
- the servlet requestrelativePath
- the path you want to make absolutepublic static java.lang.String htmlFormActionLink(javax.servlet.http.HttpServletRequest request, int linkType) throws java.lang.IllegalArgumentException
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
request
- the serlvet request objectlinkType
- the link in this request that should be transformed.
Constants representing these types are defined in PortletRendererUtil.
java.lang.IllegalArgumentException
public static java.lang.String htmlFormHiddenFields(javax.servlet.http.HttpServletRequest request, int linkType) throws java.lang.IllegalArgumentException
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
request
- the servlet request.linkType
- the link to use. Constants representing these types are defined in PortletRendererUtil.
java.lang.IllegalArgumentException
public static java.lang.String portletParameter(javax.servlet.http.HttpServletRequest request, java.lang.String param)
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
request
- the current servlet request.param
- the name of the parameter to be qualified.public static java.lang.Object getEditData(javax.servlet.http.HttpServletRequest request) throws PortletNotFoundException, java.io.IOException, AccessControlException
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
PortletNotFoundException
java.io.IOException
AccessControlException
public static void submitEditData(javax.servlet.http.HttpServletRequest request, java.lang.Object o) throws java.io.IOException, AccessControlException
Note: this is a convenience routine for renderers implemented as servlets or JSPs in that it merely extracts the PortletRenderRequest from the servlet request and then calls the (real) utility method.
java.io.IOException
AccessControlException
public static void handleEditAction(PortletRenderRequest pr, java.lang.String action) throws java.io.IOException
pr
- the requestaction
- the action submitted with the edit form (OK/APPLY)
java.io.IOException
public static void setCacheExpires(javax.servlet.http.HttpServletResponse response, int level, int minutes) throws java.lang.IllegalArgumentException
Note: this is a convenience routine for renderers implemented as servlets or JSPs.
response
- the servlet response.level
- identifies whether this is a user specific response or a system (default)
response. Constants representing these levels are available in HttpCommonConstants.minutes
- the number of minutes this response can be reused before it expires.
The minimum is 0 and the maximum is 525600 (1 year).
java.lang.IllegalArgumentException
public static void setCacheExpires(PortletRenderRequest request, int level, int minutes) throws java.lang.IllegalArgumentException
request
- the current portlet requestlevel
- identifies whether this is a user specific response or a system (default)
response. Constants representing these levels are available in HttpCommonConstants.minutes
- the number of minutes this response can be reused before it expires.
The minimum is 0 and the maximum is 525600 (1 year).
java.lang.IllegalArgumentException
public static void useInvalidationCaching(PortletRenderRequest request)
request
- the current portlet requestpublic static void useInvalidationCaching(PortletRenderRequest request, int minutes)
ProviderAdapter
. The max expiry time is
set to the minimum of the render context max expiry time and the expiry time
passed to this funtion.
request
- the current portlet requestminutes
- The time for which the content should be cached in Web Cache before it expires.public static void addGeneratesESIHeader(PortletRenderRequest request)
Adds the header: Surrogate-Control: content="ORAESI/9.0.2"
request
- the current portlet requestpublic static void setCachedVersion(javax.servlet.http.HttpServletResponse response, java.lang.String version, int level) throws java.lang.IllegalArgumentException
This method registers (by setting response header fields) the portlet's cached version ID and user level for the response it has generated.
response
- the serlvet response objectversion
- identifies the response version. Portlets should be able to use this
in subsequent requests to determine if a new response should be generated.level
- whether this is a user or system level response. Constants for
these levels are defined in HttpCommonConstants.
java.lang.IllegalArgumentException
public static void setCachedVersion(PortletRenderRequest request, java.lang.String version, int level) throws java.lang.IllegalArgumentException
This method registers (by setting response header fields) the portlet's cached version ID and user level for the response it has generated.
request
- the portlet render response objectversion
- identifies the response version. Portlets should be able to use this
in subsequent requests to determine if a new response should be generated.level
- whether this is a user or system level response. Constants for
these levels are defined in HttpCommonConstants.
java.lang.IllegalArgumentException
public static void useCachedVersion(javax.servlet.http.HttpServletResponse response)
This method is used when a portlet determines that the cached version is still valid and should be used. The method writes the appropriate response header indicating the cached version is still valid.
response
- the servlet response object.public static void useCachedVersion(PortletRenderRequest request)
This method is used when a portlet determines that the cached version is still valid and should be used. The method writes the appropriate response header indicating the cached version is still valid.
request
- the portlet render request object.public static java.lang.String getCachedVersion(javax.servlet.http.HttpServletRequest request)
This method is used when a portlet (using validation based caching) receives a request. It returns the version ID for the current cached version held by the portal. Portlets use this value in conjunction with getCachedLevel() to determine whether to generate a new response or indicate that the portal can reuse its cached version.
request
- the servlet request object.public static java.lang.String getCachedVersion(PortletRenderRequest request)
This method is used when a portlet (using validation based caching) receives a request. It returns the version ID for the current cached version held by the portal. Portlets use this value in conjunction with getCachedLevel() to determine whether to generate a new response or indicate that the portal can reuse its cached version.
request
- the portlet render request object.public static int getCachedLevel(javax.servlet.http.HttpServletRequest request) throws java.lang.IllegalStateException
This method is used when a portlet (using validation based caching) receives a request. It returns the cache level for the current cached version held by the portal. Portlets use this value in conjunction with getCachedVersion() to determine whether to generate a new response or indicate that the portal can reuse its cached version.
request
- the servlet request object.
java.lang.IllegalStateException
public static int getCachedLevel(PortletRenderRequest request) throws java.lang.IllegalStateException
This method is used when a portlet (using validation based caching) receives a request. It returns the cache level for the current cached version held by the portal. Portlets use this value in conjunction with getCachedVersion() to determine whether to generate a new response or indicate that the portal can reuse its cached version.
request
- the portlet render request object.
java.lang.IllegalStateException
public static void sendRedirect(PortletRenderRequest pr, java.lang.String url) throws java.lang.IllegalStateException, java.io.IOException
java.lang.IllegalStateException
java.io.IOException
|
Oracle Fusion Middleware Java API Reference for Oracle PDK Java 11g Release 1 (11.1.1) E10691-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |