Package org.xlightweb

Examples of org.xlightweb.HttpResponseHeader


     
        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

       
        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

    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, BadMessageException {
            int delay = exchange.getRequest().getIntParameter("delay", 0);
           
            BodyDataSink ds = exchange.send(new HttpResponseHeader(200, "text/plain; charset=ISO-8859-1"), 2);
            ds.flush();
            QAUtil.sleep(delay);
           
            ds.write("OK");
            ds.close();
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

    @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

    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

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.