@ThreadSafe
public abstract class AbstractServlet
extends HttpServlet
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractServlet.BadRequestException
Bad request exception.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
JSON_CONTENT_TYPE
JSON content type.
|
static String |
JSON_PARAMETER
JSON parameter.
|
static String |
RESPONSE_ROOT
Response root element.
|
static String |
STAMP_ATTRIBUTE
Stamp attribute.
|
static String |
XML_CONTENT_TYPE
XML content type.
|
| Constructor and Description |
|---|
AbstractServlet() |
| Modifier and Type | Method and Description |
|---|---|
static Optional<String> |
canonicalize(Optional<String> text)
Canonicalizes text.
|
protected Logger |
getThisLogger()
Gets the logger.
|
protected XMLDocument |
parseRequest(HttpServletRequest request,
HttpServletResponse response)
Parses the document contained in a POST request.
|
protected static void |
sendGetResponse(HttpServletRequest request,
HttpServletResponse response,
XMLDocument responseDocument)
Sends a response.
|
protected static void |
sendPostResponse(HttpServletRequest request,
HttpServletResponse response,
XMLDocument responseDocument)
Sends a response.
|
protected void |
service(HttpServletRequest request,
HttpServletResponse response)
Does service processing.
|
protected void |
setLogID(Optional<String> logID)
Sets the log ID.
|
protected static boolean |
toBoolean(Optional<String> optionalValueString)
Gets a boolean value.
|
protected static Optional<DateTime> |
toStamp(Optional<String> valueString)
Gets a stamp (date-time) value.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicepublic static final String JSON_CONTENT_TYPE
public static final String JSON_PARAMETER
public static final String RESPONSE_ROOT
public static final String STAMP_ATTRIBUTE
public static final String XML_CONTENT_TYPE
@Nonnull
@CheckReturnValue
public static Optional<String> canonicalize(@Nonnull
Optional<String> text)
text - The optional text.protected static void sendGetResponse(@Nonnull
HttpServletRequest request,
@Nonnull
HttpServletResponse response,
@Nonnull
XMLDocument responseDocument)
throws IOException
request - The GET request.response - The HTTP response.responseDocument - The response document.IOException - When appropriate.protected static void sendPostResponse(@Nonnull
HttpServletRequest request,
@Nonnull
HttpServletResponse response,
@Nonnull
XMLDocument responseDocument)
throws IOException
request - The POST request.response - The HTTP response.responseDocument - The response document.IOException - When appropriate.@CheckReturnValue
protected static boolean toBoolean(@Nonnull
Optional<String> optionalValueString)
throws AbstractServlet.BadRequestException
optionalValueString - An optional value string..AbstractServlet.BadRequestException - On a bad value string.@Nonnull @CheckReturnValue protected static Optional<DateTime> toStamp(@Nonnull Optional<String> valueString) throws AbstractServlet.BadRequestException
valueString - An optional value string.AbstractServlet.BadRequestException - On a bad value string.@Nonnull @CheckReturnValue protected final Logger getThisLogger()
@Nullable @CheckReturnValue protected XMLDocument parseRequest(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response) throws IOException
request - The POST request.response - The HTTP response.IOException - When appropriate.protected final void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
service in class HttpServletrequest - The HTTP request.response - The HTTP response.ServletException - When appropriate.IOException - When appropriate.protected void setLogID(Optional<String> logID)
logID - The optional log ID.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.