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

Reserved for IBM internal use. 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
static java.lang.String COPYRIGHT
          IBM Copyright notice field.
protected  HttpAdapterDesc desc
           
protected  java.lang.String encoding
           
protected  HttpServletRequest req
           
protected  HttpControllerRequestObject reqObj
           
protected  TypedProperty requestProperties
           
protected  HttpServletResponse resp
           
protected  SessionContext sessionContext
           
 
Fields inherited from interface com.ibm.commerce.adapter. HttpAdapter
DEVFMTID_BROWSER, DEVFMTNAME_BROWSER, DEVFMTNAME_IMODE, DEVFMTTYP_BROWSER, DEVFMTTYP_PVCDEVICE, DEVFMTTYP_XMLFMT, DEVFMTTYPID_BROWSER, DEVFMTTYPID_PVC, DEVFMTTYPID_XML
 
Constructor Summary
AbstractHttpAdapter()
          Reserved for IBM internal use.
 
Method Summary
 void displayGenericErrorView(ServletContext servletContext, java.lang.String docName)
          Reserved for IBM internal use.
  HttpAdapterDesc getAdapterDesc()
          Reserved for IBM internal use.
 java.lang.Integer getDefaultDeviceFormatId()
          Reserved for IBM internal use.
 java.lang.Integer getDeviceFormatId()
          Reserved for IBM internal use.
 java.lang.String getDeviceFormatName()
          Reserved for IBM internal use.
 java.lang.String getDeviceFormatType()
          Reserved for IBM internal use.
 java.lang.Integer getDeviceFormatTypeId()
          Reserved for IBM internal use.
 java.lang.String getDocumentPathName(java.lang.String name)
          Reserved for IBM internal use.
 HttpServletRequest getRequest()
          Reserved for IBM internal use.
 java.lang.String getRequestName()
          Reserved for IBM internal use.
  TypedProperty getRequestProperties()
          Reserved for IBM internal use.
 HttpServletResponse getResponse()
          Reserved for IBM internal use.
 java.lang.String getUniqueIdentifier()
          Reserved for IBM internal use.
 boolean httpRedirection()
          Reserved for IBM internal use.
 void initFactory(org.w3c.dom.Element node)
          Reserved for IBM internal use.
 boolean isDoubleClickHandlerEnabled()
          Reserved for IBM internal use.
 boolean isEnabled()
          Reserved for IBM internal use.
 HttpControllerRequestObject preprocessRequest()
          Reserved for IBM internal use.
 boolean processErrorResponse( CommandContext commandContext, java.lang.Exception e)
          Reserved for IBM internal use.
 void processRequest(ServletContext servletContext, java.lang.String encoding, boolean storeCommand)
          Reserved for IBM internal use.
 boolean processResponse( CommandContext commandContext, TypedProperty respProperty)
          Reserved for IBM internal use.
 void setAdapterDesc( HttpAdapterDesc value)
          Reserved for IBM internal use.
 void setDefaultDeviceFormatId(java.lang.Integer value)
          Reserved for IBM internal use.
 void setDeviceFormatClass(java.lang.Class value)
          Reserved for IBM internal use.
 void setDeviceFormatId(java.lang.Integer value)
          Reserved for IBM internal use.
 void setDeviceFormatName(java.lang.String value)
          Reserved for IBM internal use.
 void setDeviceFormatType(java.lang.String value)
          Reserved for IBM internal use.
 void setDeviceFormatTypeId(java.lang.Integer value)
          Reserved for IBM internal use.
 void setRequest(HttpServletRequest value)
          Reserved for IBM internal use.
 void setRequestProperties( TypedProperty val)
          Reserved for IBM internal use.
 void setResponse(HttpServletResponse value)
          Reserved for IBM internal use.
 
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
public static final java.lang.String COPYRIGHT
IBM Copyright notice field.
See Also:
Constant Field Values

desc

protected HttpAdapterDesc desc

requestProperties

protected TypedProperty requestProperties

req

protected HttpServletRequest req

resp

protected HttpServletResponse resp

sessionContext

protected SessionContext sessionContext

reqObj

protected HttpControllerRequestObject reqObj

encoding

protected java.lang.String encoding
Constructor Detail

AbstractHttpAdapter

public AbstractHttpAdapter()
Reserved for IBM internal use. Create the Abstract Http Adapter object.
Method Detail

displayGenericErrorView

public void displayGenericErrorView(ServletContext servletContext,
                                    java.lang.String docName)
Reserved for IBM internal use. This method displays the JSP defined for the GenericSystemErrorView (usually it is GenericSystemError.jsp). This method is called when a serious error occurs start up and cannot proceed. This method should never be invoked.
Parameters:
servletContext - the servlet context.

getAdapterDesc

public HttpAdapterDesc getAdapterDesc()
Reserved for IBM internal use. Return the descripter that describes this Http adapter.
Specified by:
getAdapterDesc in interface HttpAdapter
Returns:
The descriptor object for this adapter

getDefaultDeviceFormatId

public java.lang.Integer getDefaultDeviceFormatId()
Reserved for IBM internal use. Returns the default device format identifier for this adapter
Specified by:
getDefaultDeviceFormatId in interface DeviceFormatAdapter
Returns:
Always returns HttpAdapter.DEVFMTID_BROWSER.

getDeviceFormatId

public final java.lang.Integer getDeviceFormatId()
Reserved for IBM internal use. Gets the device format Id for this adapter.
Specified by:
getDeviceFormatId in interface DeviceFormatAdapter
Returns:
Returns the device format stored in the adapter descriptor object.

getDeviceFormatName

public final java.lang.String getDeviceFormatName()
Reserved for IBM internal use. Gets the device format name for this adapter.
Specified by:
getDeviceFormatName in interface DeviceFormatAdapter
Returns:
The device format name that is stored in the adapter descriptor object.

getDeviceFormatType

public final java.lang.String getDeviceFormatType()
Reserved for IBM internal use. Gets the device format type name for this adapter.
Specified by:
getDeviceFormatType in interface DeviceFormatAdapter
Returns:
The device format type name from the adapter descriptor.

getDeviceFormatTypeId

public java.lang.Integer getDeviceFormatTypeId()
Reserved for IBM internal use. Gets the device format type Id for this adapter.
Specified by:
getDeviceFormatTypeId in interface DeviceFormatAdapter
Returns:
The device format type Identification number from the adapter's descriptor.

getDocumentPathName

public java.lang.String getDocumentPathName(java.lang.String name)
Reserved for IBM internal use. Gets the actual output document name based on a base document name.
Specified by:
getDocumentPathName in interface DeviceFormatAdapter
Parameters:
name - the base document name.
Returns:
The base document name given.

getRequest

public final HttpServletRequest getRequest()
Reserved for IBM internal use. Gets the HttpServetRequest object.
Specified by:
getRequest in interface HttpAdapter
Returns:
The HttpServletRequest object of the originating HTTP request.

getRequestName

public final java.lang.String getRequestName()
Reserved for IBM internal use. Gets the request name .
Specified by:
getRequestName in interface HttpAdapter
Returns:
The name of request from the request object.

getRequestProperties

public TypedProperty getRequestProperties()
Reserved for IBM internal use. Gets the request properties assoiciated with this request.
Specified by:
getRequestProperties in interface HttpAdapter
Returns:
The request properties of the request. These are usually the parameters passed to the command.

getResponse

public final HttpServletResponse getResponse()
Reserved for IBM internal use. Gets the HttpServetResponse object.
Specified by:
getResponse in interface HttpAdapter
Returns:
The HttpServletRespons of the originating HTTP request.

httpRedirection

public boolean httpRedirection()
Reserved for IBM internal use. 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:
Always returns true.

initFactory

public void initFactory(org.w3c.dom.Element node)
                 throws java.lang.Exception
Reserved for IBM internal use. Initialize the AdapterFactory based on the informtion defined in the node. Initialization consists of creating an adapter descriptor (HttpAdapterDesc) and initializing the descriptor with the given XML element.
Specified by:
initFactory in interface HttpAdapterFactory
Parameters:
node - the XML element containing the adapter's configuration.
Throws:
java.lang.Exception - if there was a problem initializing the adapter.

isEnabled

public final boolean isEnabled()
Reserved for IBM internal use. Returns true if this adapter is enabled.
Specified by:
isEnabled in interface HttpAdapterFactory
Returns:
Always returns the enabled flag stored in the adapter's descriptor.

preprocessRequest

public HttpControllerRequestObject preprocessRequest()
Reserved for IBM internal use. Does some preprocessing of the request before the actual processing is done. This preprocessing includes extracting the command to execute, indicating whether the request is done over SSL and creating a ControllerRequestObject to pass to the WebController to execute the command.
Specified by:
preprocessRequest in interface HttpAdapter
Returns:
A controller request object that represents the HTTP request.

processErrorResponse

public boolean processErrorResponse(CommandContext commandContext,
                                    java.lang.Exception e)
                             throws ECException
Reserved for IBM internal use. 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 - the command context for the request
Returns:
Always returns true which indicates that the error response should be processed.
Throws:
ECException - if there is a problem when determining whether the error response is needed or not.

processRequest

public final void processRequest(ServletContext servletContext,
                                 java.lang.String encoding,
                                 boolean storeCommand)
                          throws ECException
Reserved for IBM internal use. 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 regular request which can be a controller command, a view command, or just a jsp page.
Specified by:
processRequest in interface HttpAdapter
Parameters:
servletContext - the servlet context associated with this request
encoding - the encoding used for the incoming parameters
storeCommand - true if this is a store command, otherwise false
Throws:
ECException - if there was a problem processing the request.

processResponse

public boolean processResponse(CommandContext commandContext,
TypedProperty respProperty)
                        throws ECException
Reserved for IBM internal use. 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:
commandContext - the command context after the command is executed.
Returns:
Always returns true to indicate that the repsonse should be processed.
Throws:
ECException - if there was a problem processing the response.

setAdapterDesc

public final void setAdapterDesc(HttpAdapterDesc value)
Reserved for IBM internal use. Sets the adapter descriptor.
Specified by:
setAdapterDesc in interface HttpAdapter
Parameters:
value - the Http adapter descriptor.

setDefaultDeviceFormatId

public void setDefaultDeviceFormatId(java.lang.Integer value)
Reserved for IBM internal use. Sets the default device format Id. This method does not set anything.
Specified by:
setDefaultDeviceFormatId in interface DeviceFormatAdapter
Parameters:
value - the default device format Id.

setDeviceFormatClass

public final void setDeviceFormatClass(java.lang.Class value)
Reserved for IBM internal use. Sets the device format class for this adapter. This values is stored in the adapter's descriptor.
Parameters:
value - the class object associated with this adapter.

setDeviceFormatId

public final void setDeviceFormatId(java.lang.Integer value)
Reserved for IBM internal use. Sets the device format Id for this adapter. This method does not store the value.
Specified by:
setDeviceFormatId in interface DeviceFormatAdapter
Parameters:
value - the device format id.

setDeviceFormatName

public final void setDeviceFormatName(java.lang.String value)
Reserved for IBM internal use. Sets the device format name for this adapter. This method does not store the value.
Specified by:
setDeviceFormatName in interface DeviceFormatAdapter
Parameters:
value - the device format name.

setDeviceFormatType

public final void setDeviceFormatType(java.lang.String value)
Reserved for IBM internal use. Sets the device format type name for this adapter. This method does not store the value.
Specified by:
setDeviceFormatType in interface DeviceFormatAdapter
Parameters:
value - the name of the device format type.

setDeviceFormatTypeId

public final void setDeviceFormatTypeId(java.lang.Integer value)
Reserved for IBM internal use. Sets the device format type Id for this adapter. This method does not store the value.
Specified by:
setDeviceFormatTypeId in interface DeviceFormatAdapter
Parameters:
value - the device format type identifier.

setRequest

public final void setRequest(HttpServletRequest value)
Reserved for IBM internal use. Sets the request object.
Specified by:
setRequest in interface HttpAdapter

setRequestProperties

public final void setRequestProperties(TypedProperty val)
Reserved for IBM internal use. Sets the request properties assoiciated with this request.
Specified by:
setRequestProperties in interface HttpAdapter

setResponse

public final void setResponse(HttpServletResponse value)
Reserved for IBM internal use. Sets the response object.
Specified by:
setResponse in interface HttpAdapter

isDoubleClickHandlerEnabled

public boolean isDoubleClickHandlerEnabled()
Reserved for IBM internal use. Returns true if double click handler is enabled for this adapter type. Returns false otherwise. This abstract class returns false indicating that double click is not supported. Individual adapters can overwrite this method if it can support double click check by providing a getUniqueIdentifier mehtod.
Specified by:
isDoubleClickHandlerEnabled in interface HttpAdapter
Returns:
Always will return false to indicate that double click should not be handled.

getUniqueIdentifier

public java.lang.String getUniqueIdentifier()
Reserved for IBM internal use. Gets an identifier that uniquely identifies a client session within the Commerce Server. This method is required to enable double click support. The abstract class do not support double click and returns a null string by default.
Specified by:
getUniqueIdentifier in interface HttpAdapter
Returns:
Always will return null.