com.ibm.commerce.programadapter
Class HttpProgramAdapterImpl

java.lang.Object
  |
  +--com.ibm.commerce.adapter.AbstractHttpAdapter
        |
        +--com.ibm.commerce.programadapter.HttpProgramAdapterImpl
All Implemented Interfaces:
DeviceFormatAdapter, HttpAdapter, HttpAdapterFactory

public class HttpProgramAdapterImpl
extends AbstractHttpAdapter
implements HttpAdapter, HttpAdapterFactory

The Program Adapter that handles http requests.


Field Summary
static java.lang.String _HTTP_CHARSET_CONSTANT
           
static java.lang.String _ICI_MESSAGE
           
static java.lang.String _ICI_NEWINBOUND_COMMAND_NAME
           
static java.lang.String _STR_CreateAdapter
           
static java.lang.String _STR_GetData
           
static java.lang.String _STR_InitFactory
           
static java.lang.String _STR_IsSupportedConfigParameter
           
static java.lang.String _STR_PostInvokeCommand
           
static java.lang.String _STR_PreInvokeCommand
           
static java.lang.String _STR_PreprocessRequest
           
static java.lang.String _STR_ProcessErrorResponse
           
static java.lang.String _STR_ProcessResponse
           
static java.lang.String _STR_SetCommandProperties
           
static java.lang.String _STR_ThisClass
           
static java.lang.String _STR_ValidateDeviceFormat
           
protected  CommandProperty commandProperties
           
 
Fields inherited from class com.ibm.commerce.adapter.AbstractHttpAdapter
desc, req, reqObj, requestProperties, resp, 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
HttpProgramAdapterImpl()
          HttpProgramAdapterImpl constructor.
 
Method Summary
 boolean checkDeviceFormat(javax.servlet.http.HttpServletRequest req, TypedProperty prop)
          Return true if the input request can be processed by this adapter.
 HttpAdapter createAdapter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, TypedProperty param)
          This method returns an instance of this adapter if the request has the format defined by this adapter.
 CommandProperty getCommandProperties()
          Returns the CommandProperty object of the request.
 java.lang.Integer getDefaultDeviceFormatId()
          Returns the default device format identifier for this adapter
 java.lang.Integer getDeviceFormatTypeId()
          Gets the device format type Id for this adapter.
 SessionContext getSessionContext()
          Gets the session context.
 boolean httpsRedirection()
          Returns true if Https redirection is required.
 void initFactory(org.w3c.dom.Element node)
          initialize the AdapterFactory based on the informtion defined in the node
 void postInvokeCommand(CommandContext commandContext)
          This method implements adapter specific function after the execution of a command.
 boolean preInvokeCommand(CommandContext commandContext)
          This method implements adapter specific function before the execution of a command.
 com.ibm.commerce.programadapter.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.
 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 setCommandProperties(CommandProperty cmdProp)
          Sets the CommandProperties object.
 CommandProperty validateDeviceFormat(javax.servlet.http.HttpServletRequest req)
          Return true if the input request can be processed by this adapter.
 
Methods inherited from class com.ibm.commerce.adapter.AbstractHttpAdapter
displayGenericErrorView, getAdapterDesc, getDeviceFormatId, getDeviceFormatName, getDeviceFormatType, getDocumentPathName, getRequest, getRequestName, getRequestProperties, getResponse, httpRedirection, initFactory, isEnabled, processRequest, setAdapterDesc, setDefaultDeviceFormatId, setDeviceFormatClass, setDeviceFormatId, setDeviceFormatName, setDeviceFormatType, setDeviceFormatTypeId, setRequest, setRequestProperties, setResponse
 
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
getAdapterDesc, getRequest, getRequestName, getRequestProperties, getResponse, processRequest, setAdapterDesc, setRequest, setRequestProperties, setResponse
 
Methods inherited from interface com.ibm.commerce.adapter.DeviceFormatAdapter
getDeviceFormatId, getDeviceFormatName, getDeviceFormatType, getDocumentPathName, setDefaultDeviceFormatId, setDeviceFormatId, setDeviceFormatName, setDeviceFormatType, setDeviceFormatTypeId
 
Methods inherited from interface com.ibm.commerce.adapter.HttpAdapterFactory
createAdapter, getAdapterDesc, initFactory, isEnabled
 

Field Detail

_HTTP_CHARSET_CONSTANT

public static final java.lang.String _HTTP_CHARSET_CONSTANT

_ICI_MESSAGE

public static final java.lang.String _ICI_MESSAGE

_ICI_NEWINBOUND_COMMAND_NAME

public static final java.lang.String _ICI_NEWINBOUND_COMMAND_NAME

_STR_CreateAdapter

public static final java.lang.String _STR_CreateAdapter

_STR_GetData

public static final java.lang.String _STR_GetData

_STR_InitFactory

public static final java.lang.String _STR_InitFactory

_STR_IsSupportedConfigParameter

public static final java.lang.String _STR_IsSupportedConfigParameter

_STR_PostInvokeCommand

public static final java.lang.String _STR_PostInvokeCommand

_STR_PreInvokeCommand

public static final java.lang.String _STR_PreInvokeCommand

_STR_PreprocessRequest

public static final java.lang.String _STR_PreprocessRequest

_STR_ProcessErrorResponse

public static final java.lang.String _STR_ProcessErrorResponse

_STR_ProcessResponse

public static final java.lang.String _STR_ProcessResponse

_STR_SetCommandProperties

public static final java.lang.String _STR_SetCommandProperties

_STR_ThisClass

public static final java.lang.String _STR_ThisClass

_STR_ValidateDeviceFormat

public static final java.lang.String _STR_ValidateDeviceFormat

commandProperties

protected CommandProperty commandProperties
Constructor Detail

HttpProgramAdapterImpl

public HttpProgramAdapterImpl()
HttpProgramAdapterImpl constructor.
Method Detail

checkDeviceFormat

public boolean checkDeviceFormat(javax.servlet.http.HttpServletRequest req,
                                 TypedProperty prop)
Return true if the input request can be processed by this adapter.

Specified by:
checkDeviceFormat in interface HttpAdapterFactory
Returns:
boolean - true if this request can be processed by this adapter false if this request cannot be processed by this adapter

createAdapter

public HttpAdapter createAdapter(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 TypedProperty param)
This method returns an instance of this adapter if the request has the format defined by this adapter. This method should first call the checkDeviceFormat() method. If it returns true, then it will instantiate an instance of this adapter. The adapter instance returned will be initialized with request, response and request properties initialized.

Parameters:
request - HttpServletRequest
response - HttpServletResponse
param - TypedProperty - request parameters

Returns:
HttpAdapter - an instance of this adapter if the request can be processed by this adapter - null if this request cannot be processed by this adapter

getCommandProperties

public CommandProperty getCommandProperties()
Returns the CommandProperty object of the request.

getDefaultDeviceFormatId

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

Specified by:
getDefaultDeviceFormatId in interface DeviceFormatAdapter
Overrides:
getDefaultDeviceFormatId in class AbstractHttpAdapter
Returns:
Integer

getDeviceFormatTypeId

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

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

getSessionContext

public SessionContext getSessionContext()
                                 throws ECException
Gets the session context.
Specified by:
getSessionContext in interface DeviceFormatAdapter
Returns:
SessionContext

httpsRedirection

public boolean httpsRedirection()
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.
Specified by:
httpsRedirection in interface HttpAdapter

initFactory

public void initFactory(org.w3c.dom.Element node)
                 throws java.lang.Exception
initialize the AdapterFactory based on the informtion defined in the node

postInvokeCommand

public void postInvokeCommand(CommandContext commandContext)
                       throws ECException
This method implements adapter specific function after the execution of a command.
Specified by:
postInvokeCommand in interface DeviceFormatAdapter
Parameters:
commandContext - CommandContext - the command context associated with the command.
Throws:
ECException -  

preInvokeCommand

public boolean preInvokeCommand(CommandContext commandContext)
                         throws ECException
This method implements adapter specific function before the execution of a command.
Specified by:
preInvokeCommand in interface DeviceFormatAdapter
Parameters:
commandContext - CommandContext - the command context associated with the command.
Throws:
ECException -  

preprocessRequest

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

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
Overrides:
processErrorResponse in class AbstractHttpAdapter
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

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
Overrides:
processResponse in class AbstractHttpAdapter
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

setCommandProperties

public void setCommandProperties(CommandProperty cmdProp)
Sets the CommandProperties object. This also give the session context the opertunity to change the CommandProperty object if needed since the session context provides the session and security handling of the adapter.

validateDeviceFormat

public CommandProperty validateDeviceFormat(javax.servlet.http.HttpServletRequest req)
Return true if the input request can be processed by this adapter.

Returns:
CommandProperty - an instance of CommandProperty if this request can be processed by this adapter null if this request cannot be processed by this adapter