to.etc.domui.server
Interface IRequestContext

All Superinterfaces:
IExtendedParameterInfo, IParameterInfo
All Known Implementing Classes:
RequestContextImpl

public interface IRequestContext
extends IExtendedParameterInfo

Interface representing the context for a request to the server. In a real server request this encapsulates HttpServletRequest and HttpServletResponse, and interfaces with those to get data. The interface should be used as much as possible, since JUnit tests cannot use the real server implementation of it (due to lack of HttpServlet* thingies there).

Author:
Frits Jalvingh Created on Dec 29, 2010

Method Summary
 DomApplication getApplication()
          Return the DomApplication instance.
 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 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)
          This checks if the currently logged on user has the named permission.
 
Methods inherited from interface to.etc.domui.server.IExtendedParameterInfo
getBrowserVersion
 
Methods inherited from interface to.etc.domui.server.IParameterInfo
getParameter, getParameterNames, getParameters
 

Method Detail

getApplication

@Nonnull
DomApplication getApplication()
Return the DomApplication instance.

Returns:

getSession

@Nonnull
AppSession getSession()
Return this-user's AppSession.

Returns:

getWindowSession

@Nonnull
WindowSession getWindowSession()
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.

Returns:

getExtension

@Nonnull
java.lang.String getExtension()
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.

Returns:

getInputPath

@Nonnull
java.lang.String getInputPath()
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".

Returns:

getUserAgent

@Nullable
java.lang.String getUserAgent()
Returns the value of the "User-Agent" header to determine the browser type.

Returns:

getRemoteUser

@Nullable
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. This should not normally be used since there are many ways to login. Use UIContext methods instead.

Returns:

getRelativePath

@Nonnull
java.lang.String getRelativePath(@Nonnull
                                         java.lang.String rel)
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".

Parameters:
rel -
Returns:

getOutputWriter

@Nonnull
java.io.Writer getOutputWriter()
                               throws java.io.IOException
Returns the writer to use to generate text-based output to this context.

Returns:
Throws:
java.io.IOException

hasPermission

boolean hasPermission(@Nonnull
                      java.lang.String permissionName)
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.

Parameters:
permissionName -
Returns: