Class PushServlet
- All Implemented Interfaces:
Servlet, ServletConfig, Serializable
POST /iizi-push/<operation> operations of PUSH-WIRE-CONTRACT.md section 5, registered by PushNotificationModule through IServer.registerServlet(PATH_SPEC,servlet) in the web server's root context, where it takes precedence over the default servlet by servlet-mapping precedence.The servlet is the routing layer only: it maps the path to the operation name and hands the request to PushHttpHandler.handle(String,HttpServletRequest,HttpServletResponse,PrintWriter), which owns the front door, the authentication and every reply. Under PATH_SPEC, /iizi-push/keys arrives with getPathInfo()=="/keys"; a path with no name, with more than one segment or with a name that is not one of TARGETS is handed over as null, and the handler answers 404 unknown_operation after its front door, so that a production server refuses an insecure request before it says which operations exist.
HttpServlet answers 405 for every method this class does not override, so doPost(HttpServletRequest, HttpServletResponse) and doOptions(HttpServletRequest, HttpServletResponse) are the whole servlet. The CORSFilter of the root context applies to every request that reaches here, including the X-iizi allowance for /iizi-push/; the CORS preflight is the filter's headers plus doOptions(HttpServletRequest, HttpServletResponse).
The content type is set before the writer is fetched, so the writer's charset is the UTF-8 the client expects.
- Author:
- Christopher Mindus
- See Also:
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe servlet path specification:"/iizi-push/*".static final StringThe URL prefix of every operation.static final String[]The operation names, the eight ofPushWire.OPERATIONSin the contract's order.Fields inherited from class HttpServlet
LEGACY_DO_HEADConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprotected voiddoOptions(HttpServletRequest request, HttpServletResponse response) protected voiddoPost(HttpServletRequest request, HttpServletResponse response) Methods inherited from class HttpServlet
doDelete, doGet, doHead, doPatch, doPut, doTrace, getLastModified, init, isSensitiveHeader, service, serviceMethods inherited from class GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Field Details
PATH_SPEC
PREFIX
TARGETS
The operation names, the eight ofPushWire.OPERATIONSin the contract's order.
Constructor Details
PushServlet
Constructor.- Parameters:
handler- The handler of the operations.- Throws:
NullPointerException- Ifhandleris null.
Method Details
doPost
- Overrides:
doPostin classHttpServlet- Throws:
IOException
doOptions
- Overrides:
doOptionsin classHttpServlet