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

Examples of org.jboss.netty.handler.codec.http.DefaultHttpRequest.headers()


        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.headers().add(Names.UPGRADE, Values.WEBSOCKET);
        request.headers().add(Names.CONNECTION, Values.UPGRADE);
        request.headers().add(Names.HOST, url.getHost());
        request.headers().add(Names.ORIGIN, "http://" + url.getHost());
        event.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder());
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.headers().add(Names.UPGRADE, Values.WEBSOCKET);
        request.headers().add(Names.CONNECTION, Values.UPGRADE);
        request.headers().add(Names.HOST, url.getHost());
        request.headers().add(Names.ORIGIN, "http://" + url.getHost());
        event.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder());
        this.channel = event.getChannel();
View Full Code Here

            path = url.getPath() + "?" + url.getQuery();
        }
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.headers().add(Names.UPGRADE, Values.WEBSOCKET);
        request.headers().add(Names.CONNECTION, Values.UPGRADE);
        request.headers().add(Names.HOST, url.getHost());
        request.headers().add(Names.ORIGIN, "http://" + url.getHost());
        event.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder());
        this.channel = event.getChannel();
    }
View Full Code Here

        }
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
        request.headers().add(Names.UPGRADE, Values.WEBSOCKET);
        request.headers().add(Names.CONNECTION, Values.UPGRADE);
        request.headers().add(Names.HOST, url.getHost());
        request.headers().add(Names.ORIGIN, "http://" + url.getHost());
        event.getChannel().write(request);
        ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder());
        this.channel = event.getChannel();
    }
View Full Code Here

 
  @Test
  public void httpCORSIgnored() {
    final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
        HttpMethod.GET, "/api/v1/version");
    req.headers().add(HttpHeaders.ORIGIN, "42.com");

    handleHttpRpc(req,
      new Answer<ChannelFuture>() {
        public ChannelFuture answer(final InvocationOnMock args)
          throws Throwable {
View Full Code Here

 
  @Test
  public void httpCORSPublicSimple() {
    final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
        HttpMethod.GET, "/api/v1/version");
    req.headers().add(HttpHeaders.ORIGIN, "42.com");

    handleHttpRpc(req,
      new Answer<ChannelFuture>() {
        public ChannelFuture answer(final InvocationOnMock args)
          throws Throwable {
View Full Code Here

 
  @Test
  public void httpCORSSpecificSimple() {
    final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
        HttpMethod.GET, "/api/v1/version");
    req.headers().add(HttpHeaders.ORIGIN, "42.com");

    handleHttpRpc(req,
      new Answer<ChannelFuture>() {
        public ChannelFuture answer(final InvocationOnMock args)
          throws Throwable {
View Full Code Here

 
  @Test
  public void httpCORSNotAllowedSimple() {
    final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
        HttpMethod.GET, "/api/v1/version");
    req.headers().add(HttpHeaders.ORIGIN, "42.com");

    handleHttpRpc(req,
      new Answer<ChannelFuture>() {
        public ChannelFuture answer(final InvocationOnMock args)
          throws Throwable {
View Full Code Here

 
  @Test
  public void httpOptionsCORSNotConfigured() {
    final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
        HttpMethod.OPTIONS, "/api/v1/version");
    req.headers().add(HttpHeaders.ORIGIN, "42.com");
   
    handleHttpRpc(req,
      new Answer<ChannelFuture>() {
        public ChannelFuture answer(final InvocationOnMock args)
          throws Throwable {
View Full Code Here

 
  @Test
  public void httpOptionsCORSPublic() {
    final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
        HttpMethod.OPTIONS, "/api/v1/version");
    req.headers().add(HttpHeaders.ORIGIN, "42.com");
   
    handleHttpRpc(req,
      new Answer<ChannelFuture>() {
        public ChannelFuture answer(final InvocationOnMock args)
          throws Throwable {
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.