Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.4.0)

E10686-05

oracle.adf.share
Class Environment

java.lang.Object
  extended by oracle.adf.share.Environment
Direct Known Subclasses:
ServletEnvironment

public abstract class Environment
extends java.lang.Object

Managed an anonymous environment consisting of a request, a response and a context.

This class allows the Faces API to be unaware of the nature of its containing application environment. In particular, this class allows JavaServer Faces based appications to run in either a Servlet or a Portlet environment.

In the method descriptions below, paragraphs starting with Servlet: and Portlet: denote behavior that is specific to that particular environment.


Constructor Summary
Environment()
           
 
Method Summary
 void clearCachedLocale()
          If the enviroment caches the locale, it should implement this method to clear the cached locale value.
abstract  void dispatch(java.lang.String path)
          Dispatch a request to the specified resource to create output for this response.
abstract  java.lang.String encodeResourceURL(java.lang.String url)
          Return the input URL, after performing any rewriting needed to ensure that it will correctly identify an addressable resource in the current application.
abstract  java.lang.Object getContext()
          Return the application environment object instance for the current appication.
 java.lang.Object getContextObject()
          Use this API to pass any object that can be used appropriately in the calling context.
abstract  java.lang.Object getRequest()
          Return the environment-specific object instance for the current request.
abstract  java.lang.String getRequestCharacterEncoding()
           
abstract  java.lang.String getRequestContextPath()
          Return the portion of the request URI that identifies the web application context for this request.
abstract  java.util.Locale getRequestLocale()
          Return the preferred Locale in which the client will accept content.
abstract  java.util.Map getRequestParameterMap()
           
abstract  java.lang.String getRequestPathInfo()
          Return the extra path information (if any) included in the request URI; otherwise, return null.
 java.lang.String getRequestQueryString()
           
abstract  java.lang.String getRequestServletPath()
          Return the servlet path information (if any) included in the request URI; otherwise, return null.
abstract  java.lang.String getRequestURI()
           
abstract  java.lang.Object getResponse()
          Return the environment-specific object instance for the current response.
abstract  void redirect(java.lang.String url)
          Redirect a request to the specified URL, and cause the responseComplete() method to be called on the FacesContext instance for the current request.
abstract  void setRequestCharacterEncoding(java.lang.String encoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Environment

public Environment()
Method Detail

getRequest

public abstract java.lang.Object getRequest()

Return the environment-specific object instance for the current request.

Servlet: This must be the current request's javax.servlet.http.HttpServletRequest instance.

Portlet: This must be the current request's javax.portlet.PortletRequest instance, which will be either an ActionRequest or a RenderRequest depending upon when this method is called.


getResponse

public abstract java.lang.Object getResponse()

Return the environment-specific object instance for the current response.

Servlet: This is the current request's javax.servlet.http.HttpServletResponse instance.

Portlet: This is the current request's javax.portlet.PortletResponse instance, which will be either an ActionResponse or a RenderResponse depending upon when this method is called.


getContext

public abstract java.lang.Object getContext()

Return the application environment object instance for the current appication.

Servlet: This must be the current application's javax.servlet.ServletContext instance.

Portlet: This must be the current application's javax.portlet.PortletContext instance.


getRequestLocale

public abstract java.util.Locale getRequestLocale()

Return the preferred Locale in which the client will accept content.

Servlet: This must be the value returned by the javax.servlet.ServletRequest method getLocale().

Portlet: This must be the value returned by the javax.portlet.PortletRequest method getLocale().


getRequestServletPath

public abstract java.lang.String getRequestServletPath()

Return the servlet path information (if any) included in the request URI; otherwise, return null.

Servlet: This must be the value returned by the javax.servlet.http.HttpServletRequest method getServletPath().

Portlet: This must be null.


getRequestPathInfo

public abstract java.lang.String getRequestPathInfo()

Return the extra path information (if any) included in the request URI; otherwise, return null.

Servlet: This must be the value returned by the javax.servlet.http.HttpServletRequest method getPathInfo().

Portlet: This must be null.


encodeResourceURL

public abstract java.lang.String encodeResourceURL(java.lang.String url)

Return the input URL, after performing any rewriting needed to ensure that it will correctly identify an addressable resource in the current application.

Servlet: This must be the value returned by the javax.servlet.http.HttpServletResponse method encodeURL(url).

Portlet: This must be the value returned by the javax.portlet.PortletResponse method encodeURL(url).

Parameters:
url - The input URL to be encoded
Throws:
java.lang.NullPointerException - if url is null

redirect

public abstract void redirect(java.lang.String url)
                       throws java.io.IOException

Redirect a request to the specified URL, and cause the responseComplete() method to be called on the FacesContext instance for the current request.

Servlet: This must be accomplished by calling the javax.servlet.http.HttpServletResponse method sendRedirect().

Portlet: This must be accomplished by calling the javax.portlet.ActionResponse method sendRedirect().

Parameters:
url - Absolute URL to which the client should be redirected
Throws:
java.lang.IllegalArgumentException - if the specified url is relative
java.lang.IllegalStateException - if, in a portlet environment, the current response object is a RenderResponse instead of an ActionResponse
java.lang.IllegalStateException - if, in a servlet environment, the current response has already been committed
java.io.IOException - if an input/output error occurs

dispatch

public abstract void dispatch(java.lang.String path)
                       throws java.io.IOException

Dispatch a request to the specified resource to create output for this response.

Servlet: This must be accomplished by calling the javax.servlet.ServletContext method getRequestDispatcher(path), and calling the forward() method on the resulting object.

Portlet: This must be accomplished by calling the javax.portlet.PortletContext method getRequestDispatcher(), and calling the include() method on the resulting object.

Parameters:
path - Context relative path to the specified resource, which must start with a slash ("/") character
Throws:
FacesException - thrown if a ServletException or PortletException occurs
java.lang.IllegalArgumentException - if no request dispatcher can be created for the specified path
java.lang.IllegalStateException - if this method is called in a portlet environment, and the current request is an ActionRequest instead of a RenderRequest
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if path is null

getRequestContextPath

public abstract java.lang.String getRequestContextPath()

Return the portion of the request URI that identifies the web application context for this request.

Servlet: This must be the value returned by the javax.servlet.http.HttpServletRequest method getContextPath().

Portlet: This must be the value returned by the javax.portlet.PortletRequest method getContextPath().


getRequestURI

public abstract java.lang.String getRequestURI()

getRequestQueryString

public java.lang.String getRequestQueryString()

getRequestCharacterEncoding

public abstract java.lang.String getRequestCharacterEncoding()

setRequestCharacterEncoding

public abstract void setRequestCharacterEncoding(java.lang.String encoding)
                                          throws java.io.IOException
Throws:
java.io.IOException

getRequestParameterMap

public abstract java.util.Map getRequestParameterMap()

clearCachedLocale

public void clearCachedLocale()
If the enviroment caches the locale, it should implement this method to clear the cached locale value.


getContextObject

public java.lang.Object getContextObject()
Use this API to pass any object that can be used appropriately in the calling context. One such usage of this will befrom the PortletADFContext to return an object acting as a bridge to ServletContext.


Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.4.0)

E10686-05

Copyright © 1997, 2011, Oracle. All rights reserved.