|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.httpgw.HTTPGateway
The HTTPGateway class represents the conduit between the Web server and the NetFactor method server. It includes a main method allowing it to serve as a CGI application, but can also be used within a Servlet. This class is responsible for abstracting the CGI/Servlet role so NetFactor method servers need not be aware of the difference. A new instance is created for each request. The object's purpose is to allow the unmarshaling of a HTTPResponse object to bind itself back to the corresponding request during unmarshaling. This is necessary to support streaming responses through the gateway during response deserialization. It is accomplished by assigning each instance a lookup id that is passed to the method server along with the request. The response includes this id and is used to find the corresponding instance while the response object is still be deserialized. The response deserialization code can then set response headers and access the body output stream directly. An instance-based lookup is required so that multiple requests can be handled simultaneously by a multi-threaded Servlet.
The HTTP request is forwarded to a method server by wrapping the request (including entity body input stream) in a HTTPRequest object and passing that object as an argument to the processRequest method of the HTTPServer class. Special argument and response serialization code handles streaming of request input and output so when the called method returns, there is no further work to be performed.
Field Summary | |
private boolean |
aborted
|
private boolean |
addHeaders
|
private Properties |
cgiData
|
private static String |
CLASS
|
(package private) static Hashtable |
gateways
|
private Integer |
id
|
private InputStream |
inputStream
|
boolean |
invalidateSession
|
private static String |
METHOD
|
(package private) static int |
nextGatewayId
|
private OutputStream |
outputStream
|
private Object |
servletWriter
|
private static boolean |
VERBOSE
|
private static int |
VERBOSITY
|
Constructor Summary | |
HTTPGateway(InputStream input_stream,
Object gateway_writer)
Creates a new HTTPGateway initialized with the specified input stream and object. |
|
HTTPGateway(InputStream input_stream,
OutputStream output_stream)
Creates a new HTTPGateway initialized with the specified input stream and output stream. |
Method Summary | |
void |
abort(Thread writer)
Abort response. |
static HTTPGateway |
get(Integer id)
Gets the HTTPGateway object by index (int). |
InputStream |
getInputStream()
Gets the input stream associated with this HTTPGateway object. |
OutputStream |
getOutputStream()
Gets the output stream associated with this HTTPGateway object. |
private OutputStream |
getServletOutputStream()
|
void |
processRequest(HTTPRequest request)
Process request received from the client. |
void |
setAddHeaders(boolean addHeaders)
Sets the flag that be used to decide if the HTTP Response Headers are written to the OutputStream |
private void |
setServletHTMLHeader()
|
void |
writeHdrs(HTTPResponseHeaders headers)
Sends the writeHeaders method in HTTPResponseHeaders the proper sink to write to. |
private void |
writeServletHdrs(HTTPResponseHeaders headers)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String CLASS
private static final String METHOD
private static final boolean VERBOSE
private static final int VERBOSITY
static Hashtable gateways
static int nextGatewayId
private Properties cgiData
private InputStream inputStream
private OutputStream outputStream
private Integer id
private Object servletWriter
private boolean aborted
public boolean invalidateSession
private boolean addHeaders
Constructor Detail |
public HTTPGateway(InputStream input_stream, Object gateway_writer)
input_stream
- the input streamgateway_writer
- the objectpublic HTTPGateway(InputStream input_stream, OutputStream output_stream)
input_stream
- the input streamoutput_stream
- the output streamMethod Detail |
public static HTTPGateway get(Integer id)
id
- the index int of our HTTPGateway object
public InputStream getInputStream()
public OutputStream getOutputStream() throws IOException
IOException
public void writeHdrs(HTTPResponseHeaders headers) throws IOException
IOException
private void writeServletHdrs(HTTPResponseHeaders headers)
public void abort(Thread writer)
public void processRequest(HTTPRequest request) throws IOException
IOException
private void setServletHTMLHeader() throws IOException
IOException
private OutputStream getServletOutputStream() throws IOException
IOException
public void setAddHeaders(boolean addHeaders)
addHeaders
- sets flag
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |