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

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


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

    }
View Full Code Here


            while (it.hasNext()) {
                String headerValue = tc.convertTo(String.class, it.next());
                if (headerValue != null && headerFilterStrategy != null
                        && !headerFilterStrategy.applyFilterToCamelHeaders(key, headerValue, message.getExchange())) {
                    LOG.trace("HTTP-Header: {}={}", key, headerValue);
                    response.addHeader(key, headerValue);
                }
            }
        }

        Object body = message.getBody();
View Full Code Here

      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

  public void write() throws Exception {
    // Build the response object.
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
View Full Code Here

    // Build the response object.
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
    if (ConnectionLogger.isEnabledFull()) {
View Full Code Here

    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
    if (ConnectionLogger.isEnabledFull()) {
      ConnectionLogger.logWriteBuffer(this.getClass().getSimpleName(), ((InetSocketAddress) this.channel.getRemoteAddress())
View Full Code Here

  public void write() throws Exception {
    // Build the response object.
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader("Access-Control-Allow-Origin", "*");
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
View Full Code Here

    // Build the response object.
    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader("Access-Control-Allow-Origin", "*");
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
View Full Code Here

    HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader("Access-Control-Allow-Origin", "*");
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
    if (ConnectionLogger.isEnabledFull()) {
View Full Code Here

    ChannelBuffer buffer = getBuffer();
    httpResponse.setContent(buffer);
    httpResponse.addHeader("Access-Control-Allow-Origin", "*");
    httpResponse.addHeader(HttpHeaders.Names.CONTENT_TYPE, scmp.getBodyType().getMimeType());
    httpResponse.addHeader(HttpHeaders.Names.CACHE_CONTROL, HttpHeaders.Values.NO_CACHE);
    httpResponse.addHeader(HttpHeaders.Names.PRAGMA, HttpHeaders.Values.NO_CACHE);
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
    // Write the response.
    channel.write(httpResponse);
    if (ConnectionLogger.isEnabledFull()) {
      ConnectionLogger.logWriteBuffer(this.getClass().getSimpleName(), ((InetSocketAddress) this.channel.getRemoteAddress())
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.