org.apache.myfaces.tomahawk.util
Class RequestType

java.lang.Object
  extended by org.apache.myfaces.tomahawk.util.RequestType

public class RequestType
extends Object

TODO: This class is a copy of org.apache.myfaces.commons.util.RequestType Since tomahawk should be compatible with 1.1, this is placed here and there is not a dependency for myfaces-commons-utils, because this stuff only works for 1.2 (this class is also compatible with jdk 1.4) Represents the type of request currently in the ExternalContext. All servlet requests will be of the SERVLET requestType whereas all of the other RequestTypes will be portlet type requests. There are a number of convenience methods on the RequestType enumeration which can be used to determine the capabilities of the current request.

Since:
1.1.7

Field Summary
static RequestType ACTION
          The type for a portlet ActionRequest.
static RequestType EVENT
          The type for a portlet EventRequest.
static RequestType RENDER
          The type for a portlet RenderRequest.
static RequestType RESOURCE
          The type for a portlet ResourceRequest.
static RequestType SERVLET
          The type for all servlet requests.
 
Method Summary
 boolean isPortlet()
          Returns true if the response for this RequestType originated from a JSR-168 or JSR-286 portlet container.
 boolean isRequestFromClient()
          Returns true if this request was a direct result of a call from the client.
 boolean isResponseWritable()
          Returns true if the response for this RequestType is intended to produce output to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVLET

public static final RequestType SERVLET
The type for all servlet requests. SERVLET request types are both client requests and response writable.


RENDER

public static final RequestType RENDER
The type for a portlet RenderRequest. RENDER request types are for portlets and are response writable but are NOT client requests.


ACTION

public static final RequestType ACTION
The type for a portlet ActionRequest. ACTION request types are for portlets and are client requests but are NOT response writable.


RESOURCE

public static final RequestType RESOURCE
The type for a portlet ResourceRequest. RESOURCE request types are for portlets and are both client requests and response writable. RESOURCE request types will only be returned in a Portlet 2.0 portlet container.


EVENT

public static final RequestType EVENT
The type for a portlet EventRequest. EVENT request types are for portlets and are neither client requests nor response writable. EVENT request types will only be returned in a Portlet 2.0 portlet container.

Method Detail

isRequestFromClient

public boolean isRequestFromClient()
Returns true if this request was a direct result of a call from the client. This implies that the current application is the "owner" of the current request and that it has access to the inputStream, can get and set character encodings, etc. Currently all SERVLET, ACTION, and RESOURCE RequestTypes are client requests.

Returns:
true if the current request is a client data type request and false if it is not.

isResponseWritable

public boolean isResponseWritable()
Returns true if the response for this RequestType is intended to produce output to the client. Currently the SERVLET, RENDER, and RESOURCE request are response writable.

Returns:
true if the current request is intended to produce output and false if it is not.

isPortlet

public boolean isPortlet()
Returns true if the response for this RequestType originated from a JSR-168 or JSR-286 portlet container. Currently RENDER, ACTION, RESOURCE, and EVENT RequestTypes are all portlet requests.

Returns:
true if the current request originated inside of a JSR-168 or JSR-286 Portlet Container or false if it did not.


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.