Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.FramedResource


      }
      // verify that the target resource is putable
      ResourceReference rr = request.getTargetResource();
      if (rr != null) {
    try {
        FramedResource target = (FramedResource) rr.lock();
        HTTPFrame frame = null;
        try {
      frame = (HTTPFrame) target.getFrame(
         Class.forName("org.w3c.jigsaw.frames.HTTPFrame"));
        } catch (ClassNotFoundException cex) {
      cex.printStackTrace();
      //big big problem ...
        }
View Full Code Here


    private ResourceReference list = null;
    protected synchronized ResourceReference resolvePutListResource() {
  // Prepare for lookup:
  ResourceReference rr_root = null;
  rr_root = ((httpd) getServer()).getRootReference();
  FramedResource root = null;
  root = ((httpd) getServer()).getRoot();
  String       u  = getPutListURL();
  if ( u == null )
      return null;
  // Do the lookup:
  ResourceReference r_target = null;
  try {
      LookupState  ls = new LookupState(u);
      LookupResult lr = new LookupResult(rr_root);
      root.lookup(ls, lr);
      r_target = lr.getTarget();
  } catch (Exception ex) {
      r_target = null;
  }
  if (r_target != null) {
View Full Code Here

      // verify that the target resource is putable
      ResourceReference rr = request.getTargetResource();
      if (rr != null) {
    try {
        FramedResource target = (FramedResource) rr.lock();
        HTTPFrame frame = null;
        try {
      frame = (HTTPFrame) target.getFrame(
          Class.forName("org.w3c.jigsaw.frames.HTTPFrame"));
        } catch (ClassNotFoundException cex) {
      cex.printStackTrace();
        //big big problem ...
        }
View Full Code Here

            RequestInterface req,
            String name,
            Hashtable defs)
    {
  ResourceReference rr = null;
  FramedResource template = null;
  Resource       newres = null;
  Class proto = null;
  try {
      proto = Class.forName("org.w3c.tools.resources.ProtocolFrame");
  } catch (Exception ex) {
      // fatal error!
      return null;
  }
  // Check that at least one class is defined for all the extensions:
  String exts[] = getFileExtensions(name) ;
  if ( exts == null )
      return null ;
  for (int i = exts.length-1 ; i >= 0 ; i--) {
      rr = getTemplateFor(exts[i]) ;
      if ( rr != null )
    break ;
  }
  if ( rr == null ) {
      // Look for a default template:
      if ((rr = loadExtension(defname)) == null)
    return null ;
  }
  // Create the runtime-time default values for attributes.
  if ( defs == null ) {
      defs = new Hashtable(5) ;
  }
  String s_dir = "directory".intern();
  String s_ide = "identifier".intern();
  String s_fil = "filename".intern();
  String s_con = "context".intern();

  if ( defs.get(s_dir) == null ) {
      defs.put(s_dir, directory) ;
  }
  if ( defs.get(s_ide) == null ) {
      defs.put(s_ide, getIndexedFileName(name)) ;
  } else {
      defs.put(s_ide, getIndexedFileName((String)defs.get(s_ide))) ;
  }
  if ( defs.get(s_fil) == null) {
      defs.put(s_fil, name) ;
  }
  if ( defs.get(s_con) == null ) {
      defs.put(s_con, getContext());
  }
  try {
      template = (FramedResource) rr.lock();
      if (exts != null) {
    // Merge with values defined by the extension:
    for (int i = exts.length ; --i >= 0 ; )
        mergeDefaultAttributes(template, exts[i], defs) ;
      }
      // Create, initialize and return the new resouce
      try {
    newres = (FramedResource) template.getClone(defs);
      } catch (Exception ex) {
    ex.printStackTrace() ;
    return null ;
      }
  } catch (InvalidResourceException ex) {
      ex.printStackTrace();
      return null;
  } finally {
      rr.unlock();
  }
    // clone has been done, merge frames now
  if (exts != null) {
      ResourceFrame rf[] = newres.collectFrames(proto);
      if (rf != null) {
    for (int j=0; j < rf.length; j++) {
        for (int i = exts.length-1 ; i >= 0 ; i--) {
      rr = getTemplateFor(exts[i]) ;
      if ( rr != null ) {
          FramedResource fr = null;
          try {
        fr = (FramedResource) rr.lock();
        ResourceReference trr = null;
        trr = fr.getFrameReference(proto);
        if (trr != null) {
            mergeFrameAttributes(rf[j], exts[i], trr);
        }
          } catch (InvalidResourceException iex) {
        iex.printStackTrace();
View Full Code Here

TOP

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

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.