net.wotonomy.web
Class WOContext

java.lang.Object
  extended by net.wotonomy.web.WOContext

public class WOContext
extends java.lang.Object

A pure java implementation of WOContext.

Version:
$Revision: 905 $
Author:
michael@mpowers.net, $Author: cgruber $

Constructor Summary
WOContext()
          Default constructor performs necessary initialization.
WOContext(WORequest aRequest)
          Preferred constructor performs necessary initialization.
 
Method Summary
 void appendElementIDComponent(java.lang.String aString)
          Appends the specified string to the end of the element id.
 void appendZeroElementIDComponent()
          Appends a zero to the element id to represent the first new child component.
 WOApplication application()
          Returns this context's application, or null if it doesn't exist.
 java.lang.String completeURLWithRequestHandlerKey(java.lang.String aRequestHandlerKey, java.lang.String aPath, java.lang.String aQueryString, boolean isSecure, int port)
          Returns the complete URL for the specified request handler, path, and query string.
 WOComponent component()
          Returns the current component.
 java.lang.String componentActionURL()
          Returns the complete URL for the current component action.
 java.lang.String contextID()
          Returns the context id.
static WOContext contextWithRequest(WORequest aRequest)
          Simply calls the preferred constructor.
 void deleteAllElementIDComponents()
          Deletes all components of the element id.
 void deleteLastElementIDComponent()
          Deletes the last component of the element id.
 java.lang.String directActionURLForActionNamed(java.lang.String anActionName, java.util.Map aQueryDict)
          Returns a URL for the named action with query parameters as specified by the dictionary.
 java.lang.String elementID()
          Returns the element id, or null if it doesn't exist.
 boolean hasSession()
          Returns whether a session has been created for the associated request.
 void incrementLastElementIDComponent()
          Increments the last component of the element id.
 boolean isDistributionEnabled()
          Returns whether distribution is enabled.
 boolean isInForm()
          Returns whether the current context is in a form.
 WOComponent page()
          Returns the current page.
 WORequest request()
          Returns this context's request.
 WOResponse response()
          Returns this context's response.
 java.lang.String senderID()
          Returns the sender id, or null if it doesn't exist.
 WOSession session()
          Returns this context's session, creating one if it doesn't exist.
 void setDistributionEnabled(boolean distributionEnabled)
          Sets whether distribution is enabled.
 void setInForm(boolean inForm)
          Sets whether the current context is in a WOForm.
 java.lang.String toString()
           
 java.lang.String urlWithRequestHandlerKey(java.lang.String aRequestHandlerKey, java.lang.String aPath, java.lang.String aQueryString)
          Returns a URL relative to the servlet for the specified request handler, action, and query string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WOContext

public WOContext()
Default constructor performs necessary initialization. Subclassers should override the static factory method below.


WOContext

public WOContext(WORequest aRequest)
Preferred constructor performs necessary initialization. Subclassers should override this method.

Method Detail

contextWithRequest

public static WOContext contextWithRequest(WORequest aRequest)
Simply calls the preferred constructor. Included for compatibility.


contextID

public java.lang.String contextID()
Returns the context id.


senderID

public java.lang.String senderID()
Returns the sender id, or null if it doesn't exist.


elementID

public java.lang.String elementID()
Returns the element id, or null if it doesn't exist.


application

public WOApplication application()
Returns this context's application, or null if it doesn't exist.


hasSession

public boolean hasSession()
Returns whether a session has been created for the associated request.


session

public WOSession session()
Returns this context's session, creating one if it doesn't exist.


request

public WORequest request()
Returns this context's request.


response

public WOResponse response()
Returns this context's response.


page

public WOComponent page()
Returns the current page.


component

public WOComponent component()
Returns the current component.


isInForm

public boolean isInForm()
Returns whether the current context is in a form.


setInForm

public void setInForm(boolean inForm)
Sets whether the current context is in a WOForm.


appendElementIDComponent

public void appendElementIDComponent(java.lang.String aString)
Appends the specified string to the end of the element id. For example, if the element id is "0.1", sending "Test" changes the element id to "0.1.Test".


appendZeroElementIDComponent

public void appendZeroElementIDComponent()
Appends a zero to the element id to represent the first new child component. For example, if the element id is "0.1", calling this changes the element id to "0.1.0".


incrementLastElementIDComponent

public void incrementLastElementIDComponent()
Increments the last component of the element id. For example, if the element id is "0.1", calling this changes the element id to "0.2".


deleteLastElementIDComponent

public void deleteLastElementIDComponent()
Deletes the last component of the element id. For example, if the element id is "0.1", callling this changes the element id to "0".


deleteAllElementIDComponents

public void deleteAllElementIDComponents()
Deletes all components of the element id. This makes the element id an empty string.


directActionURLForActionNamed

public java.lang.String directActionURLForActionNamed(java.lang.String anActionName,
                                                      java.util.Map aQueryDict)
Returns a URL for the named action with query parameters as specified by the dictionary.


componentActionURL

public java.lang.String componentActionURL()
Returns the complete URL for the current component action.


urlWithRequestHandlerKey

public java.lang.String urlWithRequestHandlerKey(java.lang.String aRequestHandlerKey,
                                                 java.lang.String aPath,
                                                 java.lang.String aQueryString)
Returns a URL relative to the servlet for the specified request handler, action, and query string.


completeURLWithRequestHandlerKey

public java.lang.String completeURLWithRequestHandlerKey(java.lang.String aRequestHandlerKey,
                                                         java.lang.String aPath,
                                                         java.lang.String aQueryString,
                                                         boolean isSecure,
                                                         int port)
Returns the complete URL for the specified request handler, path, and query string. isSecure determines the protocol: http or https. port is appended to the protocol, if zero, the port is omitted from the URL.


setDistributionEnabled

public void setDistributionEnabled(boolean distributionEnabled)
Sets whether distribution is enabled.


isDistributionEnabled

public boolean isDistributionEnabled()
Returns whether distribution is enabled.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2006 null. All Rights Reserved.