Examples of HttpHeader


Examples of rabbit.http.HttpHeader

    private void updateRange (CacheEntry<HttpHeader, HttpHeader> old,
            HttpHeader response,
            PartialCacher pc,
            Cache<HttpHeader, HttpHeader> cache) { 
  HttpHeader oldRequest = old.getKey ();
  HttpHeader oldResponse = old.getDataHook (cache);
  String cr = oldResponse.getHeader ("Content-Range");
  if (cr == null) {
      String cl = oldResponse.getHeader ("Content-Length");
      if (cl != null) {
    long size = Long.parseLong (cl);
    cr = "bytes 0-" + (size - 1) + "/" + size;
      }
  }
  ContentRangeParser crp = new ContentRangeParser (cr, getLogger ());
  if (crp.isValid ()) {
      long start = crp.getStart ();
      long end = crp.getEnd ();
      long total = crp.getTotal ();
      String t = total < 0 ? "*" : Long.toString (total);
      if (end == pc.getStart () - 1) {
    oldRequest.setHeader ("Range",
              "bytes=" + start + "-" + end);
    oldResponse.setHeader ("Content-Range",
               "bytes " + start + "-" +
               pc.getEnd () + "/" + t);
      } else {
    oldRequest.addHeader ("Range",
              "bytes=" + start + "-" + end);
    oldResponse.addHeader ("Content-Range",
               "bytes " + start + "-" +
               pc.getEnd () + "/" + t);
      }
      cache.entryChanged (old, oldRequest, oldResponse);
  }
View Full Code Here

Examples of rabbit.http.HttpHeader

      do404 (filename.substring (7));
      return;
  }

  // TODO: check etag/if-modified-since and handle it.
  HttpHeader response = con.getHttpGenerator ().getHeader ();
  setMime (filename, response);

  length = fle.length ();
  response.setHeader ("Content-Length", Long.toString (length));
  con.setContentLength (response.getHeader ("Content-Length"));
  Date lm = new Date (fle.lastModified () -
          con.getProxy ().getOffset ());
  response.setHeader ("Last-Modified",
          HttpDateParser.getDateString (lm))
  try {
      fis = new FileInputStream (filename);
  } catch (IOException e) {
      throw (new IllegalArgumentException ("Could not open file: '" +
View Full Code Here

Examples of rabbit.http.HttpHeader

      response.setHeader ("Content-type", "text/plain");
    }

    private void do404 (String filename)
  throws IOException {
  HttpHeader response = con.getHttpGenerator ().get404 (filename);
  sendHeader (response);
    }
View Full Code Here

Examples of rabbit.http.HttpHeader

  }
    }
   
    private void handleFailedRequestRead (Throwable t) {
  if (t instanceof RequestLineTooLongException) {
      HttpHeader err = getHttpGenerator ().get414 ();
      sendAndClose (err);
  } else {     
      getLogger ().logInfo ("Exception when reading request: " +
          getStackTrace (t));
      closeDown ();
View Full Code Here

Examples of stanfordlogic.network.RequestHandler.HttpHeader

            throws Exception
    {
        LineInputStream input = new LineInputStream(socket.getInputStream());

        // The first thing is to read the header from the socket.
        HttpHeader header = readHeader(input);
        // HttpHeader header = readHeader( reader );

        // Now parse the content, only reading as much as contentLength
        InputStream contentInput;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.