com.tonbeller.wcf.controller
Class TestContext

java.lang.Object
  extended bycom.tonbeller.wcf.controller.RequestContext
      extended bycom.tonbeller.wcf.controller.TestContext
All Implemented Interfaces:
ExprContext

public class TestContext
extends RequestContext

Created on 28.11.2002

Author:
av

Nested Class Summary
 class TestContext.TestSession
           
 
Constructor Summary
TestContext()
           
 
Method Summary
 java.lang.Object findBean(java.lang.String name)
          searches for bean in request, session, application contexts.
 Converter getConverter()
           
 ExprContext getExprContext()
          Returns the exprContext.
 org.apache.commons.fileupload.FileItem getFileItem(java.lang.String name)
           
 java.util.Map getFileParameters()
           
 Formatter getFormatter()
           
 java.util.Locale getLocale()
          the locale preferred by the user
 java.lang.Object getModelReference(java.lang.String expr)
          evaluates a JSP EL expression.
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map getParameters()
          returns the request parameters
 java.lang.String[] getParameters(java.lang.String name)
           
 java.lang.String getRemoteDomain()
           
 java.lang.String getRemoteUser()
          returns the remote User Name without its domain name.
 javax.servlet.http.HttpServletRequest getRequest()
           
 Resources getResources()
           
 Resources getResources(java.lang.Class clasz)
           
 Resources getResources(java.lang.String bundleName)
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 javax.servlet.ServletContext getServletContext()
           
 javax.servlet.http.HttpSession getSession()
           
 boolean isAdmin()
          allows derived classes to specify a root user who may do everything.
 boolean isUserInRole(java.lang.String roleExpr)
          evaluates a role expression.
 void setBean(java.lang.String name, java.lang.Object bean)
          places bean into session context
 void setExprContext(ExprContext exprContext)
          Sets the exprContext.
 void setLocale(java.util.Locale locale)
          change the Locale for this session including the Locale for JSTL <fmt:message > tag
 void setModelReference(java.lang.String expr, java.lang.Object value)
           
 void setParameters(java.util.Map map)
           
 
Methods inherited from class com.tonbeller.wcf.controller.RequestContext
instance, instance, invalidate, isResponseComplete, setInstance, setResponseComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestContext

public TestContext()
Method Detail

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Specified by:
getRequest in class RequestContext
See Also:
RequestContext.getRequest()

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Specified by:
getResponse in class RequestContext
See Also:
RequestContext.getResponse()

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in class RequestContext
See Also:
RequestContext.getServletContext()

getSession

public javax.servlet.http.HttpSession getSession()
Specified by:
getSession in class RequestContext
See Also:
RequestContext.getSession()

getConverter

public Converter getConverter()
Specified by:
getConverter in class RequestContext
See Also:
RequestContext.getConverter()

getFormatter

public Formatter getFormatter()
Specified by:
getFormatter in class RequestContext
See Also:
RequestContext.getFormatter()

getParameters

public java.util.Map getParameters()
Description copied from class: RequestContext
returns the request parameters

Specified by:
getParameters in class RequestContext
Returns:
same as servlet 2.3 HttpServletRequest.getParameterMap()

setParameters

public void setParameters(java.util.Map map)

getParameters

public java.lang.String[] getParameters(java.lang.String name)
Specified by:
getParameters in class RequestContext

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in class RequestContext

getLocale

public java.util.Locale getLocale()
Description copied from class: RequestContext
the locale preferred by the user

Specified by:
getLocale in class RequestContext

getExprContext

public ExprContext getExprContext()
Returns the exprContext.

Returns:
ExprContext

setExprContext

public void setExprContext(ExprContext exprContext)
Sets the exprContext.

Parameters:
exprContext - The exprContext to set

getModelReference

public java.lang.Object getModelReference(java.lang.String expr)
Description copied from class: RequestContext
evaluates a JSP EL expression. Example #{user.profile}

Specified by:
getModelReference in class RequestContext
See Also:
RequestContext.getModelReference(String)

setModelReference

public void setModelReference(java.lang.String expr,
                              java.lang.Object value)
Specified by:
setModelReference in class RequestContext
See Also:
RequestContext.setModelReference(String, Object)

isUserInRole

public boolean isUserInRole(java.lang.String roleExpr)
Description copied from class: RequestContext
evaluates a role expression.

If roleExpr is a JSP EL expression (e.g. ${bean.stringProperty}), then the result of the EL is used as the role name.

If roleExpr starts with "!" the result is inverted, e.g. all users except members of the role will be allowed to access the component.

Roles may be mapped in resources.properties (or in System.properties or user.properties - see Resources for details). The format is role.[role1]=[role2] (not including the brackets). If such an entry is present, role2 will be checked instead of role1.

If roleExpr == null, returns true (i.e. everybody is member of the null role).

Specified by:
isUserInRole in class RequestContext

getResources

public Resources getResources()
Specified by:
getResources in class RequestContext

getResources

public Resources getResources(java.lang.String bundleName)
Specified by:
getResources in class RequestContext

getResources

public Resources getResources(java.lang.Class clasz)
Specified by:
getResources in class RequestContext

getRemoteUser

public java.lang.String getRemoteUser()
Description copied from class: RequestContext
returns the remote User Name without its domain name. In Oracle AS the HttpServletRequest.getRemoteUser() will return a String like "domain\\user". This function returns the name part only.

Specified by:
getRemoteUser in class RequestContext
Returns:
name without domain

getRemoteDomain

public java.lang.String getRemoteDomain()
Specified by:
getRemoteDomain in class RequestContext

isAdmin

public boolean isAdmin()
Description copied from class: RequestContext
allows derived classes to specify a root user who may do everything. The default implementation returns false always.

Specified by:
isAdmin in class RequestContext
Returns:

findBean

public java.lang.Object findBean(java.lang.String name)
Description copied from interface: ExprContext
searches for bean in request, session, application contexts.


setBean

public void setBean(java.lang.String name,
                    java.lang.Object bean)
Description copied from interface: ExprContext
places bean into session context

Parameters:
name - name of the session attribute
bean - the bean. If null, the attribute will be removed.

setLocale

public void setLocale(java.util.Locale locale)
Description copied from class: RequestContext
change the Locale for this session including the Locale for JSTL <fmt:message > tag

Specified by:
setLocale in class RequestContext

getFileItem

public org.apache.commons.fileupload.FileItem getFileItem(java.lang.String name)

getFileParameters

public java.util.Map getFileParameters()
Specified by:
getFileParameters in class RequestContext