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

Examples of org.jboss.netty.handler.codec.http.HttpResponse


      Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
      ChannelPipeline serverPipeline = serverChannel.getPipeline();
      SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

      // verify server gets the /sources request
      HttpResponse sourcesResp = runHappyPathSources(log,
                                                     callback,
                                                     remoteExceptionHandler,
                                                     clientAddr,
                                                     objCapture);
View Full Code Here


    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    //verify server gets the /source request
    HttpResponse sourcesResp =
        runHappyPathSources(log,
                                callback,
                                remoteExceptionHandler,
                                clientAddr,
                                objCapture);
View Full Code Here

    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    //verify server gets the /source request
    HttpResponse sourcesResp =
        runHappyPathSources(log,
                                callback,
                                remoteExceptionHandler,
                                clientAddr,
                                objCapture);
View Full Code Here

    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    //verify server gets the /source request
    HttpResponse sourcesResp =
        runHappyPathSources(log,
                                callback,
                                remoteExceptionHandler,
                                clientAddr,
                                objCapture);
View Full Code Here

    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    //verify server gets the /source request
    HttpResponse sourcesResp =
        runHappyPathSources(log,
                                callback,
                                remoteExceptionHandler,
                                clientAddr,
                                objCapture);
View Full Code Here

    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    //verify server gets the /source request
    HttpResponse sourcesResp =
        runHappyPathSources(log,
                                callback,
                                remoteExceptionHandler,
                                clientAddr,
                                objCapture);
View Full Code Here

    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    //verify server gets the /source request
    HttpResponse sourcesResp =
        runHappyPathSources(log,
                            callback,
                            remoteExceptionHandler,
                            clientAddr,
                            objCapture);
View Full Code Here

    callback.clearLastMsg();
    objCapture.clear();

    //send back some response
    HttpResponse sourcesResp = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
                                                       HttpResponseStatus.OK);
    sourcesResp.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
    sourcesResp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
    HttpChunk body =
        new DefaultHttpChunk(ChannelBuffers.wrappedBuffer("[{\"id\":1,\"name\":\"test.source1\"}]".getBytes(Charset.defaultCharset())));
    NettyTestUtils.sendServerResponses(_dummyServer, clientAddr, sourcesResp, body);

    waitForCallback(callback,
View Full Code Here

        b.deleteCharAt(0);
      }
      b.insert(0, "www/");
      String resourcePath = b.toString();
      LOG.info("HTTP File Server Request [" + resourcePath + "]");
      HttpResponse response = contentCache.get(resourcePath);
      if(response==null) {
        synchronized(contentCache) {
          response = contentCache.get(resourcePath);
          if(response==null) {
            is = classLoader.getResourceAsStream(b.toString());
            if(is.available()==0) {
                    sendError(ctx, NOT_FOUND);
                    return null;       
            }
            baos = new ByteArrayOutputStream(is.available());
            int bt = -1;
            while((bt=is.read())!=-1) {
              baos.write(bt);
            }
            byte[] content = baos.toByteArray();
            response = new DefaultHttpResponse(HTTP_1_1, OK);
                setContentLength(response, content.length);
                setContentTypeHeader(response, resourcePath);
                setDateAndCacheHeaders(response, resourcePath);
                response.setContent(ChannelBuffers.wrappedBuffer(content));
                contentCache.put(resourcePath, response);
          }
        }
      }
          Channel ch = e.getChannel();
View Full Code Here

            sendError(ctx, NOT_FOUND);
            return null;
        }
        long fileLength = raf.length();

        HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
        setContentLength(response, fileLength);
        setContentTypeHeader(response, file.getAbsolutePath());
        setDateAndCacheHeaders(response, file);
       
        Channel ch = e.getChannel();
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.codec.http.HttpResponse

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.