Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.ContainerResource


     * Get ContainerResource listing
     * @param refresh should we refresh the listing?
     * @return a boolean (true if refreshed)
     */
    public boolean computeContainerListing(boolean refresh) {
  ContainerResource cresource = (ContainerResource)resource;
  synchronized (cresource) {
      if ((refresh) ||
          (listing == null) ||
    (cresource.getLastModified() > listing_stamp) ||
    (getLastModified() > listing_stamp)) {
     
    Class http_class = null;
    try {
        http_class =
          Class.forName("org.w3c.jigsaw.frames.HTTPFrame");
    } catch (ClassNotFoundException ex) {
      http_class = null;
    }

    Enumeration   e     = cresource.enumerateResourceIdentifiers();
    Vector    resources = Sorter.sortStringEnumeration(e) ;
    HtmlGenerator g     =
          new HtmlGenerator("Index of "+cresource.getIdentifier());
    // Add style link
    addStyleSheet(g);
    g.append("<h1>"+cresource.getIdentifier()+"</h1>");
    // Link to the parent, when possible:
    if ( cresource.getParent() != null ) {
        g.append("<p><a href=\"..\">Parent</a><br>");
    }
      // List the children:
    for (int i = 0 ; i < resources.size() ; i++) {
        String            name = (String) resources.elementAt(i);
        ResourceReference rr   = null;
        long              size = -1;
        rr = cresource.lookup(name);
        FramedResource resource = null;
        if (rr != null) {
      try {
          resource = (FramedResource) rr.unsafeLock();
          // remove manually deleted FileResources
View Full Code Here


    protected boolean lookupOther(LookupState ls, LookupResult lr)
  throws ProtocolException
    {
  // Try to lookup on the host header:
  ResourceReference vrroot = null;
  ContainerResource root = null;
 
  root = (ContainerResource)getResource();
  Request r = (Request)ls.getRequest();
  if ( r != null ) {
      String host = r.getURL().getHost();
      String protocol = r.getURL().getProtocol();
      if (host == null) {
    host = r.getHost();
    if ( host != null ) {
        // must strip the port if different from 80!
        if (host.endsWith(":80") && protocol.equals("http")) {
      host = host.substring(0, host.lastIndexOf(":80"));
        }
        // and the same for https (443)
        if (host.endsWith(":443") && protocol.equals("https")) {
      host = host.substring(0, host.lastIndexOf(":443"));
        }
    }
      } else {
    int port = r.getURL().getPort();
    if (port != -1) {
        if ( (protocol.equals("http") && (port != 80)) ||
       (protocol.equals("https") && (port != 443)) ) {
      host = host + ":" + port;
        }
    }
      }
      if (host != null) {
    vrroot = root.lookup(host.toLowerCase());
      }
  }
  if ( vrroot == null ) {
      vrroot  = lookupFollowup();
  }
View Full Code Here

    Resource res      = cvsframe.getResource();
    ResourceReference rr_dir = res.getParent();
    try {
        Resource parent = rr_dir.lock();
        if (parent instanceof ContainerResource) {
      ContainerResource dir = (ContainerResource) parent;
      ResourceReference rr_res = dir.lookup(name);
      if (rr_res == null) {
          this.setValue(ATTR_CONTENT_TYPE,
             org.w3c.www.mime.Utils.getMimeType(name));
          return;
      }
View Full Code Here

  if (rr != null) {
      try {
    FramedResource p = (FramedResource)rr.lock();
    // if the father is a container (it should always be)
    if (p instanceof ContainerResource) {
        ContainerResource cr = (ContainerResource) p;
        Enumeration res_enum;
        res_enum = cr.enumerateResourceIdentifiers(false);
        String childname;
        ResourceReference childrr;
        Class http_class = null;
        ResourceReference framrr;
        // get all the children, and find the container with
        // the most recent last-modified.
        while (res_enum.hasMoreElements()) {
      childname = (String) res_enum.nextElement();
      childrr = cr.lookup(childname);
      try {
          FramedResource cp = (FramedResource)childrr.lock();
          if (cp instanceof ContainerResource) {
        long lm = cp.getLastModified();
        if ((lmbest == 0) || (lm > lmbest)) {
View Full Code Here

             Document document,
             boolean deep)
    {
  if (resource instanceof ContainerResource) {
      Vector v = new Vector();
      ContainerResource cresource = (ContainerResource)resource;
      Enumeration e = cresource.enumerateResourceIdentifiers();
      ResourceReference rr = null;
      FramedResource    fr = null;
      while (e.hasMoreElements()) {
    String name = (String)e.nextElement();
    rr = cresource.lookup(name);
    if (rr != null) {
        try {
      fr = (FramedResource) rr.lock();
      if (fr == resource) { // for root
          continue;
View Full Code Here

TOP

Related Classes of org.w3c.tools.resources.ContainerResource

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.