Package org.w3c.util

Examples of org.w3c.util.ArrayDictionary


    protected boolean   deadpropmodified = false;

    protected synchronized Hashtable getDeadPropertiesIndex() {
  if (deadindex == null) {
      ArrayDictionary dic  = getDeadProperties();
      if (dic == null) {
    return new Hashtable();
      }
      Enumeration    denum = dic.keys();
      deadindex            = new Hashtable(dic.size());
      while (denum.hasMoreElements()) {
    String               key     = (String) denum.nextElement();
    Base64Decoder        decoder =
        new Base64Decoder((String)dic.get(key));
    try {
        String decoded = decoder.processString();
        ByteArrayInputStream in      =
      new ByteArrayInputStream(decoded.getBytes());
        Document doc = DAVBody.getDocument(in, null);
View Full Code Here


  deadpropmodified = false;
    }

    protected synchronized void saveDeadProperties() {
  if (deadpropmodified) {
      ArrayDictionary dic  = new ArrayDictionary(deadindex.size());
      Enumeration    denum = deadindex.keys();
      while (denum.hasMoreElements()) {
    String                ns     = (String)denum.nextElement();
    Document              doc    = (Document)deadindex.get(ns);
    ByteArrayOutputStream out    = new ByteArrayOutputStream();
    OutputFormat          format =
        new OutputFormat(doc, WEBDAV.ENCODING, true);
    format.setOmitXMLDeclaration(false);
    format.setPreserveSpace(true);
    XMLSerializer serializer = new XMLSerializer(out, format);
    try {
        serializer.serialize(doc);
        if (debug)
      System.out.println("["+out.toString(WEBDAV.ENCODING)
             +"]");
        Base64Encoder encoder =
      new Base64Encoder(out.toString(WEBDAV.ENCODING));
        dic.put(ns, encoder.processString());
    } catch (IOException ex) {
        ex.printStackTrace();
    }
      }
      setValue(ATTR_DEAD_PROPERTIES, dic);
View Full Code Here

  reply.setETag(getHETag());
  long date = getDate();
  if ( date > 0 )
      reply.setDate(getDate());
  reply.setAge(getCurrentAge());
  ArrayDictionary a = getExtraHeaders();
  if ( a != null ) {
      // This is the slowest operation of the whole cache :-(
      Enumeration e = a.keys();
      while (e.hasMoreElements() ) {
    String hname  = (String) e.nextElement();
    String hvalue = (String) a.get(hname);
    reply.setValue(hname, hvalue);
      }
  }
  if ((filter != null) && filter.isShared()) {
      HttpCacheControl hcc = reply.getCacheControl();
View Full Code Here

      setContentMD5(reply.getContentMD5());
      String vary[] = reply.getVary();
      setVary(vary);
      if (vary != null) {
    // update the conneg headers
    ArrayDictionary a = null;
    for (int i=0; i< vary.length; i++) {
        if (vary[i].equals("*")) {
      continue;
        }
        if (a == null) {
      a = new ArrayDictionary(vary.length);
        }
        a.put (vary[i].toLowerCase(), request.getValue(vary[i]));
    }
    // FIXME we should be able to update to save multiple
    // matches, but with a limitation of course
    if (a != null) {
        setConnegHeaders(a);
    }
      }
      if (reply.hasHeader(reply.H_ETAG)) {
    setETag(reply.getETag().toString());
      } else {
    // be safe here!
    setETag(null);
      }
      ArrayDictionary a = new ArrayDictionary(5, 5);
      Enumeration     e = reply.enumerateHeaderDescriptions();
      while ( e.hasMoreElements() ) {
    HeaderDescription d = (HeaderDescription) e.nextElement();
    // Skip all well-known headers:
    if ( d.isHeader(Reply.H_CONTENT_TYPE)
         || d.isHeader(Reply.H_CONTENT_LENGTH)
         || d.isHeader(Reply.H_LAST_MODIFIED)
         || d.isHeader(Reply.H_ETAG)
         || d.isHeader(Reply.H_AGE)
         || d.isHeader(Reply.H_DATE)
         || d.isHeader(Reply.H_VARY)
         || d.isHeader(Reply.H_CONNECTION)
         || d.isHeader(Reply.H_PROXY_CONNECTION)
         || d.isHeader(Reply.H_TRANSFER_ENCODING)
         || d.isHeader(Reply.H_CONTENT_MD5)
         || d.getName().equalsIgnoreCase("keep-alive"))
        continue;
    // This is an extra header:
    a.put(d.getName(), reply.getValue(d));
      }
      setExtraHeaders(a);
      // FIXME add the headers ;)
     
  }
View Full Code Here

      for (int i=0; i< vary.length; i++) {
    // always revalidate on *
    if (vary[i].equals("*")) {
        return false;
    }
    ArrayDictionary a = cr.getConnegHeaders();
    String rh = null;
    String crh = null;
    String lowh = null;
    // we have a header checked, but nothing in the conneg
    // it must not happen, but it's not a good sign for validity
    if (a == null) {
        return false;
    }
    lowh = vary[i].toLowerCase();
    crh = (String) a.get(lowh);
    rh = request.getValue(vary[i]);
    if (crh == null) {
        if (rh == null) {
      continue;
        }
View Full Code Here

     * <bold>true</bold> iff res contains extra header identifying it as
     * having been inserted directly into the cache from a PUSH source
     */
    public  boolean isPushResource(CachedResource res) {
  if(res!=null) {
      ArrayDictionary dict=res.getExtraHeaders();
      String v=(String)dict.get(HEADER_FIELD);
      if(v!=null && v.equalsIgnoreCase(HEADER_VALUE)) {
    return(true);
      }
  }
  return(false);
View Full Code Here

TOP

Related Classes of org.w3c.util.ArrayDictionary

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.