Package org.jboss.netty.handler.codec.http

Examples of org.jboss.netty.handler.codec.http.HttpResponse.addHeader()


      if (request.getMethod() == HttpMethod.OPTIONS) {
        // Mimic SPNEGO authentication
        HttpResponse response = new DefaultHttpResponse(HTTP_1_1,
            HttpResponseStatus.OK);
        response.addHeader("Set-Cookie", "hadoop-auth=1234");
        e.getChannel().write(response).addListener(ChannelFutureListener.CLOSE);
      } else if (request.getMethod() != GET) {
        e.getChannel().close();
      }
      UnmodifiableIterator<Map.Entry<String, Handler>> iter = routes.entrySet()
View Full Code Here


    // Create the WebSocket handshake response.
        HttpResponse res = new DefaultHttpResponse(
                HTTP_1_1,
                new HttpResponseStatus(101, "Web Socket Protocol Handshake"));
        res.addHeader(Names.UPGRADE, WEBSOCKET);
        res.addHeader(CONNECTION, Values.UPGRADE);

        // Fill in the headers and contents depending on handshake method.
        if (request.containsHeader(SEC_WEBSOCKET_KEY1) &&
            request.containsHeader(SEC_WEBSOCKET_KEY2)) {
            // New handshake method with a challenge:
View Full Code Here

        // Fill in the headers and contents depending on handshake method.
        if (request.containsHeader(SEC_WEBSOCKET_KEY1) &&
            request.containsHeader(SEC_WEBSOCKET_KEY2)) {
            // New handshake method with a challenge:
            res.addHeader(SEC_WEBSOCKET_ORIGIN, request.getHeader(ORIGIN));
            res.addHeader(SEC_WEBSOCKET_LOCATION, getWebSocketLocation(request));
            String protocol = request.getHeader(SEC_WEBSOCKET_PROTOCOL);
            if (protocol != null) {
                res.addHeader(SEC_WEBSOCKET_PROTOCOL, protocol);
            }
View Full Code Here

        // Fill in the headers and contents depending on handshake method.
        if (request.containsHeader(SEC_WEBSOCKET_KEY1) &&
            request.containsHeader(SEC_WEBSOCKET_KEY2)) {
            // New handshake method with a challenge:
            res.addHeader(SEC_WEBSOCKET_ORIGIN, request.getHeader(ORIGIN));
            res.addHeader(SEC_WEBSOCKET_LOCATION, getWebSocketLocation(request));
            String protocol = request.getHeader(SEC_WEBSOCKET_PROTOCOL);
            if (protocol != null) {
                res.addHeader(SEC_WEBSOCKET_PROTOCOL, protocol);
            }
View Full Code Here

            // New handshake method with a challenge:
            res.addHeader(SEC_WEBSOCKET_ORIGIN, request.getHeader(ORIGIN));
            res.addHeader(SEC_WEBSOCKET_LOCATION, getWebSocketLocation(request));
            String protocol = request.getHeader(SEC_WEBSOCKET_PROTOCOL);
            if (protocol != null) {
                res.addHeader(SEC_WEBSOCKET_PROTOCOL, protocol);
            }

            // Calculate the answer of the challenge.
            String key1 = request.getHeader(SEC_WEBSOCKET_KEY1);
            String key2 = request.getHeader(SEC_WEBSOCKET_KEY2);
View Full Code Here

        log.error("Caught", e); //should never ever happen
      }
          
        } else {
            // Old handshake method with no challenge:
            res.addHeader(WEBSOCKET_ORIGIN, request.getHeader(ORIGIN));
            res.addHeader(WEBSOCKET_LOCATION, getWebSocketLocation(request));
            String protocol = request.getHeader(WEBSOCKET_PROTOCOL);
            if (protocol != null) {
                res.addHeader(WEBSOCKET_PROTOCOL, protocol);
            }
View Full Code Here

      }
          
        } else {
            // Old handshake method with no challenge:
            res.addHeader(WEBSOCKET_ORIGIN, request.getHeader(ORIGIN));
            res.addHeader(WEBSOCKET_LOCATION, getWebSocketLocation(request));
            String protocol = request.getHeader(WEBSOCKET_PROTOCOL);
            if (protocol != null) {
                res.addHeader(WEBSOCKET_PROTOCOL, protocol);
            }
        }
View Full Code Here

            // Old handshake method with no challenge:
            res.addHeader(WEBSOCKET_ORIGIN, request.getHeader(ORIGIN));
            res.addHeader(WEBSOCKET_LOCATION, getWebSocketLocation(request));
            String protocol = request.getHeader(WEBSOCKET_PROTOCOL);
            if (protocol != null) {
                res.addHeader(WEBSOCKET_PROTOCOL, protocol);
            }
        }

        // Upgrade the connection and send the handshake response.
        ChannelPipeline p = this.getChannelConnection().getChannel().getPipeline();
View Full Code Here

   * @param request
   */
  public static HttpResponse copyHeaders(HttpResponse response) {
    HttpResponse copy = new DefaultHttpResponse(response.getProtocolVersion(), response.getStatus());
    for (String h : response.getHeaderNames()) {
      copy.addHeader(h, response.getHeader(h));
    }
    return copy;
  }
 
  /**
 
View Full Code Here

     */
    // Create the WebSocket handshake response.
        HttpResponse res = new DefaultHttpResponse(
                HTTP_1_1,
                new HttpResponseStatus(101, "Web Socket Protocol Handshake"));
        res.addHeader(Names.UPGRADE, WEBSOCKET);
        res.addHeader(CONNECTION, Values.UPGRADE);

        // Fill in the headers and contents depending on handshake method.
        if (request.containsHeader(SEC_WEBSOCKET_KEY1) &&
            request.containsHeader(SEC_WEBSOCKET_KEY2)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.