to.etc.domui.server
Class RequestContextImpl

java.lang.Object
  extended by to.etc.domui.server.RequestContextImpl
All Implemented Interfaces:
IAttributeContainer, IExtendedParameterInfo, IParameterInfo, IRequestContext

public class RequestContextImpl
extends java.lang.Object
implements IRequestContext, IAttributeContainer


Method Summary
protected  void discard()
           
protected  void flush()
           
 DomApplication getApplication()
          Return the DomApplication instance.
 java.lang.Object getAttribute(java.lang.String name)
           
 BrowserVersion getBrowserVersion()
           
 java.lang.String getExtension()
          Return the name extension of the input URL without it's "." character.
 UploadItem[] getFileParameter(java.lang.String name)
           
 java.lang.String[] getFileParameters()
          Returns the names of all file parameters.
 java.lang.String getInputPath()
          Return the input path relative to the webapp's root.
 java.io.Writer getOutputWriter()
          Returns the writer to use to generate text-based output to this context.
 java.lang.String getParameter(java.lang.String name)
           
 java.lang.String[] getParameterNames()
           
 java.lang.String[] getParameters(java.lang.String name)
           
 java.lang.String getRelativePath(java.lang.String rel)
          Creates a full path from an application-relative path.
 java.lang.String getRemoteUser()
          If the request has a "remoteUser", usually indicating the web server somehow logged in the user, this returns the user ID.
 javax.servlet.http.HttpServletRequest getRequest()
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 AppSession getSession()
          Get the session for this context.
 java.lang.String getUserAgent()
          Returns the value of the "User-Agent" header to determine the browser type.
 WindowSession getWindowSession()
          Gets this request's conversation.
 boolean hasPermission(java.lang.String permissionName)
          This checks if the currently logged on user has the named permission.
 void internalSetWindowSession(WindowSession cm)
          QUESTIONABLE.
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getApplication

public final DomApplication getApplication()
Description copied from interface: IRequestContext
Return the DomApplication instance.

Specified by:
getApplication in interface IRequestContext
Returns:
See Also:
IRequestContext.getApplication()

getSession

public final AppSession getSession()
Get the session for this context.

Specified by:
getSession in interface IRequestContext
Returns:
See Also:
IRequestContext.getSession()

internalSetWindowSession

public final void internalSetWindowSession(WindowSession cm)
QUESTIONABLE.

Parameters:
cm -

getWindowSession

public final WindowSession getWindowSession()
Gets this request's conversation. If not already known it tries to locate the conversation parameter and locate the manager from there. If that fails it throws an exception.

Specified by:
getWindowSession in interface IRequestContext
Returns:
See Also:
IRequestContext.getWindowSession()

getExtension

public java.lang.String getExtension()
Description copied from interface: IRequestContext
Return the name extension of the input URL without it's "." character. This extension is defined as the part after the last dot in the last "directory name fragment" of the name. For example, for the url "/demo/css/style.css" this call will return "css" (no dot). If the page has no extension this returns the empty string.

Specified by:
getExtension in interface IRequestContext
Returns:
See Also:
IRequestContext.getExtension()

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

getResponse

public javax.servlet.http.HttpServletResponse getResponse()

getInputPath

public final java.lang.String getInputPath()
Description copied from interface: IRequestContext
Return the input path relative to the webapp's root. The webapp context path is not part of this path, and the path never starts with a slash. So for the webapp "demo" with input URL "http://localhost/demo/css/style.css" this will return "css/style.css".

Specified by:
getInputPath in interface IRequestContext
Returns:
See Also:
IRequestContext.getInputPath()

getUserAgent

public java.lang.String getUserAgent()
Description copied from interface: IRequestContext
Returns the value of the "User-Agent" header to determine the browser type.

Specified by:
getUserAgent in interface IRequestContext
Returns:
See Also:
IRequestContext.getUserAgent()

getBrowserVersion

public BrowserVersion getBrowserVersion()
Specified by:
getBrowserVersion in interface IExtendedParameterInfo

flush

protected void flush()
              throws java.lang.Exception
Throws:
java.lang.Exception

discard

protected void discard()
                throws java.io.IOException
Throws:
java.io.IOException

getRelativePath

public java.lang.String getRelativePath(java.lang.String rel)
Description copied from interface: IRequestContext
Creates a full path from an application-relative path. So if the root of the application is "http://localhost/demo/", calling this with "img/button.png" will return the string "http://localhost/demo/img/button.png".

Specified by:
getRelativePath in interface IRequestContext
Returns:
See Also:
IRequestContext.getRelativePath(java.lang.String)

getOutputWriter

public java.io.Writer getOutputWriter()
                               throws java.io.IOException
Description copied from interface: IRequestContext
Returns the writer to use to generate text-based output to this context.

Specified by:
getOutputWriter in interface IRequestContext
Returns:
Throws:
java.io.IOException
See Also:
IRequestContext.getOutputWriter()

hasPermission

public boolean hasPermission(java.lang.String permissionName)
Description copied from interface: IRequestContext
This checks if the currently logged on user has the named permission. This permission is what the J2EE code stupidly calls a "role", which it isn't of course. This should be very fast as it's called very often.

Specified by:
hasPermission in interface IRequestContext
Returns:

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface IParameterInfo
See Also:
IParameterInfo.getParameter(java.lang.String)

getParameters

public java.lang.String[] getParameters(java.lang.String name)
Specified by:
getParameters in interface IParameterInfo
See Also:
IParameterInfo.getParameters(java.lang.String)

getParameterNames

public java.lang.String[] getParameterNames()
Specified by:
getParameterNames in interface IParameterInfo
See Also:
IParameterInfo.getParameterNames()

getFileParameters

public java.lang.String[] getFileParameters()
Returns the names of all file parameters.

Returns:

getFileParameter

public UploadItem[] getFileParameter(java.lang.String name)

getRemoteUser

public java.lang.String getRemoteUser()
Description copied from interface: IRequestContext
If the request has a "remoteUser", usually indicating the web server somehow logged in the user, this returns the user ID. This should not normally be used since there are many ways to login. Use UIContext methods instead.

Specified by:
getRemoteUser in interface IRequestContext
Returns:

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface IAttributeContainer
See Also:
IAttributeContainer.getAttribute(java.lang.String)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface IAttributeContainer