uk.ltd.getahead.dwr
Class ExecutionContext

java.lang.Object
  extended by uk.ltd.getahead.dwr.ExecutionContext
All Implemented Interfaces:
ServerContext, WebContext

Deprecated. Use WebContext / WebContextFactory for better results

@Deprecated
public class ExecutionContext
extends java.lang.Object
implements WebContext

Class to enable us to access servlet parameters.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Field Summary
 
Fields inherited from interface org.directwebremoting.WebContext
ATTRIBUTE_DWR
 
Method Summary
 java.lang.String forwardToString(java.lang.String url)
          Deprecated. Forward a request to a given URL and catch the data written to it.
static ExecutionContext get()
          Deprecated. Use WebContextFactory.get() for better results
 java.util.Collection<ScriptSession> getAllScriptSessions()
          Deprecated. Get a list of all the ScriptSessions known to this server at the given time.
 Container getContainer()
          Deprecated. Accessor for the IoC container.
 java.lang.String getContextPath()
          Deprecated. Returns the portion of the request URI that indicates the context of the request.
 java.lang.String getCurrentPage()
          Deprecated. What is the URL of the current page.
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Deprecated. Accessor for the http request information.
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Deprecated. Accessor for the http response bean.
 ScriptSession getScriptSession()
          Deprecated. Get the script session that represents the currently viewed page in the same way that an HttpSession represents a cookie.
 ScriptSession getScriptSessionById(java.lang.String sessionId)
          Deprecated. You can request access to a specific ScriptSession if you know it's ID.
 java.util.Collection<ScriptSession> getScriptSessionsByPage(java.lang.String page)
          Deprecated. Get a list of all ScriptSessions on a given page.
 javax.servlet.ServletConfig getServletConfig()
          Deprecated. Accessor for the servlet config.
 javax.servlet.ServletContext getServletContext()
          Deprecated. Returns the ServletContext to which this session belongs.
 javax.servlet.http.HttpSession getSession()
          Deprecated. Returns the current session associated with this request, or if the request does not have a session, creates one.
 javax.servlet.http.HttpSession getSession(boolean create)
          Deprecated. Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
 java.lang.String getVersion()
          Deprecated. Fish the version number out of the dwr.properties file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSession

public javax.servlet.http.HttpSession getSession()
Deprecated. 
Description copied from interface: WebContext
Returns the current session associated with this request, or if the request does not have a session, creates one.

Specified by:
getSession in interface WebContext
Returns:
Returns the http session.
See Also:
HttpServletRequest.getSession()

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
Deprecated. 
Description copied from interface: WebContext
Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session. If create is false and the request has no valid HttpSession, this method returns null.

Specified by:
getSession in interface WebContext
Parameters:
create - false to return null if there's no current session
Returns:
the session associated with this request
See Also:
HttpServletRequest.getSession(boolean)

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Deprecated. 
Description copied from interface: ServerContext
Accessor for the servlet config.

Specified by:
getServletConfig in interface ServerContext
Returns:
Returns the config.

getServletContext

public javax.servlet.ServletContext getServletContext()
Deprecated. 
Description copied from interface: ServerContext
Returns the ServletContext to which this session belongs.

Specified by:
getServletContext in interface ServerContext
Returns:
The servlet context information.

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Deprecated. 
Description copied from interface: WebContext
Accessor for the http request information.

Specified by:
getHttpServletRequest in interface WebContext
Returns:
Returns the request.

getHttpServletResponse

public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Deprecated. 
Description copied from interface: WebContext
Accessor for the http response bean.

You can't use this request to directly reply to the response or to add headers or cookies.

Specified by:
getHttpServletResponse in interface WebContext
Returns:
Returns the response.

forwardToString

public java.lang.String forwardToString(java.lang.String url)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
Deprecated. 
Description copied from interface: WebContext
Forward a request to a given URL and catch the data written to it. It is possible to distinguish requests that arrive normally and requests that come from a DWR forwardToString() by the presence of a request attribute. Before the request is forwarded, DWR will call:
 request.setAttribute(WebContext.ATTRIBUTE_DWR, Boolean.TRUE);
 

Specified by:
forwardToString in interface WebContext
Parameters:
url - The URL to forward to
Returns:
The text that results from forwarding to the given URL
Throws:
javax.servlet.ServletException - if the target resource throws this exception
java.io.IOException - if the target resource throws this exception

getVersion

public java.lang.String getVersion()
Deprecated. 
Description copied from interface: ServerContext
Fish the version number out of the dwr.properties file.

Specified by:
getVersion in interface ServerContext
Returns:
The current version number.

getScriptSession

public ScriptSession getScriptSession()
Deprecated. 
Description copied from interface: WebContext
Get the script session that represents the currently viewed page in the same way that an HttpSession represents a cookie.

Specified by:
getScriptSession in interface WebContext
Returns:
A browser object for this user

getAllScriptSessions

public java.util.Collection<ScriptSession> getAllScriptSessions()
Deprecated. 
Description copied from interface: ServerContext
Get a list of all the ScriptSessions known to this server at the given time. Note that the list of known sessions is continually changing so it is possible that the list will be out of date by the time it is used. For this reason you should check that getScriptSession(String id) returns something non null.

Specified by:
getAllScriptSessions in interface ServerContext
Returns:
A collection of all the ScriptSessions.

getScriptSessionsByPage

public java.util.Collection<ScriptSession> getScriptSessionsByPage(java.lang.String page)
Deprecated. 
Description copied from interface: ServerContext
Get a list of all ScriptSessions on a given page. Note that the list of known sessions is continually changing so it is possible that the list will be out of date by the time it is used. For this reason you should check that getScriptSession(String id) returns something non null.

Specified by:
getScriptSessionsByPage in interface ServerContext
Parameters:
page - The URL including 'http://', up to (but not including) '?' or '#'
Returns:
A collection of all the ScriptSessions.

getScriptSessionById

public ScriptSession getScriptSessionById(java.lang.String sessionId)
Deprecated. 
Description copied from interface: ServerContext
You can request access to a specific ScriptSession if you know it's ID.

Take care with this method because it allows actions from one browser to affect another which could be a bad thing. It is certainly a VERY BAD idea to let session id's from one browser escape into another.

Consider that it is entirely possible that the ScriptSession may timeout while you are holding a reference to it.

Specified by:
getScriptSessionById in interface ServerContext
Parameters:
sessionId - The script session ID to lookup
Returns:
The ScriptSession for the given ID, or null if it does not exist

getContainer

public Container getContainer()
Deprecated. 
Description copied from interface: ServerContext
Accessor for the IoC container.

Specified by:
getContainer in interface ServerContext
Returns:
The IoC container that created the interface implementations.

getCurrentPage

public java.lang.String getCurrentPage()
Deprecated. 
Description copied from interface: WebContext
What is the URL of the current page. This includes 'http://', up to (but not including) '?' or '#'

Specified by:
getCurrentPage in interface WebContext
Returns:
The URL of the current page

getContextPath

public java.lang.String getContextPath()
Deprecated. 
Description copied from interface: ServerContext
Returns the portion of the request URI that indicates the context of the request.

Annoyingly you can't get to this from the ServletContext so you need to cache the value from a recent HttpServletRequest.

The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.

WARNING: This method may return null if DWR has not received any requests. If this method is called from outside of DWR, as the servlet environment is starting up you should check for a null reply and try again later.

Specified by:
getContextPath in interface ServerContext
Returns:
The portion of the request URI that indicates the context or null if DWR has not received and requests so far

get

@Deprecated
public static ExecutionContext get()
Deprecated. Use WebContextFactory.get() for better results

Accessor for the current ExecutionContext.

Returns:
The current ExecutionContext or null if the current thread was not started by DWR.

Copyright ¬ 2005