Package org.w3c.www.http

Examples of org.w3c.www.http.HttpEntityTag


     * at all (eg because the resource or the request didn't support it).
     */

    public int checkIfMatch(Request request, HttpEntityTag etag) {
  if (fresource != null) {
      HttpEntityTag tags[] = request.getIfMatch();
      if ( tags != null ) {
    // Good, real validators in use:
    if ( etag != null ) {
        // Note: if etag is null this means that the resource has
        // changed and has not been even emited since then...
        for (int i = 0 ; i < tags.length ; i++) {
      HttpEntityTag t = tags[i];
      if (t.getTag().equals(etag.getTag())) {
          if (t.isWeak() || etag.isWeak()) {
        return COND_WEAK;
          } else {
        return COND_OK;
          }
      }
View Full Code Here


     */

    public int checkIfNoneMatch(Request request, HttpEntityTag etag) {
  if (fresource != null) {
      // Check for an If-None-Match conditional:
      HttpEntityTag tags[] = request.getIfNoneMatch();
      if ( tags != null ) {
    if ( etag == null ) {
        return COND_OK;
    }
    int status = COND_OK;
    for (int i = 0 ; i < tags.length ; i++) {
        HttpEntityTag t = tags[i];
        if (t.getTag().equals(etag.getTag())) {
      if (t.isWeak() || etag.isWeak()) {
          status = COND_WEAK;
      } else {
          return COND_FAILED;
      }
        }
        if (t.getTag().equals("*")) {
      if (fresource != null) {
          File f = fresource.getFile();
          if (f.exists()) {
        return COND_FAILED;
          }
View Full Code Here

      } catch (MimeTypeFormatException ex) {
    // not a valid mime type... maybe something else, do not care
      }
  }
  boolean xmpOnly = negotiate(request);
  HttpEntityTag etag = null;
  if (xmpOnly)
      etag = getXMPETag();
  else
      etag = getETag();
  // Check validators:
View Full Code Here

      } catch (MimeTypeFormatException ex) {
    // not a valid mime type... maybe something else, do not care
      }
  }
  boolean xmpOnly = negotiate(request);
  HttpEntityTag etag = null;
  if (xmpOnly)
      etag = getXMPETag();
  else
      etag = getETag();
  // Check validators:
View Full Code Here

  if ( ! getPutableFlag() ) {
      Reply error = request.makeReply(HTTP.NOT_ALLOWED) ;
      error.setContent("Method PUT not allowed.") ;
      throw new HTTPException (error) ;
  }
  HttpEntityTag etag = getXMPETag();
  // no IfMatch, or no matching ETag, maybe a PUT on the image
  int cim = checkIfMatch(request, etag);
  if ((request.getIfMatch() == null) ||
      (cim == COND_FAILED) || (cim == COND_WEAK)) {
      return super.putFileResource(request);
View Full Code Here

  }
  return 0;
    }

    protected boolean matchETag(HttpEntityTag retag) {
  HttpEntityTag etag = getETag();
  if ( etag != null ) {
      return etag.getTag().equals(retag.getTag());
  }
  return false;
    }
View Full Code Here

            String.valueOf(length));
  }
    }

    protected void addETag(DAVProperties props) {
  HttpEntityTag tag = getETag();
  if (tag != null) {
      props.addProperty(DAVNode.GETETAG_NODE, tag.getTag());
  }
    }
View Full Code Here

     * checked, but failed; <code>COND_OK</code> of condition was checked
     * and succeeded, <strong>0</strong> otherwise.
     */

    public int checkIfMatch(Request request) {
  HttpEntityTag tags[] = request.getIfMatch();
  if ( tags != null ) {
      HttpEntityTag etag = getHETag();
      // Good, real validators in use:
      if ( etag != null ) {
    for (int i = 0 ; i < tags.length ; i++) {
        HttpEntityTag t = tags[i];
        if (t.getTag().equals(etag.getTag())) {
      if (t.isWeak() || etag.isWeak()) {
          return COND_WEAK;
      } else {
          return COND_OK;
      }
        }
View Full Code Here

     * and succeeded, <strong>0</strong> otherwise.
     */

    public int checkIfNoneMatch(Request request) {
  String setag = getETag();
  HttpEntityTag etag = null;
  // Check for an If-None-Match conditional:
  HttpEntityTag tags[] = request.getIfNoneMatch();
  if (setag != null) {
      etag = HttpFactory.parseETag(getETag());
  }
  if ( tags != null ) {
      if ( etag == null ) {
    return COND_OK;
      }
      int status = COND_OK;
      for (int i = 0 ; i < tags.length ; i++) {
    HttpEntityTag t = tags[i];
    if (t.getTag().equals(etag.getTag())) {
//        if (t.isWeak() && !etag.isWeak()) {
        if (t.isWeak() || etag.isWeak()) {
      status = COND_WEAK;
        } else {
      return COND_FAILED;
        }
    }
    if (t.getTag().equals("*")) {
        return COND_FAILED;
    }
      }
      return status;
  }
View Full Code Here

     * handle a range request, according to the first range or the
     * request FIXME we should handle all the ranges at some point...
     */
    protected Reply handleRangeRequest(Request request, HttpRange r) {
  // Should we check against a IfRange header ?
  HttpEntityTag t = request.getIfRange();
  if ( t != null ) {
      if (t.isWeak() || ! t.getTag().equals(getHETag().getTag()))
    return null;
  }
  // Check the range:
  int cl = getContentLength();
  int fb = r.getFirstPosition();
View Full Code Here

TOP

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

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.