com.tonbeller.wcf.controller
Class RequestContext

java.lang.Object
  extended bycom.tonbeller.wcf.controller.RequestContext
All Implemented Interfaces:
ExprContext
Direct Known Subclasses:
RequestContextImpl, TestContext

public abstract class RequestContext
extends java.lang.Object
implements ExprContext

Created on 05.11.2002

Author:
av

Constructor Summary
protected RequestContext()
           
 
Method Summary
abstract  Converter getConverter()
           
abstract  java.util.Map getFileParameters()
           
abstract  Formatter getFormatter()
           
abstract  java.util.Locale getLocale()
          the locale preferred by the user
abstract  java.lang.Object getModelReference(java.lang.String expr)
          evaluates a JSP EL expression.
abstract  java.lang.String getParameter(java.lang.String name)
           
abstract  java.util.Map getParameters()
          returns the request parameters
abstract  java.lang.String[] getParameters(java.lang.String name)
           
abstract  java.lang.String getRemoteDomain()
           
abstract  java.lang.String getRemoteUser()
          returns the remote User Name without its domain name.
abstract  javax.servlet.http.HttpServletRequest getRequest()
           
abstract  Resources getResources()
           
abstract  Resources getResources(java.lang.Class clasz)
           
abstract  Resources getResources(java.lang.String bundleName)
           
abstract  javax.servlet.http.HttpServletResponse getResponse()
           
abstract  javax.servlet.ServletContext getServletContext()
           
abstract  javax.servlet.http.HttpSession getSession()
           
static RequestContext instance()
          returns the RequestContext associated with the current thread / request
static RequestContext instance(boolean failIfEmpty)
          returns the RequestContext associated with the current thread / request
 void invalidate()
          invalidate context after request processing is complete.
abstract  boolean isAdmin()
          allows derived classes to specify a root user who may do everything.
 boolean isResponseComplete()
           
abstract  boolean isUserInRole(java.lang.String roleExpr)
          evaluates a role expression.
static void setInstance(RequestContext context)
          pushes a thread local instance.
abstract  void setLocale(java.util.Locale locale)
          change the Locale for this session including the Locale for JSTL <fmt:message > tag
abstract  void setModelReference(java.lang.String expr, java.lang.Object value)
           
 void setResponseComplete(boolean complete)
          if a RequestListener has called setError() or sentRedirect() on the response it must inform the controller not to forward to the JSP
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tonbeller.wcf.expr.ExprContext
findBean, setBean
 

Constructor Detail

RequestContext

protected RequestContext()
Method Detail

getRequest

public abstract javax.servlet.http.HttpServletRequest getRequest()

getResponse

public abstract javax.servlet.http.HttpServletResponse getResponse()

getServletContext

public abstract javax.servlet.ServletContext getServletContext()

getSession

public abstract javax.servlet.http.HttpSession getSession()

getConverter

public abstract Converter getConverter()

getFormatter

public abstract Formatter getFormatter()

getFileParameters

public abstract java.util.Map getFileParameters()

instance

public static RequestContext instance()
                               throws EmptyThreadLocalStackException
returns the RequestContext associated with the current thread / request

Throws:
EmptyThreadLocalStackException - if there is no instance set via #setInstance()
See Also:
RequestContextFactoryFinder.createContext(HttpServletRequest, HttpServletResponse, boolean)

instance

public static RequestContext instance(boolean failIfEmpty)
                               throws EmptyThreadLocalStackException
returns the RequestContext associated with the current thread / request

Throws:
EmptyThreadLocalStackException
See Also:
RequestContextFactoryFinder.createContext(HttpServletRequest, HttpServletResponse, boolean)

setInstance

public static void setInstance(RequestContext context)
pushes a thread local instance. The context will be returned by instance(). This method is public for test purpose only.


invalidate

public void invalidate()
invalidate context after request processing is complete. This must be called exactly as many times RequestContextFactoryFinder.createContext is called.

See Also:
RequestContextFactoryFinder.createContext(HttpServletRequest, HttpServletResponse, boolean)

getParameters

public abstract java.util.Map getParameters()
returns the request parameters

Returns:
same as servlet 2.3 HttpServletRequest.getParameterMap()

getParameters

public abstract java.lang.String[] getParameters(java.lang.String name)

getParameter

public abstract java.lang.String getParameter(java.lang.String name)

getLocale

public abstract java.util.Locale getLocale()
the locale preferred by the user


setLocale

public abstract void setLocale(java.util.Locale locale)
change the Locale for this session including the Locale for JSTL <fmt:message > tag


getResources

public abstract Resources getResources()

getResources

public abstract Resources getResources(java.lang.String bundleName)

getResources

public abstract Resources getResources(java.lang.Class clasz)

getModelReference

public abstract java.lang.Object getModelReference(java.lang.String expr)
evaluates a JSP EL expression. Example #{user.profile}


setModelReference

public abstract void setModelReference(java.lang.String expr,
                                       java.lang.Object value)

isUserInRole

public abstract boolean isUserInRole(java.lang.String roleExpr)
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).


getRemoteUser

public abstract java.lang.String getRemoteUser()
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.

Returns:
name without domain

getRemoteDomain

public abstract java.lang.String getRemoteDomain()

isAdmin

public abstract boolean isAdmin()
allows derived classes to specify a root user who may do everything. The default implementation returns false always.

Returns:

setResponseComplete

public void setResponseComplete(boolean complete)
if a RequestListener has called setError() or sentRedirect() on the response it must inform the controller not to forward to the JSP


isResponseComplete

public boolean isResponseComplete()