Package org.xlightweb

Examples of org.xlightweb.HttpResponseHeader


        IHttpResponseHandler respHdl = new IHttpResponseHandler() {
       
          public void onResponse(IHttpResponse response) throws IOException {
           
            BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"), 9);
            bodyDataSink.write("Hello");
            QAUtil.sleep(200);
            bodyDataSink.write(" You");
            bodyDataSink.close();         
          }
View Full Code Here


    public void onRequest(IHttpExchange exchange) throws IOException {
     
      String filename = exchange.getRequest().getRequestURI();
     
      RandomAccessFile raf = new RandomAccessFile(filename, "r");
            HttpResponseHeader header = new HttpResponseHeader(200);
            header.addHeader("x-length", Long.toString(raf.length()));
            BodyDataSink outChannel = exchange.send(header, (int) raf.length());

            AsyncWriter asyncWriter = new AsyncWriter(outChannel, raf);
            asyncWriter.onWritten(0);
    }
View Full Code Here

                    @Override
                    public void run() {
                        cancel();
                       
                        if (!is100ResponseNotified) {
                            HttpResponseHeader header = new HttpResponseHeader(100);
                            header.setReason("Continue (100-continue response timeout)");
                            header.setAttribute(TIMEOUT_100_CONTINUE_RESPONSE, true);
                           
                            LOG.warning("100-continue timeout reached (" + DataConverter.toFormatedDuration(CONTINUE_TIMEOUT_MILLIS) + "). Generating local 100-continue response");
                            callResponseHandler(new HttpResponse(header));
                        }
                    }
View Full Code Here

    do {
      QAUtil.sleep(100);
    } while (reqHdl.getExchange() == null);
   
    IHttpExchange exchange = reqHdl.getExchange();
    BodyDataSink dataSink = exchange.send(new HttpResponseHeader(200, "text/plain"));
   
    QAUtil.sleep(1000);
    Assert.assertNull(respHdl.getResponse());
   
    dataSink.write("test");
View Full Code Here

     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException {
             
              BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain"), 10);
              ds.flush();
              ds.write("1234567890");
              ds.close();
            }           
        };  
View Full Code Here

     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException {
             
              BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain"));
              ds.write("1234567890");
              ds.close();
            }           
        };  
       
View Full Code Here

     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException {
             
              BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain"));
             
              for (int i = 0; i < 100; i++) {
                ds.write("1234567890");
              }
             
View Full Code Here

     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException {
             
              BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain"));
              ds.flush();
              ds.write("1234567890");
              ds.close();
            }           
        };  
View Full Code Here

     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException {
             
              BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain"));
              ds.setFlushmode(FlushMode.ASYNC);
             
              for (int i = 0; i < 100; i++) {
                ds.write("1234567890");
              }
View Full Code Here

     
        IHttpRequestHandler reqHdl = new IHttpRequestHandler() {
           
            public void onRequest(IHttpExchange exchange) throws IOException {
             
              BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain"));
              ds.setFlushmode(FlushMode.ASYNC);
              ds.setAutoflush(false);
             
              for (int i = 0; i < 100; i++) {
                ds.write("1234567890");
View Full Code Here

TOP

Related Classes of org.xlightweb.HttpResponseHeader

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.