Package org.xlightweb

Examples of org.xlightweb.HttpResponse


        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("[" + getId() + "] no handler found (for requested resource). returning error message");
        }
       
        try {
            IHttpResponse response = new HttpResponse(404, "text/html", generateErrorMessageHtml(404, null, getId()));
            callResponseHandler(responseHandler, response);
        } catch (IOException ioe) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("[" + getId() + "] could not send not handle response. " + ioe.toString());
            }
View Full Code Here


        public BodyDataSink send(IHttpResponseHeader header) throws IOException, IllegalStateException {
           
            // return response to caller (request will not be send to remote endpoint)
            BodyDataSink dataSink = newInMemoryBodyDataSink(header.getCharacterEncoding(), executor);
           
            IHttpResponse response = new HttpResponse(header, getDataSourceOfInMemoryBodyDataSink(dataSink));
            send(response);
           
            return dataSink;
        }
View Full Code Here

        public BodyDataSink send(IHttpResponseHeader header, int contentLength) throws IOException, IllegalStateException {
           
            // return response to caller (request will not be send to remote endpoint)
            BodyDataSink dataSink = newInMemoryBodyDataSink(header.getCharacterEncoding(), executor);
           
            IHttpResponse response = new HttpResponse(header, getDataSourceOfInMemoryBodyDataSink(dataSink));
            send(response);
           
            return dataSink;
        }
View Full Code Here

   
   
    private static final class RequestHandler implements IHttpRequestHandler {
       
        public void onRequest(IHttpExchange exchange) throws IOException {
            exchange.send(new HttpResponse(200, "text/plain", "OK"));
        }
View Full Code Here

   

    private static final class RequestHandler implements IHttpRequestHandler {
       
        public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
            exchange.send(new HttpResponse(200, "text/plain", "OK"));
        }
View Full Code Here

      public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
          threadnameRef.set(Thread.currentThread().getName());
          requestRef.set(exchange.getRequest());
         
          if (exchange.getRequest().getRequestURI().startsWith(path)) {
              exchange.send(new HttpResponse(200, "OK"));
             
          } else {
              isForwardedRef.set(true);
              exchange.forward(exchange.getRequest());
          }
View Full Code Here

         
          if (request.getBooleanParameter("isWaitForBody", false)) {
              request.getBody().readString();
         
         
          IHttpResponse response = new HttpResponse(200, "text/plain", "1234567890");
          response.setHeader("Connection", "close");
           
          exchange.send(response);
      }
View Full Code Here

         header.setHeader("Transfer-Encoding", "chunked");
       }
     
       DataSourceSinkPair pair = newBodyDataSourceSinkPair((AbstractHttpConnection) getConnection(), executor, header.getCharacterEncoding());
       
       send(new HttpResponse(header, pair.getBodyDataSource()));
       return pair.getBodyDataSink();
     }
View Full Code Here

       }
         
     
       DataSourceSinkPair pair = newBodyDataSourceSinkPair((AbstractHttpConnection) getConnection(), executor, header.getCharacterEncoding());
       
       send(new HttpResponse(header, pair.getBodyDataSource()));
       return pair.getBodyDataSink();
     }
View Full Code Here

        String id = "";
        IHttpConnection connection = getConnection();
        if (connection != null) {
          id = connection.getId();
        }
        send(new HttpResponse(errorCode, "text/html", HttpClientConnection.generateErrorMessageHtml(errorCode, msg, id)));
      } catch (IOException ioe) {
        if (LOG.isLoggable(Level.FINE)) {
          LOG.fine("could not send error message " + errorCode + " reason " + ioe.toString());
        }
        destroy();
View Full Code Here

TOP

Related Classes of org.xlightweb.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.