Package com.caucho.vfs

Examples of com.caucho.vfs.Path


  }

  public XslNode generateImport(String href)
    throws Exception
  {
    Path path = lookupPath(href);

    if (_files.get(path.getPath()) != null)
      return null;

    Document xsl = readFile(href, path);
   
    if (xsl == null)
      throw new FileNotFoundException(href);

    QElement top = (QElement) xsl.getDocumentElement();
    if (top == null ||
        ! "stylesheet".equals(getXslLocal(top)) &&
        ! "transform".equals(getXslLocal(top))) {
      throw error("imported stylesheet `" + href +
                  "' missing xsl:stylesheet.");
    }

    int oldMinImportance = _minImportance;
    Path oldContext = _context;
    Path virtualPath = _context.getParent().lookup(href);
    _context = virtualPath;
    _minImportance = _importance;
    boolean oldTop = _isTop;
    boolean oldRaw = _isRawText;
    _isTop = false;
View Full Code Here


  }

  public void generateInclude(XslNode parent, String href)
    throws Exception
  {
    Path path = lookupPath(href);

    if (_files.get(path.getPath()) != null)
      return;
   
    Document xsl = readFile(href, path);
   
    Element top = (Element) xsl.getDocumentElement();
    if (top == null ||
        ! "stylesheet".equals(getXslLocal(top)) &&
        ! "transform".equals(getXslLocal(top))) {
      throw error("imported stylesheet `" + href +
                  "' missing xsl:stylesheet.");
    }

    Path oldContext = _context;
    _context = path;

    for (Node node = top.getFirstChild();
         node != null;
         node = node.getNextSibling()) {
View Full Code Here

      rs = _xslGenerator.openPath(href, _context.getURL());
    } catch (Exception e) {
      throw new XslParseException(e);
    }

    Path path = rs.getPath();
     
    xsl = readXsl(rs);
    Element subtop = xsl.getDocumentElement();

    if (subtop == null)
      throw error(L.l("xsl:import file {0} is empty", path.getFullPath()));
     
    Path oldContext = _context;

    _context = virtualPath;

    _files.put(virtualPath.getPath(), xsl);
     
View Full Code Here

    String root = getInitParameter("root");

    if (_path != null) {
    }
    else if (_root != null) {
      Path pwd = ((WebApp) getServletContext()).getRootDirectory();

      _path = new FilePath(pwd.lookup(_root));
    }
    else if (root != null) {
      Path pwd = ((WebApp) getServletContext()).getRootDirectory();

      _path = new FilePath(pwd.lookup(root));
    }
    else
      _path = new ApplicationPath();
  }
View Full Code Here

                String.valueOf(e));
      return;
    }

    WebApp app = (WebApp) getServletContext();
    Path appDir = app.getRootDirectory();

    String pathInfo = req.getPathInfo();
    String uriPwd = app.getContextPath() + req.getServletPath();
   
    if (pathInfo == null)
View Full Code Here

                "Bad Request: " + e);
      return;
    }
   
    WebApp app = (WebApp) getServletContext();
    Path appDir = app.getRootDirectory();

    String pathInfo = req.getPathInfo();
    String uriPwd = app.getContextPath() + req.getServletPath();
   
    if (pathInfo == null)
View Full Code Here

      sendError(res, out, 403, "Forbidden", "PUT forbidden");
      return;
    }
   
    WriteStream ws = Vfs.openWrite(os);
    Path path =ws.getPath();
    try {
      InputStream is = req.getInputStream();
      ws.writeStream(is);
    } finally {
      ws.close();
View Full Code Here

      if (_isCaseInsensitive)
        relPath = relPath.toLowerCase(Locale.ENGLISH);

      filename = getServletContext().getRealPath(relPath);
      Path path = _context.lookupNative(filename);

      // only top-level requests are checked
      if (cauchoReq == null || cauchoReq.getRequestDepth(0) != 0) {
      }
      else if (relPath.regionMatches(true, 0, "/web-inf", 0, 8)
               && (relPath.length() == 8
                   || ! Character.isLetterOrDigit(relPath.charAt(8)))) {
        res.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
      }
      else if (relPath.regionMatches(true, 0, "/meta-inf", 0, 9)
               && (relPath.length() == 9
                   || ! Character.isLetterOrDigit(relPath.charAt(9)))) {
        res.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
      }

      if (relPath.endsWith(".DS_store")) {
        // MacOS-X security hole with trailing '.'
        res.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
      }
      else if (! CauchoSystem.isWindows() || relPath.length() == 0) {
      }
      else if (path.isDirectory()) {
      }
      else if (path.isWindowsInsecure()) {
        // Windows security issues with trailing '.'
        res.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
      }

      // A null will cause problems.
      for (int i = relPath.length() - 1; i >= 0; i--) {
        char ch = relPath.charAt(i);

        if (ch == 0) {
          res.sendError(HttpServletResponse.SC_NOT_FOUND);
          return;
        }
      }

      ServletContext webApp = getServletContext();

      String mimeType = webApp.getMimeType(relPath);

      boolean isPathReadable = path.canRead();
      Path jarPath = null;

      if (! isPathReadable) {
        String resource = "META-INF/resources" + relPath;
        URL url = webApp.getClassLoader().getResource(resource);
View Full Code Here

    String scriptPath = req.getServletPath();
    String pathInfo = req.getPathInfo();

    WebApp webApp = (WebApp) req.getServletContext();

    Path appDir = webApp.getRootDirectory();
    String realPath = webApp.getRealPath(scriptPath);

    if (! appDir.lookup(realPath).isFile() && pathInfo != null)
      scriptPath = scriptPath + pathInfo;

    /*
     * FastCGI (specifically quercus) uses the PATH_INFO and PATH_TRANSLATED
     * for the script path.
View Full Code Here

    throws ConfigException
  {
    try {
      ClassLoader parentLoader = _ejbManager.getClassLoader();

      Path workDir = _ejbManager.getWorkDir();

      JavaClassGenerator javaGen = new JavaClassGenerator();
      javaGen.setWorkDir(workDir);
      javaGen.setParentLoader(parentLoader);
View Full Code Here

TOP

Related Classes of com.caucho.vfs.Path

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.