|
SMILA 1.0 API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.smila.http.server.util.ARequestHandler
org.eclipse.smila.http.server.json.JsonBulkRequestHandler
public abstract class JsonBulkRequestHandler
JSON bulk request handler.
| Field Summary | |
|---|---|
protected static DataFactory |
FACTORY
Record/Any factory. |
protected static JsonHttpUtils |
HTTP_UTILS
Utilities for JSON-Request/Response handling. |
| Constructor Summary | |
|---|---|
JsonBulkRequestHandler()
|
|
| Method Summary | |
|---|---|
abstract void |
end(java.lang.String method,
java.lang.String requestUri,
HttpExchange exchange)
Called after processing and finishing is done. |
abstract java.lang.Object |
finish(java.lang.String method,
java.lang.String requestUri,
HttpExchange exchange)
Called after the complete input bulk has been processed successfully. |
protected int |
getErrorStatus(java.lang.String method,
java.lang.String requestUri,
java.lang.Throwable ex)
Gets the HTTP error status code depending on the method, request URI and throwable. |
protected java.lang.String |
getRequestHost()
|
protected int |
getSuccessStatus(java.lang.String method,
java.lang.String requestUri,
java.lang.Object resultObject)
Gets the ACCEPTED (202) HTTP status code. |
void |
handle(HttpExchange exchange)
Handles a HttpExchange containing a HttpRequest. |
protected boolean |
isValidMethod(java.lang.String method,
java.lang.String requestUri)
Checks if the given HTTP method is allowed for the request URI. |
abstract void |
process(java.lang.String method,
java.lang.String requestUri,
Record inputRecord,
HttpExchange exchange)
process input record and return result record. |
abstract void |
start(java.lang.String method,
java.lang.String requestUri,
HttpExchange exchange)
Called before processing. |
protected boolean |
writeErrorResult(HttpExchange exchange,
java.lang.Throwable error)
Writes the error result. |
protected void |
writeResultObject(java.io.OutputStream responseStream,
java.lang.Object resultObject)
write result object. |
protected boolean |
writeSuccessResult(HttpExchange exchange,
java.lang.Object resultObject)
Writes a success status code. |
| Methods inherited from class org.eclipse.smila.http.server.util.ARequestHandler |
|---|
activate, getDynamicUriParts, getRootContextPath, getStaticUriParts, getUriPattern, matches, urlDecode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final DataFactory FACTORY
protected static final JsonHttpUtils HTTP_UTILS
| Constructor Detail |
|---|
public JsonBulkRequestHandler()
| Method Detail |
|---|
public abstract void process(java.lang.String method,
java.lang.String requestUri,
Record inputRecord,
HttpExchange exchange)
throws java.lang.Exception
method - the HTTP method of this request.requestUri - the request URIinputRecord - input Record, may be nullexchange - http exchange object, contains e.g. the http header fields
java.lang.Exception - any failure during processing.
public abstract java.lang.Object finish(java.lang.String method,
java.lang.String requestUri,
HttpExchange exchange)
throws java.lang.Exception
method - the request method.requestUri - the request URI.exchange - http exchange object, contains e.g. the http header fields
java.lang.Exception - any failure during finishing.
public abstract void start(java.lang.String method,
java.lang.String requestUri,
HttpExchange exchange)
throws java.lang.Exception
method - the request method.requestUri - the request URI.exchange - http exchange object, contains e.g. the http header fields
java.lang.Exception - any failure during processing.
public abstract void end(java.lang.String method,
java.lang.String requestUri,
HttpExchange exchange)
throws java.lang.Exception
method - the request method.requestUri - the request URI.exchange - http exchange object, contains e.g. the http header fields
java.lang.Exceptionpublic void handle(HttpExchange exchange)
exchange - the HttpExchange object
protected boolean isValidMethod(java.lang.String method,
java.lang.String requestUri)
method - the HTTP method.requestUri - the Request URI.
protected boolean writeSuccessResult(HttpExchange exchange,
java.lang.Object resultObject)
throws java.io.IOException
exchange - the HttpExchangeresultObject - result object, may be null.
java.io.IOException
protected int getSuccessStatus(java.lang.String method,
java.lang.String requestUri,
java.lang.Object resultObject)
method - ignoredrequestUri - ignoredresultObject - result object, may be null.
protected void writeResultObject(java.io.OutputStream responseStream,
java.lang.Object resultObject)
throws java.io.IOException
Record results. Subclasses that produce
different result types must override this method.
responseStream - response streamresultObject - result object.
java.io.IOException - error writing result
protected boolean writeErrorResult(HttpExchange exchange,
java.lang.Throwable error)
throws java.io.IOException
exchange - the HttpExchange object.error - the error to be written
java.io.IOException - could not write the error to the response stream.
protected int getErrorStatus(java.lang.String method,
java.lang.String requestUri,
java.lang.Throwable ex)
HTTP_UTILS#getErrorStatus(Throwable)protected java.lang.String getRequestHost()
|
SMILA 1.0 API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||