to.etc.domui.testsupport
Class TestRequestContext

java.lang.Object
  extended by to.etc.domui.testsupport.TestRequestContext
All Implemented Interfaces:
IExtendedParameterInfo, IParameterInfo, IRequestContext

public class TestRequestContext
extends java.lang.Object
implements IRequestContext

A dummy test request context used for testing.

Author:
Frits Jalvingh Created on Jun 9, 2008

Constructor Summary
TestRequestContext()
           
 
Method Summary
 DomApplication getApplication()
          Return the DomApplication instance.
 BrowserVersion getBrowserVersion()
           
 java.lang.String getExtension()
          Return the name extension of the input URL without it's "." character.
 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.
 AppSession getSession()
          Return this-user's AppSession.
 java.lang.String getUserAgent()
          Returns the value of the "User-Agent" header to determine the browser type.
 WindowSession getWindowSession()
          Return the WindowSession for this request.
 boolean hasPermission(java.lang.String permissionName)
          FIXME Does this need more?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestRequestContext

public TestRequestContext()
Method Detail

getApplication

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

Specified by:
getApplication in interface IRequestContext
Returns:

getWindowSession

public WindowSession getWindowSession()
Description copied from interface: IRequestContext
Return the WindowSession for this request. The WindowSession represents one of the possible multiple open browser windows. Since each browser window shares a single HttpSession (sigh) the WindowSession is used to separate the administration for separate browser windows.

Specified by:
getWindowSession in interface IRequestContext
Returns:

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:

getInputPath

public 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:

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

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:

getSession

public AppSession getSession()
Description copied from interface: IRequestContext
Return this-user's AppSession.

Specified by:
getSession in interface IRequestContext
Returns:

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:

getParameter

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

getParameterNames

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

getParameters

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

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:

getBrowserVersion

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

hasPermission

public boolean hasPermission(java.lang.String permissionName)
FIXME Does this need more?

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