Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.FramedResource$FrameReference


    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
          if( resource instanceof FileResource ) {
              FileResource fr = (FileResource)resource;
        if( !fr.getFile().exists() ) {
            try {
          fr.delete();
            } catch (MultipleLockException ex) {};
            continue;
        } else {
          size = fr.getFile().length();
        }
          }
          HTTPFrame itsframe = null;
          if (http_class != null)
        itsframe =
            (HTTPFrame) resource.getFrame(http_class);
          if (itsframe != null) {
        // Icon first, if available
        String icon = itsframe.getIcon() ;
        if ( icon != null ) {
            g.append("<img src=\""+
View Full Code Here


          DirectoryResource dir =
        (DirectoryResource) resource;
          ResourceReference rr = dir.lookup(index);
          if (rr != null) {
        try {
            FramedResource rindex =
          (FramedResource) rr.lock();
            return rindex.lookup(ls,lr);
        } catch (InvalidResourceException ex) {
        } finally {
            rr.unlock();
        }
          }
View Full Code Here

    }
      }
  }
  String strcount = Integer.toString(count);
  // Set cookie with next value:
  FramedResource frame = (FramedResource) getResource();
  if (frame instanceof HTTPFrame) {
      HTTPFrame target = (HTTPFrame) frame;
      HttpSetCookieList setcookies = HttpFactory.makeSetCookieList(null);
      HttpSetCookie     setcookie  = setcookies.addSetCookie(NAME,
                   strcount);
View Full Code Here

    if (r_wrapper == null) { //lookup for wrapper
        httpd server =
      (httpd) ssiframe.getFileResource().getServer();
        ResourceReference rr_root = server.getRootReference();
        try {
      FramedResource root = (FramedResource) rr_root.lock();
      LookupState ls = new LookupState(code);
      LookupResult lr = new LookupResult(rr_root);
      ResourceReference wrap = null;
      if (root.lookup(ls,lr))
          wrap = lr.getTarget();
      if (wrap != null) {
          try {
        if (wrap.lock() instanceof ServletWrapper) {
            wrappers.put(code,wrap);
            r_wrapper = wrap;
        }
          } catch (InvalidResourceException ex) {
        ex.printStackTrace();
        r_wrapper = null;
          } finally {
        wrap.unlock();
          }
      }
        } catch (ProtocolException ex) {
      ex.printStackTrace();
      r_wrapper = null;
        } catch (InvalidResourceException ex) {
      ex.printStackTrace();
      r_wrapper = null;
        } finally {
      rr_root.unlock();
        }
    }
    if (r_wrapper != null) {
        //initialize the wrapper (params)
        Hashtable params = getParams(variables, name);
        request.setState(JigsawHttpServletRequest.STATE_PARAMETERS,
             params);
        //perform the request
        try {
      FramedResource wrapper =
          (FramedResource)r_wrapper.lock();
      Request req = (Request)request.getClone();
      req.setState(JigsawHttpServletResponse.INCLUDED,
             Boolean.TRUE);
      return (Reply) wrapper.perform(req);
        } catch (ProtocolException ex) {
      ex.printStackTrace();
      // return default reply
        } catch (ResourceException ex2) {
      ex2.printStackTrace();
View Full Code Here

  if (vrroot == null) {
      return super.lookupOther(ls, lr);
  }
  try {
      lr.setTarget(vrroot);
      FramedResource resource = (FramedResource) vrroot.lock();
      boolean done =
        (resource != null ) ? resource.lookup(ls, lr) : false;
      if (! done) {
    lr.setTarget(null);
      }
      // because the vroot eats the lookup state components
      // we have to return true.
View Full Code Here

    public static RequestDispatcher getRequestDispatcher(String urlpath,
               httpd server,
               ResourceReference rr)
    {
  ResourceReference rr_root = null;
  FramedResource    root = null;
  rr_root = JigsawServletContext.getLocalRoot(server.getRootReference(),
                rr);
  try {
      root = (FramedResource) rr_root.lock();
      // Do the lookup:
      ResourceReference r_target = null;
      try {
    LookupState  ls = new LookupState(urlpath);
    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

        }
    }
    lr.setTarget(null);
    return true;
      } else if ( getCvsManager().status(name) != CVS.FILE_Q ) {
    FramedResource target = getResourceFor(name);
    lr.setTarget( target.getResourceReference() );
    target.lookup(ls, lr);
    return true;
      } else {
    lr.setTarget(null);
    return true;
      }
View Full Code Here

            RequestInterface req,
            String name,
            Hashtable defs)
    {
  ResourceReference rr = null;
  FramedResource template = null;
 
  //try with content type in request.
  if (req instanceof Request) {
      Request request = (Request) req;
      MimeType type = request.getContentType();
      if (type != null)
    rr = loadContentType(type.toString());
      if (rr != null) {
    String s_dir = "directory".intern();
    String s_ide = "identifier".intern();
    String s_fil = "filename".intern();
    String s_con = "context".intern();
    if ( defs == null )
        defs = new Hashtable(5) ;
    if ( defs.get(s_dir) == null )
        defs.put(s_dir, directory) ;
    if ( defs.get(s_ide) == null )
        defs.put(s_ide, name) ;
    if ( defs.get(s_con) == null )
        defs.put(s_con, getContext());
    //read attribute from request
    try {
        template = (FramedResource) rr.lock();
        // Create, initialize and return the new resouce
        try {
      FramedResource resource = null;
      resource = (FramedResource) template.getClone(defs);
      // Now update HTTPFrame from request
      String contentLanguage[] =
          request.getContentLanguage();
      String contentEncoding[] =
          request.getContentEncoding();
      //get the HTTPFrame.
      Class httpFrameClass =
          Class.forName("org.w3c.jigsaw.frames.HTTPFrame");
      HTTPFrame hframe = (HTTPFrame)
          resource.getFrame(httpFrameClass);
      if (hframe != null) {
          if ((contentLanguage != null) &&
        (contentLanguage.length > 0))
        hframe.setValue("content-language",
            contentLanguage[0]);
View Full Code Here

    }
      }
    }

    private synchronized void updateNonce() {
  FramedResource fr = filter.getResource();
  if (fr instanceof HTTPFrame) {
      HTTPFrame htf = (HTTPFrame) fr;
      try {
    MessageDigest md =
        MessageDigest.getInstance(filter.getAlgorithm());
View Full Code Here

     * @exception ResourceException if an internal error occurs
     */
    protected Reply getOtherResource(Request request)
  throws ProtocolException, ResourceException
    // get our associated Resource
  FramedResource res = getResource();
  // Create the HTML generator, and set titles:
  HtmlGenerator g = new HtmlGenerator("FancyFrame");
  g.append("<h1>FancyFrame output</h1>");
  // emit the message
  g.append("<p>",getMessage(),"</p>");
  // display information about our Resource
  g.append("<h2> Resource associated : </h2>");
  g.append("<ul><li>Identifier : ",res.getIdentifier());
  g.append("<li>Last Modified Time : ",
     new Date(res.getLastModified()).toString(),
     "</ul>");
  // now emit the reply
  Reply reply = createDefaultReply(request, HTTP.OK) ;
  reply.setStream(g) ;
  return reply ;
View Full Code Here

TOP

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

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.