com.ibm.commerce.adapter
Class AbstractHttpAdapter

java.lang.Object
  |
  +--com.ibm.commerce.adapter.AbstractHttpAdapter
All Implemented Interfaces:
DeviceFormatAdapter, HttpAdapter, HttpAdapterFactory
Direct Known Subclasses:
HttpBrowserAdapter, HttpProgramAdapterImpl, PVCAdapterImpl

public abstract class AbstractHttpAdapter
extends java.lang.Object
implements HttpAdapter, HttpAdapterFactory

This class provides an abstract base implementation of an Http device format adapter. It implements both the HttpAdapter interface and the HttpAdapterFactory interface.


Field Summary
protected  HttpAdapterDesc desc
           
protected  com.ibm.commerce.adapter.HttpServletRequest req
           
protected  com.ibm.commerce.adapter.HttpControllerRequestObject reqObj
           
protected  TypedProperty requestProperties
           
protected  com.ibm.commerce.adapter.HttpServletResponse resp
           
protected  SessionContext sessionContext
           
 
Fields inherited from interface com.ibm.commerce.adapter.HttpAdapter
COPYRIGHT, DEVFMTID_BROWSER, DEVFMTNAME_BROWSER, DEVFMTNAME_IMODE, DEVFMTTYP_BROWSER, DEVFMTTYP_PVCDEVICE, DEVFMTTYP_XMLFMT, DEVFMTTYPID_BROWSER, DEVFMTTYPID_PVC, DEVFMTTYPID_XML
 
Fields inherited from interface com.ibm.commerce.adapter.HttpAdapterFactory
COPYRIGHT
 
Constructor Summary
AbstractHttpAdapter()
          AbstractHttpAdapter constructor.
 
Method Summary
 void displayGenericErrorView(com.ibm.commerce.adapter.ServletContext servletContext, java.lang.String docName)
          This method displays a GenericSystemError.jsp.
 HttpAdapterDesc getAdapterDesc()
          Return the descripter that describes this Http adapter.
 java.lang.Integer getDefaultDeviceFormatId()
          Returns the default device format identifier for this adapter
 java.lang.Integer getDeviceFormatId()
          Gets the device format Id for this adapter.
 java.lang.String getDeviceFormatName()
          Gets the device format name for this adapter.
 java.lang.String getDeviceFormatType()
          Gets the device format type name for this adapter.
 java.lang.Integer getDeviceFormatTypeId()
          Gets the device format type Id for this adapter.
 java.lang.String getDocumentPathName(java.lang.String name)
          gets the actual output document name based on a base document name.
 com.ibm.commerce.adapter.HttpServletRequest getRequest()
          Gets the HttpServetRequest object.
 java.lang.String getRequestName()
          Gets the request name .
 TypedProperty getRequestProperties()
          Gets the request properties assoiciated with this request.
 com.ibm.commerce.adapter.HttpServletResponse getResponse()
          Gets the HttpServetResponse object.
 boolean httpRedirection()
          Returns true if Https redirection is required.
 void initFactory(com.ibm.commerce.adapter.Element node)
          initialize the AdapterFactory based on the informtion defined in the node
 boolean isEnabled()
          Returns true if this adapter is enabled.
 com.ibm.commerce.adapter.HttpControllerRequestObject preprocessRequest()
          This method preprocess a HttpServletRequest and return a HttpControllerRequestObject.
 boolean processErrorResponse(CommandContext commandContext, java.lang.Exception e)
          This method is called by the web controller when the execution of a request has failed.
 void processRequest(com.ibm.commerce.adapter.ServletContext servletContext, java.lang.String encoding, boolean storeCommand)
          This method is responsible for invoking the web controller to process the incoming request.
 boolean processResponse(CommandContext commandContext, TypedProperty respProperty)
          This method is called by the web controller after it has successfully finished the execution of the request.
 void setAdapterDesc(HttpAdapterDesc value)
          Sets the http device format adapter descriptor.
 void setDefaultDeviceFormatId(java.lang.Integer value)
          Sets the device format Id.
 void setDeviceFormatClass(java.lang.Class value)
          Sets the device format clas for this adapter.
 void setDeviceFormatId(java.lang.Integer value)
          Sets the device format Id for this adapter.
 void setDeviceFormatName(java.lang.String value)
          Sets the device format name for this adapter.
 void setDeviceFormatType(java.lang.String value)
          Sets the device format type name for this adapter.
 void setDeviceFormatTypeId(java.lang.Integer value)
          Sets the device format type Id for this adapter.
 void setRequest(com.ibm.commerce.adapter.HttpServletRequest value)
          Sets the HttpServletRequest object.
 void setRequestProperties(TypedProperty val)
          Sets the request properties assoiciated with this request.
 void setResponse(com.ibm.commerce.adapter.HttpServletResponse value)
          Sets the HttpServletResponse object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.adapter.HttpAdapter
httpsRedirection
 
Methods inherited from interface com.ibm.commerce.adapter.DeviceFormatAdapter
getSessionContext, postInvokeCommand, preInvokeCommand
 
Methods inherited from interface com.ibm.commerce.adapter.HttpAdapterFactory
checkDeviceFormat, createAdapter
 

Field Detail

desc

protected HttpAdapterDesc desc

req

protected com.ibm.commerce.adapter.HttpServletRequest req

reqObj

protected com.ibm.commerce.adapter.HttpControllerRequestObject reqObj

requestProperties

protected TypedProperty requestProperties

resp

protected com.ibm.commerce.adapter.HttpServletResponse resp

sessionContext

protected SessionContext sessionContext
Constructor Detail

AbstractHttpAdapter

public AbstractHttpAdapter()
AbstractHttpAdapter constructor.
Method Detail

displayGenericErrorView

public void displayGenericErrorView(com.ibm.commerce.adapter.ServletContext servletContext,
                                    java.lang.String docName)
This method displays a GenericSystemError.jsp. This method is called when we detects a serious error on start up and cannot proceed. This method should never be invoked.

Parameters:
servletContext - ServletContext
docname - String - the error page name (GenericSystemError.jsp)

getAdapterDesc

public HttpAdapterDesc getAdapterDesc()
Return the descripter that describes this Http adapter.

Specified by:
getAdapterDesc in interface HttpAdapter
Returns:
HttpAdapterDesc - the descriptor object for this adapter

getDefaultDeviceFormatId

public java.lang.Integer getDefaultDeviceFormatId()
Returns the default device format identifier for this adapter

Specified by:
getDefaultDeviceFormatId in interface DeviceFormatAdapter
Returns:
Integer

getDeviceFormatId

public final java.lang.Integer getDeviceFormatId()
Gets the device format Id for this adapter.

Specified by:
getDeviceFormatId in interface DeviceFormatAdapter
Returns:
Integer - the device format id

getDeviceFormatName

public final java.lang.String getDeviceFormatName()
Gets the device format name for this adapter.

Specified by:
getDeviceFormatName in interface DeviceFormatAdapter
Returns:
String - the device format name

getDeviceFormatType

public final java.lang.String getDeviceFormatType()
Gets the device format type name for this adapter.

Specified by:
getDeviceFormatType in interface DeviceFormatAdapter
Returns:
String - the device format type name

getDeviceFormatTypeId

public java.lang.Integer getDeviceFormatTypeId()
Gets the device format type Id for this adapter.

Specified by:
getDeviceFormatTypeId in interface DeviceFormatAdapter
Returns:
Integer - the device format type id

getDocumentPathName

public java.lang.String getDocumentPathName(java.lang.String name)
gets the actual output document name based on a base document name.

Specified by:
getDocumentPathName in interface DeviceFormatAdapter
Returns:
String - the actual document path name

getRequest

public final com.ibm.commerce.adapter.HttpServletRequest getRequest()
Gets the HttpServetRequest object.

Specified by:
getRequest in interface HttpAdapter
Returns:
HttpServletRequest

getRequestName

public final java.lang.String getRequestName()
Gets the request name .

Specified by:
getRequestName in interface HttpAdapter
Returns:
String - name of request

getRequestProperties

public TypedProperty getRequestProperties()
Gets the request properties assoiciated with this request.

Specified by:
getRequestProperties in interface HttpAdapter
Returns:
TypedProperty - request properties

getResponse

public final com.ibm.commerce.adapter.HttpServletResponse getResponse()
Gets the HttpServetResponse object.

Specified by:
getResponse in interface HttpAdapter
Returns:
HttpServletResponse

httpRedirection

public boolean httpRedirection()
Returns true if Https redirection is required. That is, if a requests comes in as Http but the command requires https, the request will be redirected to https. Default implementation return true.

Returns:
boolean - true

initFactory

public void initFactory(com.ibm.commerce.adapter.Element node)
                 throws java.lang.Exception
initialize the AdapterFactory based on the informtion defined in the node
Specified by:
initFactory in interface HttpAdapterFactory

isEnabled

public final boolean isEnabled()
Returns true if this adapter is enabled.
Specified by:
isEnabled in interface HttpAdapterFactory
Following copied from interface: com.ibm.commerce.adapter.HttpAdapterFactory
Returns:
boolean

preprocessRequest

public com.ibm.commerce.adapter.HttpControllerRequestObject preprocessRequest()
This method preprocess a HttpServletRequest and return a HttpControllerRequestObject.
Specified by:
preprocessRequest in interface HttpAdapter

processErrorResponse

public boolean processErrorResponse(CommandContext commandContext,
                                    java.lang.Exception e)
                             throws ECException
This method is called by the web controller when the execution of a request has failed. The web controller will execute the error view task associated with the exeception if this method returns true.
Specified by:
processErrorResponse in interface DeviceFormatAdapter
Parameters:
commandContext - CommandContext - commandContext for the request
exception - Exception - exception caught when executing the request.
Returns:
boolean - true if the error view task is to be executed by the web controller - false if there is no need to execute the error view task

processRequest

public final void processRequest(com.ibm.commerce.adapter.ServletContext servletContext,
                                 java.lang.String encoding,
                                 boolean storeCommand)
                          throws ECException
This method is responsible for invoking the web controller to process the incoming request. It will invoke processErrorView() if it detected an error in the preprocessing of the request. It will invoke processView() to handle a view such as relogin It will invoke processRequest() to handle a requler request which can be a controller command, a view command, or just a jsp page.

Specified by:
processRequest in interface HttpAdapter
Parameters:
servletContext - ServletContext - the servlet context associated with this request
encoding - String - the encoding used for the incoming parameters
storeCommand - boolean - true if this is a store command

processResponse

public boolean processResponse(CommandContext commandContext,
                               TypedProperty respProperty)
                        throws ECException
This method is called by the web controller after it has successfully finished the execution of the request. The web controller will execute the view task associated with the command if this method returns true. *
Specified by:
processResponse in interface DeviceFormatAdapter
Parameters:
respProperties - TypedProperty - response properties returned by the command.
Returns:
boolean - true if the view task is to be executed by the web controller - false if there is no need to execute the view task

setAdapterDesc

public final void setAdapterDesc(HttpAdapterDesc value)
Sets the http device format adapter descriptor.
Specified by:
setAdapterDesc in interface HttpAdapter
Parameters:
value - HttpAdapterDesc - Http adapter descriptor

setDefaultDeviceFormatId

public void setDefaultDeviceFormatId(java.lang.Integer value)
Sets the device format Id.
Specified by:
setDefaultDeviceFormatId in interface DeviceFormatAdapter
Parameters:
value - java.lang.Integer

setDeviceFormatClass

public final void setDeviceFormatClass(java.lang.Class value)
Sets the device format clas for this adapter.

Parameters:
value - Class - the class object associated with this adapter

setDeviceFormatId

public final void setDeviceFormatId(java.lang.Integer value)
Sets the device format Id for this adapter.

Specified by:
setDeviceFormatId in interface DeviceFormatAdapter
Parameters:
value - Integer - the device format id

setDeviceFormatName

public final void setDeviceFormatName(java.lang.String value)
Sets the device format name for this adapter.

Specified by:
setDeviceFormatName in interface DeviceFormatAdapter
Parameters:
value - String - the device format name

setDeviceFormatType

public final void setDeviceFormatType(java.lang.String value)
Sets the device format type name for this adapter.

Specified by:
setDeviceFormatType in interface DeviceFormatAdapter
Parameters:
value - String - the device format type name

setDeviceFormatTypeId

public final void setDeviceFormatTypeId(java.lang.Integer value)
Sets the device format type Id for this adapter.

Specified by:
setDeviceFormatTypeId in interface DeviceFormatAdapter
Parameters:
value - Integer - the device format type id

setRequest

public final void setRequest(com.ibm.commerce.adapter.HttpServletRequest value)
Sets the HttpServletRequest object.

Specified by:
setRequest in interface HttpAdapter
Parameters:
request - HttpServletRequest

setRequestProperties

public final void setRequestProperties(TypedProperty val)
Sets the request properties assoiciated with this request.

Specified by:
setRequestProperties in interface HttpAdapter
Parameters:
requestProperties - TypedProperty

setResponse

public final void setResponse(com.ibm.commerce.adapter.HttpServletResponse value)
Sets the HttpServletResponse object.

Specified by:
setResponse in interface HttpAdapter
Parameters:
response - HttpServletResponse