Package org.w3c.www.http

Examples of org.w3c.www.http.HttpContentRange


  int cl = getContentLength();
  int fb = r.getFirstPosition();
  int lb = r.getLastPosition();
  int sz;
  if (fb > cl-1) { // first byte already out of range
      HttpContentRange cr = HttpFactory.makeContentRange("bytes", 0,
                     cl - 1, cl);
      Reply rr;
      rr = request.makeReply(HTTP.REQUESTED_RANGE_NOT_SATISFIABLE);
      rr.setContentLength(-1);
      rr.setHeaderValue(rr.H_CONTENT_RANGE, cr);
      rr.setContentMD5(null);
      return rr;
  }
  if ((fb < 0) && (lb >= 0)) { // ex: bytes=-20 final 20 bytes
      if (lb >= cl)   // cut the end
    lb = cl;
      sz = lb;
      fb = cl - lb;
      lb = cl - 1;
  } else if (lb < 0) {  // ex: bytes=10- the last size - 10
      lb = cl-1;
      sz = lb-fb+1;
  } else {              // ex: bytes=10-20
      if (lb >= cl// cut the end
    lb = cl-1;
      sz = lb-fb+1;
  }
  if ((fb < 0) || (lb < 0) || (fb <= lb)) {
      HttpContentRange cr = null;
      fb = (fb < 0) ? 0 : fb;
      lb = ((lb > cl) || (lb < 0)) ? cl : lb;
      cr = HttpFactory.makeContentRange("bytes", fb, lb, cl);
      // Emit reply:
      Reply rr = request.makeReply(HTTP.PARTIAL_CONTENT);
View Full Code Here

TOP

Related Classes of org.w3c.www.http.HttpContentRange

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.