@Override public void init() throws ServletException { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); socketCreator = wac.getBean(ConsoleLogSocketCreator.class); securityService = wac.getBean(SecurityService.class); super.init(); }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Username userName = SessionUtils.currentUsername(); String pipeline = pipeline(request); if (authorizedToViewPipeline(userName, pipeline)) { super.service(request, response); return; } response.sendError(SC_FORBIDDEN, String.format("%s is not authorized to view the pipeline %s", userName.getDisplayName(), pipeline)); }
@Override public void destroy() { // terminate any active websocket sessions SessionManager sm = XMPPServer.getInstance().getSessionManager(); for (ClientSession session : sm.getSessions()) { if (session instanceof LocalSession) { Object ws = ((LocalSession) session).getSessionData("ws"); if (ws != null && (Boolean) ws) { Log.debug( "Closing session as websocket servlet is being destroyed: {}", session ); session.close(); } } } super.destroy(); }
String max = getInitParameter("maxIdleTime"); if (max != null) max = getInitParameter("maxTextMessageSize"); if (max != null) max = getInitParameter("maxBinaryMessageSize"); if (max != null) max = getInitParameter("inputBufferSize"); if (max != null) ServletContext ctx = getServletContext(); factory = WebSocketServletFactory.Loader.load(ctx, policy); configure(factory);
String max = getInitParameter("maxIdleTime"); if (max != null) max = getInitParameter("maxMessageSize"); if (max != null) max = getInitParameter("inputBufferSize"); if (max != null) configure(factory);
String max = getInitParameter("maxIdleTime"); if (max != null) max = getInitParameter("maxMessageSize"); if (max != null) max = getInitParameter("inputBufferSize"); if (max != null) configure(factory);
@Override public void init() throws ServletException { this.wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); super.init(); }
@Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { HttpServletRequest request; HttpServletResponse response; try { request = (HttpServletRequest) req; response = (HttpServletResponse) res; } catch (ClassCastException e) { super.service(req, res); return; } if (request == null || response == null) { throw new ServletException("Request or response was null"); } String connection = request.getHeader("Connection"); if (connection != null && connection.equals("Upgrade")) { //LOG.debug("Got upgrade request: {}", req); super.service(req, res); //LOG.debug("Upgrade request response: {}", res); } else { //LOG.debug("Servicing normal request: {}", req); holder.getServlet().service(req, res); //LOG.debug("Normal request response: {}", res); } } }
@Override public void destroy() { // terminate any active websocket sessions SessionManager sm = XMPPServer.getInstance().getSessionManager(); for (ClientSession session : sm.getSessions()) { if (session instanceof LocalSession) { Object ws = ((LocalSession) session).getSessionData("ws"); if (ws != null && (Boolean) ws) { session.close(); } } } super.destroy(); }
@Override public void init() throws ServletException { super.init(); listener = (TransportAcceptListener) getServletContext().getAttribute("acceptListener"); if (listener == null) { throw new ServletException("No such attribute 'acceptListener' available in the ServletContext"); } }
@Override public void init() throws ServletException { super.init(); listener = (TransportAcceptListener) getServletContext().getAttribute("acceptListener"); if (listener == null) { throw new ServletException("No such attribute 'acceptListener' available in the ServletContext"); } }
@Override public void init(ServletConfig config) throws ServletException { GravityServletUtil.init(config); // Must be before init() because configure() is called by init() super.init(config); }
@Override public void init() throws ServletException { super.init(); listener = (TransportAcceptListener) getServletContext().getAttribute("acceptListener"); if (listener == null) { throw new ServletException("No such attribute 'acceptListener' available in the ServletContext"); } }
@Override public void init(ServletConfig config) throws ServletException { super.init(config); holder.getServlet().init(config); }