Package org.atmosphere.cpr

Examples of org.atmosphere.cpr.AtmosphereRequest$IS


        return Action.CANCELLED;
    }

    protected Action info(AtmosphereResource r) {
        final AtmosphereResponse response = r.getResponse();
        final AtmosphereRequest request = r.getRequest();

        response.headers().put("Content-Type", "application/json; charset=UTF-8");
        ObjectNode json = new ObjectNode(JsonNodeFactory.instance);
        json.put("websocket", supportWebSocket);
        json.putArray("origins").add("*:*");
        json.put("entropy", new Random().nextInt());
        r.write(JsonCodec.encode(json));

        if (baseURL.get().isEmpty()) {
            baseURL.set(request.getRequestURI().substring(0, request.getRequestURI().indexOf("/info")));
        }

        return Action.CANCELLED;
    }
View Full Code Here


        });
    }

    private Action injectMessage(AtmosphereResource r) {
        final AtmosphereResponse response = r.getResponse();
        final AtmosphereRequest request = r.getRequest();

        String body = IOUtils.readEntirely(r).toString();
        try {
            if (!body.isEmpty() && body.startsWith("d=")) {
                body = URLDecoder.decode(body, "UTF-8");
View Full Code Here

        }
    }

    @Override
    public Action inspect(final AtmosphereResource r) {
        AtmosphereRequest request = r.getRequest();

        if (r.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) {

            if (r.getRequest().getAttribute(FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE) != null) {
                return Action.CANCELLED;
            }
        }

        request.setAttribute(Continuation.ATTRIBUTE, new AtmosphereContinuation(r));

        return Action.CONTINUE;
    }
View Full Code Here

  public void onRequest()
  {
    TesterBroadcaster broadcaster = (TesterBroadcaster) eventBus.getBroadcaster();

    AtmosphereResource atmosphereResource = new AtmosphereResourceImpl();
    AtmosphereRequest atmosphereRequest = AtmosphereRequest.wrap(wicketTester.getRequest());
    AtmosphereResponse atmosphereResponse = AtmosphereResponse.wrap(wicketTester.getResponse());
    TesterAsyncSupport asyncSupport = new TesterAsyncSupport();
    atmosphereResource.initialize(broadcaster.getApplicationConfig(), broadcaster, atmosphereRequest, atmosphereResponse,
        asyncSupport, new AtmosphereHandlerAdapter());
View Full Code Here

  @Override
  public BroadcastAction filter(AtmosphereResource r, Object message, Object originalMessage)
  {

    AtmosphereRequest request = r.getRequest();
    if ("true".equalsIgnoreCase(request.getHeader(X_ATMOSPHERE_TRACKMESSAGESIZE)) &&
      message != null && String.class.isAssignableFrom(message.getClass()))
    {

      String msg = message.toString();
      msg = msg.length() + "<|msg|>" + msg;
View Full Code Here

  @Override
  public void onSuspend(AtmosphereResourceEvent event)
  {
    if (log.isDebugEnabled())
    {
      AtmosphereRequest atmosphereRequest = event.getResource().getRequest();
      String transport = atmosphereRequest.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT);
      log.debug(String.format("Suspending the %s response from ip %s:%s", transport == null
        ? "websocket" : transport, atmosphereRequest.getRemoteAddr(), atmosphereRequest.getRemotePort()));
    }
  }
View Full Code Here

  @Override
  public void onResume(AtmosphereResourceEvent event)
  {
    if (log.isDebugEnabled())
    {
      AtmosphereRequest atmosphereRequest = event.getResource().getRequest();
      String transport = atmosphereRequest.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT);
      log.debug(String.format("Resuming the %s response from ip %s:%s", transport == null
        ? "websocket" : transport, atmosphereRequest.getRemoteAddr(), atmosphereRequest.getRemotePort()));
    }
    EventBus eventBus = findEventBus();
    if (eventBus.isWantAtmosphereNotifications())
    {
      eventBus.post(new AtmosphereInternalEvent(AtmosphereInternalEvent.Type.Resume, event));
View Full Code Here

  @Override
  public void onDisconnect(AtmosphereResourceEvent event)
  {
    if (log.isDebugEnabled())
    {
      AtmosphereRequest atmosphereRequest = event.getResource().getRequest();
      String transport = atmosphereRequest.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT);
      log.debug(String.format("%s connection dropped from ip %s:%s", transport == null
        ? "websocket" : transport, atmosphereRequest.getRemoteAddr(), atmosphereRequest.getRemotePort()));
    }
    // It is possible that the application has already been destroyed, in which case
    // unregistration is no longer needed
    EventBus eventBus = findEventBus();
    if (Application.get(applicationKey) != null)
View Full Code Here

    }

    @Override
    public Action inspect(AtmosphereResource resource) {

      AtmosphereRequest request = resource.getRequest();

      try {
        // Find the first context parameter
        String path = request.getPathInfo();

        if (path == null || path.isEmpty())
         return Action.CONTINUE;

        if (path.startsWith("/")) {
View Full Code Here

     *            true if this is a websocket message (as opposed to a HTTP
     *            request)
     */
    private void callWithUi(final AtmosphereResource resource,
            final PushEventCallback callback, boolean websocket) {
        AtmosphereRequest req = resource.getRequest();
        VaadinServletRequest vaadinRequest = new VaadinServletRequest(req,
                service);
        VaadinSession session = null;

        if (websocket) {
View Full Code Here

TOP

Related Classes of org.atmosphere.cpr.AtmosphereRequest$IS

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.