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

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


        if (!found) {
            sendError(ctx, NOT_FOUND, e);
            return;
        }
        request.addHeader(SERVICED, "true");

        // Cache Validation
        String ifModifiedSince = request.getHeader(IF_MODIFIED_SINCE);
        if (file != null && ifModifiedSince != null && ifModifiedSince.length() != 0) {
            SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US);
View Full Code Here


        String path = url.getPath();
        if (url.getQuery() != null && url.getQuery().length() > 0) {
            path = url.getPath() + "?" + url.getQuery();
        }
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.addHeader(Names.UPGRADE, Values.WEBSOCKET);
        request.addHeader(Names.CONNECTION, Values.UPGRADE);
        request.addHeader(Names.HOST, url.getHost());
        request.addHeader(Names.ORIGIN, "http://" + url.getHost());

        e.getChannel().write(request);
View Full Code Here

        if (url.getQuery() != null && url.getQuery().length() > 0) {
            path = url.getPath() + "?" + url.getQuery();
        }
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.addHeader(Names.UPGRADE, Values.WEBSOCKET);
        request.addHeader(Names.CONNECTION, Values.UPGRADE);
        request.addHeader(Names.HOST, url.getHost());
        request.addHeader(Names.ORIGIN, "http://" + url.getHost());

        e.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocketFrameEncoder());
View Full Code Here

            path = url.getPath() + "?" + url.getQuery();
        }
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.addHeader(Names.UPGRADE, Values.WEBSOCKET);
        request.addHeader(Names.CONNECTION, Values.UPGRADE);
        request.addHeader(Names.HOST, url.getHost());
        request.addHeader(Names.ORIGIN, "http://" + url.getHost());

        e.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocketFrameEncoder());
        channel = e.getChannel();
View Full Code Here

        }
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.addHeader(Names.UPGRADE, Values.WEBSOCKET);
        request.addHeader(Names.CONNECTION, Values.UPGRADE);
        request.addHeader(Names.HOST, url.getHost());
        request.addHeader(Names.ORIGIN, "http://" + url.getHost());

        e.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocketFrameEncoder());
        channel = e.getChannel();
    }
View Full Code Here

        starttimestamp = endtimestamp;
    }
   
    buffer = ChannelBuffers.copiedBuffer(strLine,
                 Charset.defaultCharset());
    request.addHeader(
          org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH,
          buffer.readableBytes());
    request.setContent(buffer);
    channel.write(request).awaitUninterruptibly().getChannel()
        .getCloseFuture().awaitUninterruptibly();
View Full Code Here

      .awaitUninterruptibly().getChannel();
  request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST,
           "/init");

  buffer = ChannelBuffers.copiedBuffer(" ", Charset.defaultCharset());
  request.addHeader(
        org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH,
        buffer.readableBytes());
  request.setContent(buffer);
  channel.write(request).awaitUninterruptibly().getChannel()
      .getCloseFuture().awaitUninterruptibly();
View Full Code Here

          .awaitUninterruptibly().getChannel();
      request = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
          HttpMethod.POST, "/insert");
      buffer = ChannelBuffers.copiedBuffer(content,
          Charset.defaultCharset());
      request.addHeader(
          org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH,
          buffer.readableBytes());
      request.setContent(buffer);
      channel.write(request).awaitUninterruptibly().getChannel()
          .getCloseFuture().awaitUninterruptibly();
View Full Code Here

                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);
                    request.addHeader(key, headerValue);
                }
            }
        }

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

                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);
                    request.addHeader(key, headerValue);
                }
            }
        }

        Object body = message.getBody();
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.