Package org.xlightweb

Examples of org.xlightweb.HttpResponseHeader


    public void onRequest(IHttpExchange exchange) throws IOException {
     
      int loops = exchange.getRequest().getIntParameter("loops");
      int waittime = exchange.getRequest().getIntParameter("waittime");
     
      HttpResponseHeader header = new HttpResponseHeader(200, "text/plain");
      BodyDataSink bodyDataSink = exchange.send(header);
     
      for (int i = 0; i < loops; i++) {
        bodyDataSink.write("1234567890");
        QAUtil.sleep(waittime);
View Full Code Here



    public void onRequest(IHttpExchange exchange) throws IOException {

      // send response
      HttpResponseHeader responseHeader = new HttpResponseHeader(200, "text/plain");

      IHttpRequest request = exchange.getRequest();
     
      BodyDataSink bodyDataSink = exchange.send(responseHeader);
      bodyDataSink.write("requestUri=" + request.getRequestURI() + "\r\n");
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

       
        if (request.getRequestURI().endsWith("/RegisterClient")) {
          BodyDataSource inChannel = request.getBody();
          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

    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 BadServerHandler implements IHttpRequestHandler {
   
    public void onRequest(IHttpExchange exchange) throws IOException {
     
      BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"), 1000);
      byte[] data = QAUtil.generateByteArray(100);
      bodyDataSink.write(data);
     
      bodyDataSink.close();
   
View Full Code Here

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

    @SuppressWarnings("unchecked")
    public void onRequest(IHttpExchange exchange) throws IOException {

      // send response
      HttpResponseHeader responseHeader = new HttpResponseHeader(200, "text/plain");


      IHttpRequest request = exchange.getRequest();
     
      HashSet<String> headerSet = new HashSet<String>();
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

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.