Package org.xlightweb

Examples of org.xlightweb.HttpResponseHeader


 
  private static final class RequestHandler2 implements IHttpRequestHandler {
   
    public void onRequest(IHttpExchange exchange) throws IOException {
     
      BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"));
      bodyDataSink.write("it works");
      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

       
        if (request.getRequestURI().endsWith("/RegisterClient")) {
          BlockingBodyDataSource inChannel = request.getBlockingBody();
          inChannel.setReceiveTimeoutSec(1);
         
          BodyDataSink outChannel = exchange.send(new HttpResponseHeader(200, "text/plain"));
          outChannel.setFlushmode(FlushMode.ASYNC);
          outChannel.flush();
         
          register(new Link(outChannel, inChannel));
        } else {
View Full Code Here

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

        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 {
 
      BodyDataSink bodyDataSink = null;
     
      if (isChunkedMode) {
        bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"));
      } else {
        bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"), length);
      }
     
      dataWriter = new DataWriter(bodyDataSink, length / 10, 10);
      new Thread(dataWriter).start();
    }
View Full Code Here

  private static final class ServerHandler2 implements IHttpRequestHandler {
   
    public void onRequest(IHttpExchange exchange) throws IOException {
     
   
      BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"), 1000);
      bodyDataSink.setFlushmode(FlushMode.ASYNC);
      bodyDataSink.write(QAUtil.generateByteArray(100));
      bodyDataSink.close();
     
   
View Full Code Here

 
  private static final class RequestHandler2 implements IHttpRequestHandler {
   
    public void onRequest(IHttpExchange exchange) throws IOException {
     
      BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"));
      bodyDataSink.write("it works");
      bodyDataSink.close();
    }
View Full Code Here

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

        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

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.