Examples of IHttpResponseHeader


Examples of org.xlightweb.IHttpResponseHeader

      if (deregisterHandle) {
        resumeMessageReceiving();
      }
     
     
      IHttpResponseHeader responseHeader = response.getResponseHeader();
     
      enhanceResponseHeader(responseHeader);
     
      // body less request?
      if (response.getNonBlockingBody() == null) {
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

    }
   
    public void register(HttpClientConnection con, final IHttpResponse response) {
      isHeaderReceived = true;

      IHttpResponseHeader responseHeader = response.getResponseHeader();
      responseHeaderInfo = responseHeader.getStatus() + " " + responseHeader.getReason();
      if (responseHeader.containsHeader("connection")) {
        responseHeaderInfo = responseHeaderInfo + " (connection: " + responseHeader.getHeader("connection") + ")";
      }
     
     
      if (response.hasBody()) {
        try {
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

   
    public void register(HttpClientConnection con, final IHttpResponse response) {
        this.con = con;
      isHeaderReceived = true;

      IHttpResponseHeader responseHeader = response.getResponseHeader();
      responseHeaderInfo = responseHeader.getStatus() + " " + responseHeader.getReason();
      if (responseHeader.containsHeader("connection")) {
        responseHeaderInfo = responseHeaderInfo + " (connection: " + responseHeader.getHeader("connection") + ")";
      }
     
     
      if (response.hasBody()) {
        try {
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

        }
  }

   
    private static boolean isErrorStatusCodeRecevied(ProtocolException pe) {
        IHttpResponseHeader header = (IHttpResponseHeader) HttpClientConnection.getReceviedHeader(pe);
        if ((header != null) && (header.getStatus() >= 400)) {
            return true;
        }
       
        return false;
    }
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

  
 
  private BodyDataSink sendResponseMessage(IHttpResponse response) throws IOException {

    try
      IHttpResponseHeader responseHeader = response.getResponseHeader();
     
      if (response.getStatus() == 100) {
                writeMessageSilence(response);
                return null;
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

  
 
  private BodyDataSink sendResponseMessage(IHttpResponse response) throws IOException {

    try
      IHttpResponseHeader responseHeader = response.getResponseHeader();
     
      enhanceResponseHeader(responseHeader);
     
      // body less response?
      if (response.getNonBlockingBody() == null) {
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

    }
   
    public void register(HttpClientConnection con, final IHttpResponse response) {
      isHeaderReceived = true;

      IHttpResponseHeader responseHeader = response.getResponseHeader();
      responseHeaderInfo = responseHeader.getStatus() + " " + responseHeader.getReason();
      if (responseHeader.containsHeader("connection")) {
        responseHeaderInfo = responseHeaderInfo + " (connection: " + responseHeader.getHeader("connection") + ")";
      }
     
     
      if (response.hasBody()) {
        try {
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

        @InvokeOn(InvokeOn.HEADER_RECEIVED)
        public void onResponse(IHttpResponse response) throws IOException {

            // is response cacheable?
            if (HttpCache.isCacheable(response, isSharedCache())) {
                final IHttpResponseHeader responseHeader = response.getResponseHeader();
               
                if (response.hasBody()) {
                    final NonBlockingBodyDataSource dataSource = response.getNonBlockingBody();
                    BodyDataSink dataSink = exchange.send(responseHeader);

                    BodyForwarder bodyForwarder = new BodyForwarder(dataSource, dataSink) {

                        private final List<ByteBuffer> responseBodyCopy = new ArrayList<ByteBuffer>();
                       
                        @Override
                        public void onData(NonBlockingBodyDataSource bodyDataSource, BodyDataSink bodyDataSink) throws BufferUnderflowException, IOException {
                            ByteBuffer[] data = bodyDataSource.readByteBufferByLength(bodyDataSource.available());
                           
                            for (ByteBuffer buf : data) {
                                responseBodyCopy.add(buf.duplicate());
                            }
                           
                            bodyDataSink.write(data);
                        }
                       
                       
                        @Override
                        public void onComplete() {
                            try {
                                IHttpResponse responseCopy = new HttpResponse(responseHeader.copy(), responseBodyCopy);
                                interaction.setResponse(responseCopy);
                               
                            } catch (IOException ioe) {
                                if (LOG.isLoggable(Level.FINE)) {
                                    LOG.fine("error occured by creating/registering cachedResponse " + ioe.toString());
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

  
 
  private BodyDataSink sendResponseMessage(IHttpResponse response) throws IOException {

    try
      IHttpResponseHeader responseHeader = response.getResponseHeader();
     
      enhanceResponseHeader(responseHeader);
     
      // does the message contain a body?
      if (response.hasBody()) {
View Full Code Here

Examples of org.xlightweb.IHttpResponseHeader

        }
  }

   
    private static boolean isErrorStatusCodeRecevied(ProtocolException pe) {
        IHttpResponseHeader header = (IHttpResponseHeader) HttpClientConnection.getReceivedHeader(pe);
        if ((header != null) && (header.getStatus() >= 400)) {
            return true;
        }
       
        return false;
    }
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.