org.apache.myfaces.trinidad.util
Class ExternalContextUtils

java.lang.Object
  extended by org.apache.myfaces.trinidad.util.ExternalContextUtils

public class ExternalContextUtils
extends java.lang.Object

This provides some functionality for determining some things about the native request object that is not provided by the base utils.

Version:
$Revision$ $Date$

Method Summary
static java.lang.String getCharacterEncoding(javax.faces.context.ExternalContext externalContext)
          Returns the character encoding or null if there isn't any
static int getContentLength(javax.faces.context.ExternalContext externalContext)
          Returns the content length or -1 if the unknown.
static java.lang.String getContentType(javax.faces.context.ExternalContext externalContext)
          Returns the content type from the current externalContext or null if unknown.
static java.io.InputStream getRequestInputStream(javax.faces.context.ExternalContext externalContext)
          Returns the request input stream if one is available
static boolean isAction(javax.faces.context.ExternalContext externalContext)
          Returns true if this externalContext represents an "action".
static boolean isPortlet(javax.faces.context.ExternalContext externalContext)
          Returns whether or not this external context is from a Portlet or a Servlet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCharacterEncoding

public static java.lang.String getCharacterEncoding(javax.faces.context.ExternalContext externalContext)
Returns the character encoding or null if there isn't any

Parameters:
externalContext -
Returns:

getContentLength

public static int getContentLength(javax.faces.context.ExternalContext externalContext)
Returns the content length or -1 if the unknown.

Parameters:
externalContext - the ExternalContext
Returns:
the length or -1

getContentType

public static java.lang.String getContentType(javax.faces.context.ExternalContext externalContext)
Returns the content type from the current externalContext or null if unknown.

Parameters:
externalContext - the ExternalContext
Returns:
the content type or null

getRequestInputStream

public static java.io.InputStream getRequestInputStream(javax.faces.context.ExternalContext externalContext)
                                                 throws java.io.IOException
Returns the request input stream if one is available

Parameters:
externalContext -
Returns:
Throws:
java.io.IOException

isAction

public static boolean isAction(javax.faces.context.ExternalContext externalContext)
Returns true if this externalContext represents an "action". An action request is any ServletRequest or a portlet ActionRequest. It is assumed that the ExternalContext

Returns:
a boolean of true if this is a Portlet ActionRequest or an non-portlet request.

isPortlet

public static boolean isPortlet(javax.faces.context.ExternalContext externalContext)
Returns whether or not this external context is from a Portlet or a Servlet.

Parameters:
externalContext - the ExternalContext to check
Returns:
true if this is a portlet RenderRequest or ActionRequest and false if it is not.


Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.