com.ds.fw.servlet
Class FwBaseAdapter

java.lang.Object
  |
  +--com.ds.fw.servlet.FwBaseAdapter
Direct Known Subclasses:
FwAdapter

public class FwBaseAdapter
extends java.lang.Object


Constructor Summary
FwBaseAdapter()
          The constructor method.
FwBaseAdapter(com.ds.fw.servlet.FwRequestContext req, com.ds.fw.servlet.FwResponseContext res)
           
FwBaseAdapter(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          The constructor method.
 
Method Summary
 java.lang.String encodeUrl(java.lang.String url)
          Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
 com.ds.fw.servlet.FwAppContext getAppContext()
           
 java.lang.Object getApplicationObject(java.lang.String name)
           
 com.ds.fw.beans.FwBaseBean getBean()
          Gets a FwBaseBean object from the current session.
 com.ds.fw.beans.FwBaseBean getBean(java.lang.String key)
           
 java.lang.Object getBusinessComponent(java.lang.String name)
           
 java.lang.String getCommand()
          Gets a request command.
 com.ds.fw.co.FwCo getConfigMan()
           
 javax.servlet.http.HttpServletRequest getHttpRequest()
          Gets the current request object.
 javax.servlet.http.HttpServletResponse getHttpResponse()
          Gets the current response object.
 javax.servlet.http.HttpSession getHttpSession()
          Gets the current session object from the request.
 java.util.Locale getLocale()
          Gets user's local information.
 java.lang.String getMimeType(java.lang.String fileName)
          Returns the MIME type of the specified file, or null if the MIME type is not known.
 java.lang.Object getParameter(com.ds.fw.servlet.FwBaseAdapter adapter, java.lang.String key)
          Gets a request parameter.
 java.lang.Object getParameter(java.lang.String key)
          Gets a request parameter.
 float getParameterFloat(java.lang.String key)
          Gets a request parameter.
 long getParameterLong(java.lang.String key)
          Gets a request parameter.
 com.ds.fw.servlet.FwRequestContext getRequestContext()
           
 java.lang.String getResourceString(java.lang.String sKey, java.lang.Object defObject)
           
 com.ds.fw.servlet.FwResponseContext getResponseContext()
           
 com.ds.fw.servlet.base.FwSelectable getSelectable()
           
 java.lang.String getSelector()
          Gets a request command.
 javax.servlet.ServletContext getServletContext()
          Gets a ServletContext object.
 com.ds.fw.servlet.FwSessionContext getSessionContext()
          Gets the current session object from the request object of the given adapter.
 long getSessionID()
           
 java.lang.Object getSessionObject(java.lang.String key)
          Gets a session object.
 java.lang.Object getSessionTimeoutObject(java.lang.String key)
           
 java.lang.String getUrl()
          Gets the URL from the request.
 void invalidateSession()
          Invalidates an session.
 void releaseBusinessComponent(java.lang.String name, java.lang.Object obj)
           
 void setAppContext(com.ds.fw.servlet.FwAppContext sc)
           
 void setBean(com.ds.fw.beans.FwBaseBean bean)
          Sets a session bean object.
 void setBean(com.ds.fw.beans.FwBaseBean bean, java.lang.String key)
           
 void setConfigMan(com.ds.fw.co.FwCo sc)
           
 void setLocale(java.util.Locale loc)
          Sets a session Locale object.
 void setParameter(com.ds.fw.servlet.FwBaseAdapter adapter, java.lang.String key, java.lang.Object obj)
          Sets a request parameter.
 void setParameter(java.lang.String key, java.lang.Object obj)
          Sets a request parameter.
 void setServletContext(javax.servlet.ServletContext sc)
          Sets a ServletContext object.
 void setSessionContext(com.ds.fw.servlet.FwSessionContext s)
           
 void setSessionID(long sID)
           
 void setSessionObject(java.lang.String key, java.lang.Object obj)
          Sets a session object.
 void setSessionTimeoutObject(java.lang.String key, java.lang.Object obj, long timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FwBaseAdapter

public FwBaseAdapter()
The constructor method. Initializes the members with their default values.


FwBaseAdapter

public FwBaseAdapter(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse res)
The constructor method. Initializes the members with their default values.


FwBaseAdapter

public FwBaseAdapter(com.ds.fw.servlet.FwRequestContext req,
                     com.ds.fw.servlet.FwResponseContext res)
Method Detail

setServletContext

public void setServletContext(javax.servlet.ServletContext sc)
Sets a ServletContext object.

Parameters:
sc - the ServletContext object to be set

getServletContext

public javax.servlet.ServletContext getServletContext()
Gets a ServletContext object.


getLocale

public java.util.Locale getLocale()
Gets user's local information. This method first searches for a session Local object, if it is not available, searches the request object for a locale string and if there is no local information returns null.

Returns:
a Locale object handle if locale information found or null otherwise

setLocale

public void setLocale(java.util.Locale loc)
Sets a session Locale object.

Parameters:
loc - the Locale object to be set

getParameter

public java.lang.Object getParameter(java.lang.String key)
Gets a request parameter. This method searches the current request object of the current adapter for a parameter value with the given key.

Parameters:
key - the key of the parameter
Returns:
the parameter value if found or null
See Also:
getParameter(FwBaseAdapter,String)

getParameterLong

public long getParameterLong(java.lang.String key)
Gets a request parameter. This method searches the current request object of the current adapter for a parameter value with the given key.

Parameters:
key - the key of the parameter
Returns:
the parameter value if found or null
See Also:
getParameter(FwBaseAdapter,String)

getParameterFloat

public float getParameterFloat(java.lang.String key)
Gets a request parameter. This method searches the current request object of the current adapter for a parameter value with the given key.

Parameters:
key - the key of the parameter
Returns:
the parameter value if found or null
See Also:
getParameter(FwBaseAdapter,String)

getParameter

public java.lang.Object getParameter(com.ds.fw.servlet.FwBaseAdapter adapter,
                                     java.lang.String key)
Gets a request parameter. This method searches the current request object of the given adapter for a parameter value with the given key.

Parameters:
adapter - it will be asked for the given parameter
key - the key of the parameter
Returns:
the parameter value if found or null

setParameter

public void setParameter(java.lang.String key,
                         java.lang.Object obj)
Sets a request parameter. This method sets a request parameter with value obj and key key.

Parameters:
key - key of the parameter
obj - the object to be set
See Also:
setParameter(FwBaseAdapter, String, Object)

setParameter

public void setParameter(com.ds.fw.servlet.FwBaseAdapter adapter,
                         java.lang.String key,
                         java.lang.Object obj)
Sets a request parameter. This method sets a parameter to the request object of the given adapter.

Parameters:
adapter - the given one to be set a parameter
key - key of the parameter
obj - the object to be set

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
Gets the current session object from the request.

Returns:
current session object

setSessionID

public void setSessionID(long sID)

getSessionID

public long getSessionID()

getSessionContext

public com.ds.fw.servlet.FwSessionContext getSessionContext()
Gets the current session object from the request object of the given adapter.

Returns:
current session object

setSessionContext

public void setSessionContext(com.ds.fw.servlet.FwSessionContext s)

getSessionObject

public java.lang.Object getSessionObject(java.lang.String key)
Gets a session object.

Parameters:
key - key of the session object to be get
Returns:
session object if found or null otherwise

setSessionObject

public void setSessionObject(java.lang.String key,
                             java.lang.Object obj)
Sets a session object. This method sets a session object obj with the given key.

Parameters:
key - key of the session object
obj - the object to be set

getSessionTimeoutObject

public java.lang.Object getSessionTimeoutObject(java.lang.String key)

setSessionTimeoutObject

public void setSessionTimeoutObject(java.lang.String key,
                                    java.lang.Object obj,
                                    long timeout)

getHttpRequest

public javax.servlet.http.HttpServletRequest getHttpRequest()
Gets the current request object.

Returns:
the request object

getRequestContext

public com.ds.fw.servlet.FwRequestContext getRequestContext()

getHttpResponse

public javax.servlet.http.HttpServletResponse getHttpResponse()
Gets the current response object.

Returns:
the response object

getResponseContext

public com.ds.fw.servlet.FwResponseContext getResponseContext()

getBean

public com.ds.fw.beans.FwBaseBean getBean()
Gets a FwBaseBean object from the current session.

Returns:
a bean object if available or null otherwise.
See Also:
getSessionObject(String)

getBean

public com.ds.fw.beans.FwBaseBean getBean(java.lang.String key)

setBean

public void setBean(com.ds.fw.beans.FwBaseBean bean)
Sets a session bean object.

Parameters:
bean - the bean to be set
See Also:
setSessionObject(String,Object)

setBean

public void setBean(com.ds.fw.beans.FwBaseBean bean,
                    java.lang.String key)

getCommand

public java.lang.String getCommand()
Gets a request command.

Returns:
the command value
See Also:
getParameter(String)

getSelector

public java.lang.String getSelector()
Gets a request command.

Returns:
the command value
See Also:
getParameter(String)

getSelectable

public com.ds.fw.servlet.base.FwSelectable getSelectable()
Returns:
selector-command pair in
See Also:
RlSelectable

getUrl

public java.lang.String getUrl()
Gets the URL from the request.

Returns:
the URL string
See Also:
getParameter(String)

getAppContext

public com.ds.fw.servlet.FwAppContext getAppContext()

setAppContext

public void setAppContext(com.ds.fw.servlet.FwAppContext sc)

getConfigMan

public com.ds.fw.co.FwCo getConfigMan()

setConfigMan

public void setConfigMan(com.ds.fw.co.FwCo sc)

getBusinessComponent

public java.lang.Object getBusinessComponent(java.lang.String name)
                                      throws FwNoPermissionException,
                                             FwNotFoundException,
                                             FwNoComponentException
FwNoPermissionException
FwNotFoundException
FwNoComponentException

releaseBusinessComponent

public void releaseBusinessComponent(java.lang.String name,
                                     java.lang.Object obj)
                              throws FwNoPermissionException,
                                     FwNotFoundException,
                                     FwNoComponentException
FwNoPermissionException
FwNotFoundException
FwNoComponentException

getApplicationObject

public java.lang.Object getApplicationObject(java.lang.String name)

getMimeType

public java.lang.String getMimeType(java.lang.String fileName)
Returns the MIME type of the specified file, or null if the MIME type is not known. The MIME type is determined by the configuration of the servlet container, and may be specified in a web application deployment descriptor. Common MIME types are "text/html" and "image/gif".

Parameters:
fileName - a String specifying the name of a file
Returns:
a String specifying the file's MIME type

encodeUrl

public java.lang.String encodeUrl(java.lang.String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.

For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.

Parameters:
url - - the url to be encoded.
Returns:
the encoded URL if encoding is needed; the unchanged URL otherwise.

invalidateSession

public void invalidateSession()
Invalidates an session.


getResourceString

public java.lang.String getResourceString(java.lang.String sKey,
                                          java.lang.Object defObject)