Regain 2.1.0-STABLE API

net.sf.regain.util.sharedtag.taglib
Class JspPageRequest

java.lang.Object
  extended by net.sf.regain.util.sharedtag.PageRequest
      extended by net.sf.regain.util.sharedtag.taglib.JspPageRequest

public class JspPageRequest
extends PageRequest

Adapter from a JSP page context to a SharedTag PageRequest.

Author:
Til Schneider, www.murfman.de

Field Summary
private static URL mBaseUrl
          The base URL where the JSP files and resources are located.
private static org.apache.log4j.Logger mLog
          The logger for this class.
private  javax.servlet.jsp.PageContext mPageContext
          The JSP page context to adapt.
private static File mWorkingDir
          The working directory of the web server.
 
Constructor Summary
JspPageRequest(javax.servlet.jsp.PageContext pageContext)
          Creates a new instance of JspPageRequest.
 
Method Summary
 Object getContextAttribute(String name)
          Gets an attribute from the page context.
 String getHeader(String name)
          Gets the header with the given name.
 long getHeaderAsDate(String name)
          Gets the header with the given name as date.
 String getInitParameter(String name)
          Gets an init parameter.
 Locale getLocale()
          Gets the locale of the client.
 String getParameter(String name)
          Gets a request parameter that was given to page via GET or POST.
 Enumeration getParameterNames()
          Gets the names of the given parameters.
 String[] getParameters(String name)
          Gets all request parameters with the given name that were given to the page via GET or POST.
 URL getResourceBaseUrl()
          Gets the base URL where the JSP files and resources are located.
 Object getSessionAttribute(String name)
          Gets an attribute from the session.
 File getWorkingDir()
          Gets the working directory of the web server.
 void setContextAttribute(String name, Object value)
          Sets an attribute at the page context.
 void setSessionAttribute(String name, Object value)
          Sets an attribute at the session.
 
Methods inherited from class net.sf.regain.util.sharedtag.PageRequest
getParameter, getParameterAsInt, getParameters, getParametersNotNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mPageContext

private javax.servlet.jsp.PageContext mPageContext
The JSP page context to adapt.


mBaseUrl

private static URL mBaseUrl
The base URL where the JSP files and resources are located.


mWorkingDir

private static File mWorkingDir
The working directory of the web server.


mLog

private static org.apache.log4j.Logger mLog
The logger for this class.

Constructor Detail

JspPageRequest

public JspPageRequest(javax.servlet.jsp.PageContext pageContext)
Creates a new instance of JspPageRequest.

Parameters:
pageContext - The JSP page context to adapt.
Method Detail

getParameter

public String getParameter(String name)
Gets a request parameter that was given to page via GET or POST.

Specified by:
getParameter in class PageRequest
Parameters:
name - The name of the parameter.
Returns:
The given parameter or null if no such parameter was given.

getParameters

public String[] getParameters(String name)
                       throws RegainException
Gets all request parameters with the given name that were given to the page via GET or POST.

Specified by:
getParameters in class PageRequest
Parameters:
name - The name of the parameter.
Returns:
The parameters or null if no such parameter was given.
Throws:
RegainException - If getting the parameter failed.

getParameterNames

public Enumeration getParameterNames()
Gets the names of the given parameters.

Specified by:
getParameterNames in class PageRequest
Returns:
The names of the given parameters.

getHeader

public String getHeader(String name)
                 throws RegainException
Gets the header with the given name.

Specified by:
getHeader in class PageRequest
Parameters:
name - The name of the header.
Returns:
The header or null if no such header exists.
Throws:
RegainException - If getting the header failed.

getHeaderAsDate

public long getHeaderAsDate(String name)
                     throws RegainException
Gets the header with the given name as date.

Specified by:
getHeaderAsDate in class PageRequest
Parameters:
name - The name of the header.
Returns:
The date header or -1 if no such header exists.
Throws:
RegainException - If getting the header failed.

getLocale

public Locale getLocale()
                 throws RegainException
Gets the locale of the client.

Specified by:
getLocale in class PageRequest
Returns:
The locale.
Throws:
RegainException - If getting the locale failed.

setContextAttribute

public void setContextAttribute(String name,
                                Object value)
Sets an attribute at the page context.

Specified by:
setContextAttribute in class PageRequest
Parameters:
name - The name of the attribute to set.
value - The value of the attribute to set.

getContextAttribute

public Object getContextAttribute(String name)
Gets an attribute from the page context.

Specified by:
getContextAttribute in class PageRequest
Parameters:
name - The name of the attribute to get.
Returns:
The attribute's value or null if there is no such attribute.

setSessionAttribute

public void setSessionAttribute(String name,
                                Object value)
Sets an attribute at the session.

Specified by:
setSessionAttribute in class PageRequest
Parameters:
name - The name of the attribute to set.
value - The value of the attribute to set.

getSessionAttribute

public Object getSessionAttribute(String name)
Gets an attribute from the session.

Specified by:
getSessionAttribute in class PageRequest
Parameters:
name - The name of the attribute to get.
Returns:
The attribute's value or null if there is no such attribute.

getInitParameter

public String getInitParameter(String name)
Gets an init parameter.

Specified by:
getInitParameter in class PageRequest
Parameters:
name - The name of the init parameter.
Returns:
The value of the init parameter.

getResourceBaseUrl

public URL getResourceBaseUrl()
                       throws RegainException
Gets the base URL where the JSP files and resources are located.

Specified by:
getResourceBaseUrl in class PageRequest
Returns:
The base URL where the JSP files and resources are located.
Throws:
RegainException - If getting the base URL failed.

getWorkingDir

public File getWorkingDir()
                   throws RegainException
Gets the working directory of the web server.

Specified by:
getWorkingDir in class PageRequest
Returns:
The working directory of the web server.
Throws:
RegainException - If getting the working directory failed.

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info