|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

public interface IHttpExchange
This class encapsulates a HTTP request received and a
response to be generated in one exchange. It provides methods
IHttpRequestHandler
| Field Summary | |
|---|---|
static String |
SHOW_DETAILED_ERROR_DEFAULT
|
static String |
SHOW_DETAILED_ERROR_KEY
System property key to define if detailed error should been shown in error page |
| Method Summary | |
|---|---|
void |
destroy()
destroy the exchange and the underlying connection |
String |
encodeURL(String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
void |
forward(IHttpRequest request)
forwards a request locally. |
BodyDataSink |
forward(IHttpRequestHeader requestHeader)
forwards the a request. |
BodyDataSink |
forward(IHttpRequestHeader requestHeader,
IHttpResponseHandler responseHandler)
forwards the a request. |
BodyDataSink |
forward(IHttpRequestHeader requestHeader,
int contentLength)
forwards a request. |
BodyDataSink |
forward(IHttpRequestHeader requestHeader,
int contentLength,
IHttpResponseHandler responseHandler)
forwards a request. |
void |
forward(IHttpRequest request,
IHttpResponseHandler responseHandler)
forwards a request. |
IHttpConnection |
getConnection()
returns the underlying connection |
IHttpRequest |
getRequest()
get the request of this exchange |
IHttpSession |
getSession(boolean create)
Returns the current HttpSession associated with this exchange or, if there is no current session and create is true, returns a new session. |
void |
send(IHttpResponse response)
send the response. |
BodyDataSink |
send(IHttpResponseHeader header)
send the response. |
BodyDataSink |
send(IHttpResponseHeader header,
int contentLength)
send the response in a plain body non-blocking mode. |
boolean |
sendContinueIfRequested()
send a 100 Continue response if the request contains a Expect: 100-Continue header. |
void |
sendError(Exception e)
send an error response |
void |
sendError(int errorCode)
send an error response |
void |
sendError(int errorCode,
String msg)
send an error response |
void |
sendRedirect(String location)
Sends a temporary redirect response using the specified redirect location URL. |
| Field Detail |
|---|
static final String SHOW_DETAILED_ERROR_KEY
static final String SHOW_DETAILED_ERROR_DEFAULT
| Method Detail |
|---|
IHttpRequest getRequest()
IHttpConnection getConnection()
BodyDataSink send(IHttpResponseHeader header)
throws IOException,
IllegalStateException
IHttpMessage.getProtocolVersion() method of the request, it can be verified, if the requestor
supports a chunked responses (HTTP/1.0 request)
header - the header
IOException - if an exception occurs
IllegalStateException - if a response has already been send
BodyDataSink send(IHttpResponseHeader header,
int contentLength)
throws IOException,
IllegalStateException
header - the headercontentLength - the body content length
IOException - if an exception occurs
IllegalStateException - if a response has already been send
void send(IHttpResponse response)
throws IOException,
IllegalStateException
response - the response
IOException - if an exception occurs
IllegalStateException - if a response has already been send
void sendError(int errorCode,
String msg)
throws IllegalStateException
errorCode - the error codemsg - the error message
IllegalStateException - if a response has already been send
void sendError(int errorCode)
throws IllegalStateException
errorCode - the error codemsg - the error message
IllegalStateException - if a response has already been send
void sendError(Exception e)
throws IllegalStateException
e - the exception
IllegalStateException - if a response has already been send
void sendRedirect(String location)
throws IllegalStateException
location - the redirect location URL
IllegalStateException - if a response has already been send
BodyDataSink forward(IHttpRequestHeader requestHeader,
IHttpResponseHandler responseHandler)
throws IOException,
ConnectException,
IllegalStateException
RequestHandlerChain
This method should only be used if the original request supports chunked responses, which can be check by request.supportsChunkedResponse()
requestHeader - the request headerresponseHandler - the response handler or null (supported: IHttpRequestHandler, IHttpSocketTimeoutHandler)
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs
IllegalStateException - if a request has already been forwarded
BodyDataSink forward(IHttpRequestHeader requestHeader)
throws IOException,
ConnectException,
IllegalStateException
RequestHandlerChain
This method should only be used if the original request supports chunked responses, which can be check by request.supportsChunkedResponse()
requestHeader - the request header
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs
IllegalStateException - if a request has already been forwarded
BodyDataSink forward(IHttpRequestHeader requestHeader,
int contentLength,
IHttpResponseHandler responseHandler)
throws IOException,
ConnectException,
IllegalStateException
RequestHandlerChain
requestHeader - the request headercontentLength - the content lengthresponseHandler - the response handler or null (supported: IHttpRequestHandler, IHttpSocketTimeoutHandler)
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs
IllegalStateException - if a request has already been forwarded
BodyDataSink forward(IHttpRequestHeader requestHeader,
int contentLength)
throws IOException,
ConnectException,
IllegalStateException
RequestHandlerChain
requestHeader - the request headercontentLength - the content length
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs
IllegalStateException - if a request has already been forwarded
void forward(IHttpRequest request)
throws IOException,
ConnectException,
IllegalStateException
RequestHandlerChain
request - the request
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs
IllegalStateException - if a request has already been forwarded
void forward(IHttpRequest request,
IHttpResponseHandler responseHandler)
throws IOException,
ConnectException,
IllegalStateException
RequestHandlerChain
request - the requestresponseHandler - the response handler or null (supported: IHttpRequestHandler, IHttpSocketTimeoutHandler)
ConnectException - if an error occurred while attempting to connect to a remote address and port.
IOException - if an exception occurs
IllegalStateException - if a request has already been forwarded
boolean sendContinueIfRequested()
throws IOException
IOException - if an exception occursIHttpSession getSession(boolean create)
create - true to create a new session if necessary; false to return null if there's no current session
String encodeURL(String url)
url - the url to be encoded.
void destroy()
destroy in interface IDestroyable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||