com.cc.framework.http
Class HttpUtil

java.lang.Object
  extended bycom.cc.framework.http.HttpUtil

public abstract class HttpUtil
extends java.lang.Object

Helper class to create informations about the session, request object or the system environment.

Since:
1.0
Version:
$Revision: 1.33 $
Author:
Harald Schulz

Field Summary
private static int LABEL_LENGTH
          LABEL_LENGTH
 
Constructor Summary
private HttpUtil()
          Constructor
 
Method Summary
static java.lang.String createContextInfo(javax.servlet.ServletContext context)
          Creates information about the servlet context.
static java.lang.String createCookieInfo(javax.servlet.http.HttpServletRequest request)
          Creates information about the cookies
static java.lang.String createEnvironmentInfo()
          Creates informations about the system environment and the Java VM.
static java.util.Hashtable createParameterTable(javax.servlet.http.HttpServletRequest request)
          Returns an enumeration of parameter names
static java.util.Hashtable createParameterTable(javax.servlet.http.HttpServletRequest request, java.util.Set excludes)
          Returns an enumeration of parameter names
static java.util.Properties createProperties(javax.servlet.http.HttpServletRequest request)
          Returns an enumeration of parameter names
static java.util.Properties createProperties(javax.servlet.http.HttpServletRequest request, java.util.Set excludes)
          Returns an enumeration of parameter names
static java.lang.String createRequestInfo(javax.servlet.http.HttpServletRequest request, boolean includeParameters)
          Creates information about the request parameter.
static java.lang.String createRequestInfo(javax.servlet.http.HttpServletRequest request, boolean includeParameters, java.util.Set excludes)
          Creates information about the request parameter.
static java.lang.String createSessionInfo(javax.servlet.http.HttpSession session)
          Creates informations about the user session
static java.lang.String createVersionInfo(VersionInfo version)
          Creates a Version String
static java.lang.String getAppContextPath(javax.servlet.http.HttpServletRequest request)
          Computes the applications full qualified context path
static java.lang.String getJSPVersion()
          Returns the version of the JSP specification
private static java.lang.String head(java.lang.String label)
           
static boolean isRequestMarked(javax.servlet.http.HttpServletRequest request, java.lang.String mark)
          Checks if a mark is present
private static java.lang.String lbl(java.lang.String label)
           
static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, HttpScope scope)
          Locate and return the specified bean, from an optionally specified scope, in the specified page context.
static java.lang.Object lookup(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, java.lang.String name, HttpScope scope)
          Locate and return the specified bean, from an optionally specified scope, in the specified page context.
private static java.lang.Object lookupDialog(javax.servlet.http.HttpServletRequest request, java.lang.String name)
          Locate and return the specified bean, from the dialog scope.
private static java.lang.Object lookupDialog(javax.servlet.jsp.PageContext pageContext, java.lang.String name)
          Locate and return the specified bean, from the dialog scope.
static java.lang.Object markRequest(javax.servlet.http.HttpServletRequest request, java.lang.String mark, java.lang.Object value)
          Marks the request with an named attribute.
private static java.lang.String separator(java.lang.String label)
           
static java.lang.Object unmarkRequest(javax.servlet.http.HttpServletRequest request, java.lang.String mark)
          Removes the mark from the request
static java.lang.String urlDecode(java.lang.String encoded)
          Performs an URL-Decoding for the given String
static java.lang.String urlEncode(java.lang.Object decoded)
          Performs an URL-Encoding for the given String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL_LENGTH

private static final int LABEL_LENGTH
LABEL_LENGTH

See Also:
Constant Field Values
Constructor Detail

HttpUtil

private HttpUtil()
Constructor

Method Detail

head

private static java.lang.String head(java.lang.String label)

separator

private static java.lang.String separator(java.lang.String label)

lbl

private static java.lang.String lbl(java.lang.String label)

lookupDialog

private static java.lang.Object lookupDialog(javax.servlet.jsp.PageContext pageContext,
                                             java.lang.String name)
Locate and return the specified bean, from the dialog scope. If no such bean is found, return null instead.

Parameters:
pageContext - Page context to be searched
name - Name of the bean to be retrieved
Returns:
JavaBean in the specified page context

lookupDialog

private static java.lang.Object lookupDialog(javax.servlet.http.HttpServletRequest request,
                                             java.lang.String name)
Locate and return the specified bean, from the dialog scope. If no such bean is found, return null instead.

Parameters:
request - Request context to be searched
name - Name of the bean to be retrieved
Returns:
JavaBean in the specified page context

lookup

public static java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext,
                                      java.lang.String name,
                                      HttpScope scope)
Locate and return the specified bean, from an optionally specified scope, in the specified page context. If no such bean is found, return null instead.

Parameters:
pageContext - Page context to be searched
name - Name of the bean to be retrieved
scope - Scope to be searched (page, request, session, application) or null to use findAttribute() instead
Returns:
JavaBean in the specified page context

lookup

public static java.lang.Object lookup(javax.servlet.ServletContext servletContext,
                                      javax.servlet.http.HttpServletRequest request,
                                      java.lang.String name,
                                      HttpScope scope)
Locate and return the specified bean, from an optionally specified scope, in the specified page context. If no such bean is found, return null instead.

Parameters:
servletContext - The servlet context to be searched
request - The request context to be searched
name - Name of the bean to be retrieved
scope - Scope to be searched (page, request, session, application) or null to use findAttribute() instead
Returns:
JavaBean in the specified page context

markRequest

public static java.lang.Object markRequest(javax.servlet.http.HttpServletRequest request,
                                           java.lang.String mark,
                                           java.lang.Object value)
Marks the request with an named attribute. This mark will survive multiple request forwards. So it is possible to track if the request has been handled before.

Parameters:
request - HttpServletRequest
mark - she name of the mark
value - an optional value
Returns:
returns the last value of the mark or null

unmarkRequest

public static java.lang.Object unmarkRequest(javax.servlet.http.HttpServletRequest request,
                                             java.lang.String mark)
Removes the mark from the request

Parameters:
request - HttpServletRequest
mark - she name of the mark
Returns:
returns the last value of the mark or null

isRequestMarked

public static boolean isRequestMarked(javax.servlet.http.HttpServletRequest request,
                                      java.lang.String mark)
Checks if a mark is present

Parameters:
request - HttpServletRequest
mark - she name of the mark
Returns:
returns true if the mark is present

urlEncode

public static java.lang.String urlEncode(java.lang.Object decoded)
Performs an URL-Encoding for the given String

Parameters:
decoded - String in raw format
Returns:
encoded String which can be used safely in URL's

urlDecode

public static java.lang.String urlDecode(java.lang.String encoded)
Performs an URL-Decoding for the given String

Parameters:
encoded - URL encoded String
Returns:
readable decoded String

getAppContextPath

public static java.lang.String getAppContextPath(javax.servlet.http.HttpServletRequest request)
Computes the applications full qualified context path

Parameters:
request - HTTP request
Returns:
Context path

createParameterTable

public static java.util.Hashtable createParameterTable(javax.servlet.http.HttpServletRequest request)
Returns an enumeration of parameter names

Parameters:
request - HttpServletRequest
Returns:
Hashtable

createParameterTable

public static java.util.Hashtable createParameterTable(javax.servlet.http.HttpServletRequest request,
                                                       java.util.Set excludes)
Returns an enumeration of parameter names

Parameters:
request - HttpServletRequest
excludes - a set with parameter names that should be excluded from output
Returns:
Hashtable

createProperties

public static java.util.Properties createProperties(javax.servlet.http.HttpServletRequest request)
Returns an enumeration of parameter names

Parameters:
request - HttpServletRequest
Returns:
Properties

createProperties

public static java.util.Properties createProperties(javax.servlet.http.HttpServletRequest request,
                                                    java.util.Set excludes)
Returns an enumeration of parameter names

Parameters:
request - HttpServletRequest
excludes - a set with parameter names that should be excluded from output
Returns:
Properties

createSessionInfo

public static java.lang.String createSessionInfo(javax.servlet.http.HttpSession session)
Creates informations about the user session

Parameters:
session - HttpSession
Returns:
String

createRequestInfo

public static java.lang.String createRequestInfo(javax.servlet.http.HttpServletRequest request,
                                                 boolean includeParameters)
Creates information about the request parameter.

Parameters:
request - HttpServletRequest
includeParameters - true to show Parameters
Returns:
String

createRequestInfo

public static java.lang.String createRequestInfo(javax.servlet.http.HttpServletRequest request,
                                                 boolean includeParameters,
                                                 java.util.Set excludes)
Creates information about the request parameter.

Parameters:
request - HttpServletRequest
includeParameters - true to show Parameters
excludes - a set with parameter names that should be excluded from output
Returns:
String

createCookieInfo

public static java.lang.String createCookieInfo(javax.servlet.http.HttpServletRequest request)
Creates information about the cookies

Parameters:
request - HttpServletRequest
Returns:
String

createContextInfo

public static java.lang.String createContextInfo(javax.servlet.ServletContext context)
Creates information about the servlet context.

Parameters:
context - ServletContext
Returns:
String

createEnvironmentInfo

public static java.lang.String createEnvironmentInfo()
Creates informations about the system environment and the Java VM.

Returns:
String

createVersionInfo

public static java.lang.String createVersionInfo(VersionInfo version)
Creates a Version String

Parameters:
version - Version Information
Returns:
String

getJSPVersion

public static java.lang.String getJSPVersion()
Returns the version of the JSP specification

Returns:
String the JSP version


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.