Package com.admc.util

Examples of com.admc.util.Expander


                    .getAbsolutePath());
            tmpDir = tmpDir.getParentFile();
        }

        JCreole jCreole = new JCreole(IOUtil.toString(bpStream));
        Expander htmlExpander = jCreole.getHtmlExpander();
        Date now = new Date();
        htmlExpander.put(
                "isoDateTime", isoDateTimeFormatter.format(now), false);
        htmlExpander.put("isoDate", isoDateFormatter.format(now), false);
        htmlExpander.put("contextPath", contextPath, false);
        htmlExpander.put("pageBaseName", pageBaseName, false);
        htmlExpander.put("pageDirPath", absUrlDirPath, false);
        htmlExpander.put("pageTitle", absUrlBasePath, false);
        if (readmeSb == null) {
            htmlExpander.put("readmeContent", "");
        } else {
            JCreole readmeJCreole = new JCreole();
            readmeJCreole.setHtmlExpander(htmlExpander);
            readmeJCreole.setInterWikiMapper(this);
            readmeJCreole.setPrivileges(jcreolePrivs);
            htmlExpander.put("readmeContent", readmeJCreole.postProcess(
                    readmeJCreole.parseCreole(readmeSb), "\n"), false);
        }
        if (fsDirFile != null) {
            FileComparator.SortBy sortBy = FileComparator.SortBy.NAME;
            boolean ascending = true;
            String sortStr = req.getParameter("sort");
            if (sortStr != null) {
                Matcher m = sortParamPattern.matcher(sortStr);
                if (!m.matches())
                    throw new ServletException(
                            "Malformatted sort value: " + sortStr);
                ascending = m.group(1).equals("+");
                try {
                    sortBy = Enum.valueOf(
                            FileComparator.SortBy.class, m.group(2));
                } catch (Exception e) {
                    throw new ServletException(
                            "Malformatted sort string: " + sortStr);
                }
            }
            htmlExpander.put("index", "\n"
                    + indexer.generateTable(fsDirFile, absUrlDirPath, true,
                    sortBy, ascending), false);
            // An alternative for using the Tomcat-like Indexer in a
            // htmlExpander would be to write a Creole table to a
            // creoleExpander.
View Full Code Here

TOP

Related Classes of com.admc.util.Expander

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.