Package helma.servlet

# Class AbstractServletClient

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
helma.servlet.AbstractServletClient

All Implemented Interfaces:
  `Serializable`, `javax.servlet.Servlet`, `javax.servlet.ServletConfig`

Direct Known Subclasses:
  `EmbeddedServletClient`, `StandaloneServletClient`

public abstract class AbstractServletClient extends javax.servlet.http.HttpServlet
This is an abstract Hop servlet adapter. This class communicates with hop applications via RMI. Subclasses are either one servlet per app, or one servlet that handles multiple apps

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`AbstractServletClient()`

## Method Summary

Modifier and Type
Method
Description
`abstract Application`
`getApplication()`
Abstract method to get the `Applicaton` instance the servlet is talking to.
`String`
`getServletInfo()`
Return servlet info
`void`
`init(javax.servlet.ServletConfig init)`
Init this servlet.
`static void`
`parseParameters(Map map, byte[] data, String encoding, boolean isPost)`
Append request parameters from the specified String to the specified Map.
`protected void`
`parseParameters(javax.servlet.http.HttpServletRequest request, RequestTrans reqtrans, String encoding)`
`protected List`
`parseUploads(org.apache.commons.fileupload.servlet.ServletRequestContext reqcx, RequestTrans reqtrans, UploadStatus uploadStatus, String encoding)`
`protected void`
`service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
Handle a request.
`protected void`
`writeResponse(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, RequestTrans hopreq, ResponseTrans hopres)`

### Methods inherited from class javax.servlet.http.HttpServlet

`doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

### Methods inherited from class javax.servlet.GenericServlet

`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AbstractServletClient

public AbstractServletClient()

## Method Details

### init

public void init(javax.servlet.ServletConfig init) throws javax.servlet.ServletException
Init this servlet.

Specified by:
  `init` in interface `javax.servlet.Servlet`
Overrides:
  `init` in class `javax.servlet.GenericServlet`
Parameters:
  `init` - the servlet configuration
Throws:
  `javax.servlet.ServletException` - ...

### getApplication

public abstract Application getApplication()
Abstract method to get the `Applicaton` instance the servlet is talking to.

Returns:
  this servlet's application instance

### service

protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
Handle a request.

Overrides:
  `service` in class `javax.servlet.http.HttpServlet`
Parameters:
  `request` - ...
  `response` - ...
Throws:
  `javax.servlet.ServletException` - ...
  `IOException` - ...

### writeResponse

protected void writeResponse(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, RequestTrans hopreq, ResponseTrans hopres) throws IOException

Throws:
  `IOException`

### parseUploads

protected List parseUploads(org.apache.commons.fileupload.servlet.ServletRequestContext reqcx, RequestTrans reqtrans, UploadStatus uploadStatus, String encoding) throws org.apache.commons.fileupload.FileUploadException, UnsupportedEncodingException

Throws:
  `org.apache.commons.fileupload.FileUploadException`
  `UnsupportedEncodingException`

### parseParameters

protected void parseParameters(javax.servlet.http.HttpServletRequest request, RequestTrans reqtrans, String encoding) throws IOException

Throws:
  `IOException`

### parseParameters

public static void parseParameters(Map map, byte[] data, String encoding, boolean isPost) throws UnsupportedEncodingException
Append request parameters from the specified String to the specified Map. It is presumed that the specified Map is not accessed from any other thread, so no synchronization is performed.

IMPLEMENTATION NOTE: URL decoding is performed individually on the parsed name and value elements, rather than on the entire query string ahead of time, to properly deal with the case where the name or value includes an encoded `=` or `&` character that would otherwise be interpreted as a delimiter. NOTE: byte array data is modified by this method. Caller beware.

Parameters:
  `map` - Map that accumulates the resulting parameters
  `data` - Input string containing request parameters
  `encoding` - Encoding to use for converting hex
Throws:
  `UnsupportedEncodingException` - if the data is malformed

### getServletInfo

public String getServletInfo()
Return servlet info

Specified by:
  `getServletInfo` in interface `javax.servlet.Servlet`
Overrides:
  `getServletInfo` in class `javax.servlet.GenericServlet`
Returns:
  the servlet info