@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (!ServletPortletHelper.isPushRequest(request)) { return false; } if (request instanceof VaadinServletRequest) { if (atmosphere == null) { response.sendError(500, "Atmosphere initialization failed. No push available."); return true; } try { atmosphere.doCometSupport( AtmosphereRequestImpl .wrap((VaadinServletRequest) request), AtmosphereResponseImpl .wrap((VaadinServletResponse) response)); } catch (ServletException e) { // TODO PUSH decide how to handle throw new RuntimeException(e); } } else { throw new IllegalArgumentException( "Portlets not currently supported"); } return true; }
public void handleNormalRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { try { framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); } catch (ServletException e) { throw new IOException(e); } }
public void handleNormalRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { try { framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); } catch (ServletException e) { throw new IOException(e); } }
@Override public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { framework.doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(res)); }
void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { this.queryMap = getQueryMap(request.getQueryString()); framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); }
private void reInject(AtmosphereRequest request, AtmosphereResponse response, String body) throws IOException, ServletException { request.setAttribute("sockjs.skipInterceptor", Boolean.TRUE); framework.doCometSupport(request.body(body), response); request.setAttribute("sockjs.skipInterceptor", null); }
@Override public void resume() { try { r.getAtmosphereConfig().framework().doCometSupport(r.getRequest(), r.getResponse()); } catch (IOException e) { logger.warn("",e); } catch (ServletException e) { logger.warn("", e); } r.resume(); }
@Override public void invoke(ServletConfig config, ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException { if (AtmosphereUtils.useAtmosphere(req)) { try { framework.doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(resp)); } catch (ServletException e) { throw new IOException(e); } return; } super.invoke(config, context, req, resp); }
@Override public void invoke(ServletConfig config, ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException { if (AtmosphereUtils.useAtmosphere(req)) { try { framework.doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(resp)); } catch (ServletException e) { throw new IOException(e); } return; } super.invoke(config, context, req, resp); }
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (!ServletHelper.isRequestType(request, RequestType.PUSH)) { return false; } if (request instanceof VaadinServletRequest) { if (atmosphere == null) { response.sendError(500, "Atmosphere initialization failed. No push available."); return true; } try { atmosphere.doCometSupport( AtmosphereRequestImpl .wrap((VaadinServletRequest) request), AtmosphereResponseImpl .wrap((VaadinServletResponse) response)); } catch (ServletException e) { // TODO PUSH decide how to handle throw new RuntimeException(e); } } else { throw new IllegalArgumentException( "Only VaadinServletRequests are supported"); } return true; }
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (!ServletHelper.isRequestType(request, RequestType.PUSH)) { return false; } if (request instanceof VaadinServletRequest) { if (atmosphere == null) { response.sendError(500, "Atmosphere initialization failed. No push available."); return true; } try { atmosphere.doCometSupport( AtmosphereRequest.wrap((VaadinServletRequest) request), AtmosphereResponse .wrap((VaadinServletResponse) response)); } catch (ServletException e) { // TODO PUSH decide how to handle throw new RuntimeException(e); } } else { throw new IllegalArgumentException( "Only VaadinServletRequests are supported"); } return true; }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (AtmosphereUtils.useAtmosphere(request)) { try { framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); baseRequest.setHandled(true); } catch (ServletException e) { throw new IOException(e); } return; } super.handle(target, baseRequest, request, response); } }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (AtmosphereUtils.useAtmosphere(request)) { try { framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); baseRequest.setHandled(true); } catch (ServletException e) { throw new IOException(e); } return; } super.handle(target, baseRequest, request, response); } }
public AtmosphereCoordinator route(AtmosphereRequest request, AtmosphereResponse response) throws IOException { final VertxAsyncIOWriter w = VertxAsyncIOWriter.class.cast(response.getAsyncIOWriter()); try { Action a = framework.doCometSupport(request, response); final AtmosphereResourceImpl impl = (AtmosphereResourceImpl) request.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); String transport = (String) request.getAttribute(FrameworkConfig.TRANSPORT_IN_USE); if (transport == null) { transport = request.getHeader(X_ATMOSPHERE_TRANSPORT); } logger.debug("Transport {} action {}", transport, a); final Action action = (Action) request.getAttribute(NettyCometSupport.SUSPEND); if (action != null && action.type() == Action.TYPE.SUSPEND && action.timeout() != -1) { final AtomicReference<Future<?>> f = new AtomicReference<>(); f.set(suspendTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { if (!w.isClosed() && (System.currentTimeMillis() - w.lastTick()) > action.timeout()) { asynchronousProcessor.endRequest(impl, false); f.get().cancel(true); } } }, action.timeout(), action.timeout(), TimeUnit.MILLISECONDS)); } } catch (Throwable e) { logger.error("Unable to process request", e); } return this; }
@Override public void onResume(AtmosphereResourceEvent event) { if (event.isResuming()) { listener.onComplete(AtmosphereContinuation.this); } else { try { r.getAtmosphereConfig().framework().doCometSupport(r.getRequest(), r.getResponse()); } catch (IOException e) { logger.warn("", e); } catch (ServletException e) { logger.warn("", e); } listener.onTimeout(AtmosphereContinuation.this); } } });
public void handleNormalRequest(HttpServerExchange undertowExchange) throws Exception { HttpServletResponseImpl response = new HttpServletResponseImpl(undertowExchange, (ServletContextImpl)servletContext); HttpServletRequestImpl request = new HttpServletRequestImpl(undertowExchange, (ServletContextImpl)servletContext); ServletRequestContext servletRequestContext = new ServletRequestContext(((ServletContextImpl)servletContext) .getDeployment(), request, response, null); undertowExchange.putAttachment(ServletRequestContext.ATTACHMENT_KEY, servletRequestContext); try { framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); } catch (ServletException e) { throw new IOException(e); } }
public void handleNormalRequest(HttpServerExchange undertowExchange) throws Exception { HttpServletResponseImpl response = new HttpServletResponseImpl(undertowExchange, (ServletContextImpl)servletContext); HttpServletRequestImpl request = new HttpServletRequestImpl(undertowExchange, (ServletContextImpl)servletContext); ServletRequestContext servletRequestContext = new ServletRequestContext(((ServletContextImpl)servletContext) .getDeployment(), request, response, null); undertowExchange.putAttachment(ServletRequestContext.ATTACHMENT_KEY, servletRequestContext); try { framework.doCometSupport(AtmosphereRequestImpl.wrap(request), AtmosphereResponseImpl.wrap(response)); } catch (ServletException e) { throw new IOException(e); } }
Action a = framework.doCometSupport(request, response); final AtmosphereResourceImpl impl = (AtmosphereResourceImpl) request.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE);
/** * Weblogic specific comet based implementation. * * @param rrk * @return true if suspended * @throws java.io.IOException * @throws javax.servlet.ServletException */ protected boolean doRequest(RequestResponseKey rrk) throws IOException, ServletException { try { rrk.getRequest().getSession().setAttribute(WebLogicCometSupport.RRK, rrk); Action action = framework.doCometSupport(AtmosphereRequestImpl.wrap(rrk.getRequest()), AtmosphereResponseImpl.wrap(rrk.getResponse())); if (action.type() == Action.TYPE.SUSPEND) { if (action.timeout() == -1) { rrk.setTimeout(Integer.MAX_VALUE); } else { rrk.setTimeout((int) action.timeout()); } } return action.type() == Action.TYPE.SUSPEND; } catch (IllegalStateException ex) { logger.error("AtmosphereServlet.doRequest exception", ex); throw ex; } }
attachWriter(r); Action action = framework.doCometSupport(ar, response); if (action.type() == Action.TYPE.SUSPEND) { ar.destroyable(false);