Examples of HttpEntityTag


Examples of org.w3c.www.http.HttpEntityTag

     * @return an instance of HttpEntityTag, or <strong>null</strong> if not
     *    defined.
     */
    public HttpEntityTag getETag() {
  if (etag == null) {
      HttpEntityTag netag = super.getETag();
      if (netag != null) {
    etag.setWeak(true);
      }
  }
  return etag;
View Full Code Here

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

Examples of org.w3c.www.http.HttpEntityTag

     */

    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

Examples of org.w3c.www.http.HttpEntityTag

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

Examples of org.w3c.www.http.HttpEntityTag

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

Examples of org.w3c.www.http.HttpEntityTag

  if ( ! getPutableFlag() ) {
      Reply error = request.makeReply(HTTP.NOT_ALLOWED) ;
      error.setContent("Method PUT not allowed.") ;
      throw new HTTPException (error) ;
  }
  HttpEntityTag etag = getComETag();
  // 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

Examples of org.w3c.www.http.HttpEntityTag

          "(probably deleted).");
    throw new HTTPException (reply);
      }
  }
  // negotiate etag
  HttpEntityTag etag = request.getETag();
  HttpEntityTag etags[] = request.getIfMatch();
  // gather the etags
  if (etags == null && etag != null) {
      etags = new HttpEntityTag[1];
      etags[0] = etag;
  } else if (etag != null) {
      HttpEntityTag t_etags[] = new HttpEntityTag[etags.length+1];
      System.arraycopy(etags, 0, t_etags, 0, etags.length);
      t_etags[etags.length] = etag;
      etags = t_etags;
  }

  if (etags != null) {
      // yeah go for it!
      FramedResource resource;
      HttpEntityTag frametag;
      for (int i = 0 ; i < variants.length ; i++) {
    try {
        resource = (FramedResource)variants[i].unsafeLock() ;
        itsframe = (HTTPFrame)resource.getFrame(httpFrameClass);
        if (itsframe != null) {
      frametag = itsframe.getETag();
      if (frametag == null) {
          continue;
      }
      // Do we have a winner?
      try {
          for (int j=0; j<etags.length; j++)
        if(frametag.getTag().equals(etags[j].getTag()))
            return variants[i];
      } catch (NullPointerException ex) {
          // if the list of etag contains a null
          // it should never happen and the try doesn't cost
      }
View Full Code Here

Examples of org.w3c.www.http.HttpEntityTag

    public Reply handleRangeRequest(Request request, HttpRange r)
  throws ProtocolException
    {
  // Should we check against a IfRange header ?
  HttpEntityTag t = request.getIfRange();

  if ( t != null ) {
      if (t.isWeak() || ! t.getTag().equals(etag.getTag()))
    return null;
  }
  // Check the range:
  int cl = getContentLength();
  int fb = r.getFirstPosition();
View Full Code Here

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) {
  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

Examples of org.w3c.www.http.HttpEntityTag

     */

    public int checkIfNoneMatch(Request request) {
  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
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.