Class PushServlet

All Implemented Interfaces:
Servlet, ServletConfig, Serializable

public final class PushServlet extends HttpServlet
The servlet that carries the five 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: