Class PushServlet
- All Implemented Interfaces:
Servlet, ServletConfig, Serializable
POST /iizi-push/<func> endpoints of WIRE-CONTRACT §1, registered by PushServerModule 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 endpoint 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 answered 404 with the handler's JSON error shape, before the handler is asked anything.
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 (§0.3).
- Author:
- Christopher Mindus
- See Also:
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe servlet path specification:"/iizi-push/*".static final StringThe URL prefix of every endpoint.static final String[]The endpoint names, in the order of WIRE-CONTRACT §1.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 endpoint names, in the order of WIRE-CONTRACT §1.
Constructor Details
PushServlet
Constructor.- Parameters:
handler- The handler of the endpoints.- Throws:
NullPointerException- Ifhandleris null.
Method Details
doPost
- Overrides:
doPostin classHttpServlet- Throws:
IOException
doOptions
- Overrides:
doOptionsin classHttpServlet