Accessing javax.servlet classes
In order to provide a consistent set of APIs for both Web and rich client application developers, some HATS APIs were generalized so they would work in either a Web or rich client environment. For example, prior to HATS 7.0, the javax.servlet.HttpServletRequest object for a request could be accessed via the BusinessLogicInfo.getRequest() method. Although this API is still available (but deprecated), new business logic classes use the new IBusinessLogicInformation interface instead of the BusinessLogicInfo class.
The getRequest() method on this interface returns a com.ibm.hats.runtime.IRequest
object. In a Web application, this object will be of type com.ibm.hats.runtime.WebRequest.
WebRequest has similar methods to HttpServletRequest, but does not
extend from it. To access the actual HttpServletRequest object from
a WebRequest object, the getHttpServletRequest() method can be called.
See the Javadoc API for IBusinessLogicInformation for more
information and code samples.
| javax.servlet Class | + Wrapper HATS Class | + Method to access |
|---|---|---|
| HttpServletRequest | com.ibm.hats.runtime.WebRequest | WebRequest.getHttpServletRequest() |
| HttpServletResponse | com.ibm.hats.runtime.WebResponse | WebResponse.getHttpServletResponse() |
| ServletContext | com.ibm.hats.runtime.WebContext | WebContext.getServletContext() |
| ServletConfig | com.ibm.hats.runtime.WebConfig | WebConfig.getServletConfig() |