Package org.meshcms.util

Examples of org.meshcms.util.Path


        if (dirPath.getElementCount() <
            webSite.getVirtualSitesPath().getElementCount() + 2) {
          di.iconName = "folder_star";
        } else if (webSite instanceof MainWebSite) {
          Path siteRoot =
              dirPath.getPartial(webSite.getVirtualSitesPath().getElementCount() + 1);
          VirtualWebSite vws =
              ((MainWebSite) webSite).getVirtualSite(siteRoot.getLastElement());
          return getDirectoryInfo(vws, userInfo, dirPath.getRelativeTo(siteRoot));
        }
      } else {
        di.include = false;
      }
View Full Code Here


   * @param response servlet response
   */
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    WebSite webSite = (WebSite) request.getAttribute("webSite");
    Path path = new Path(request.getPathInfo());

    if (webSite.isSystem(path)) {
      /* Only authenticated users can download system files */
      UserInfo userInfo = (UserInfo)
        request.getSession(true).getAttribute("userInfo");

      if (userInfo == null || userInfo.isGuest()) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
      }
    }

    File file = webSite.getFile(path);

    if (!file.exists()) {
      response.sendError(HttpServletResponse.SC_NOT_FOUND,
          "File not found on server");
      return;
    }

    String fileName = request.getParameter("filename");

    if (Utils.isNullOrEmpty(fileName)) {
      fileName = path.getLastElement();
    }

    try {
      InputStream is = new FileInputStream(file);
      response.setContentType("application/x-download");
View Full Code Here

  Path servedPath;
 
  public MultiSiteRequestWrapper(HttpServletRequest request,
      VirtualWebSite webSite) {
    super(request);
    requestedPath = new Path(request.getServletPath());
    servedPath = webSite.getServedPath(requestedPath);
  }
View Full Code Here

   *
   * @param allowCurrentDir if true and the argument parameter is null, the
   * files included in the same folder of the page are returned
   */
  public File[] getModuleFiles(WebSite webSite, boolean allowCurrentDir) {
    Path argPath = getModuleArgumentPath(false);

    if (argPath == null && allowCurrentDir) {
      argPath = getModuleArgumentDirectoryPath(webSite, true);
    }

View Full Code Here

   *
   * @param allowCurrentPath if true and the argument parameter is null, the
   * page path is returned
   */
  public Path getModuleArgumentPath(boolean allowCurrentPath) {
    Path argPath = null;

    if (argument != null) {
      argPath = new Path(argument);
    } else if (allowCurrentPath) {
      argPath = pagePath;
    }

    return argPath;
View Full Code Here

   * @param allowCurrentPath if true and the argument parameter is null, the
   * path of the page is returned
   */
  public Path getModuleArgumentDirectoryPath(WebSite webSite,
      boolean allowCurrentPath) {
    Path argPath = getModuleArgumentPath(allowCurrentPath);
    return (argPath == null || webSite.isSystem(argPath)) ? null :
        webSite.getDirectory(argPath);
  }
View Full Code Here

                bundle.getString("adminEditText") + a3);

            l.add(a1 + adminRelPath.add("editsrc.jsp") + "?path=" + pagePath + "&amp;tidy=true" +
                a2 + bundle.getString("adminTidy") + a3);

            Path pathInMenu = webSite.getSiteMap().getPathInMenu(pagePath);

            if (!pathInMenu.isRoot()) {
              Path parentPath = pathInMenu.getParent();

              if (user.canWrite(webSite, parentPath)) {
                l.add(a1 + adminRelPath.add("createpage.jsp") + "?popup=false&amp;path=" +
                    parentPath + a2 + bundle.getString("adminNewPage") + a3);
              }
View Full Code Here

  }

  public void writeTag() throws IOException {
    SiteMap siteMap = webSite.getSiteMap();
    SiteInfo siteInfo = webSite.getSiteInfo();
    Path rootPath = (path == null) ? siteInfo.getThemeRoot(pagePath) : new Path(path);
    Path pathInMenu = webSite.getSiteMap().getPathInMenu(pagePath);
    int baseLevel = rootPath.getElementCount() + 1;
    int spc = Utils.parseInt(space, 8);
    SiteMapIterator iter = new SiteMapIterator(webSite, rootPath);
    iter.setSkipHiddenSubPages(allowHiding);
    Writer outWriter = getOut();

    while (iter.hasNext()) {
      PageInfo current = (PageInfo) iter.next();
      Path currentPath = current.getPath();
      Path parentPath = currentPath.getParent();

      if (parentPath.isRelative() || pathInMenu.isContainedIn(parentPath)) {
        if (Utils.isTrue(expand) ||
            pathInMenu.isContainedIn(currentPath) ||
            currentPath.getElementCount() == baseLevel ||
            currentPath.getElementCount() >= pathInMenu.getElementCount()) {
          outWriter.write("<div style=\"padding-left: " +
View Full Code Here

  public void writeTag() throws IOException, JspException {
    String email = getMailFormAddress();
   
    if (Utils.checkAddress(email)) {
      try {
        Path mailModulePath = webSite.getAdminModulesPath().add("mail");
        String location = "meshcmsmailformtag";
        ModuleDescriptor md = new ModuleDescriptor();
        md.setLocation(location);
        md.setArgument(email);
        md.setModulePath(mailModulePath);
View Full Code Here

  public void setPost(String post) {
    this.post = post;
  }
 
  public void writeTag() throws IOException {
    Path rootPath = (path == null) ? pagePath : new Path(path);
    List list = webSite.getSiteMap().getPagesInDirectory(rootPath,
        Utils.isTrue(welcome));
   
    /*if (Utils.isTrue(current)) {
      if (list == null) {
View Full Code Here

TOP

Related Classes of org.meshcms.util.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.