Example usage for javax.servlet.jsp JspFactory getEngineInfo

List of usage examples for javax.servlet.jsp JspFactory getEngineInfo

Introduction

In this page you can find the example usage for javax.servlet.jsp JspFactory getEngineInfo.

Prototype


public abstract JspEngineInfo getEngineInfo();

Source Link

Document

called to get implementation-specific information on the current JSP engine.

Usage

From source file:ro.raisercostin.web.DebuggingFilter.java

public String debug(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response,
        DebuggingPrinter debuggingPrinter, boolean debugAll, boolean debugRequest) {
    final JspFactory jspFactory = JspFactory.getDefaultFactory();
    HttpSession session = request.getSession();
    debuggingPrinter.addHeader();/*ww w. j a  v a 2  s .  c o  m*/
    debuggingPrinter.addSection("Request Parameters");
    for (Iterator iterator = request.getParameterMap().entrySet().iterator(); iterator.hasNext();) {
        Map.Entry<String, Object> parameter = (Map.Entry<String, Object>) iterator.next();
        addRow(debuggingPrinter, parameter.getKey(),
                StringUtils.arrayToCommaDelimitedString((Object[]) parameter.getValue()));
    }
    debuggingPrinter.endSection();

    if (debugRequest) {
        debuggingPrinter.addSection("Request Header");
        for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) {
            String parameterName = (String) e.nextElement();
            addRow(debuggingPrinter, parameterName,
                    debuggingPrinter.transform(request.getHeader(parameterName)));
        }
        debuggingPrinter.endSection();

        debuggingPrinter.addSection("Request Attributes");
        java.util.Enumeration en = request.getAttributeNames();
        while (en.hasMoreElements()) {
            String attrName = (String) en.nextElement();
            try {
                addRow(debuggingPrinter, split(attrName, 50), toString2(request.getAttribute(attrName), 120));
            } catch (Exception e) {
                addRow(debuggingPrinter, split(attrName, 50), toString(e, 120));
            }

        }
        debuggingPrinter.endSection();

        debuggingPrinter.addSection("Session Attributes");
        en = session.getAttributeNames();
        while (en.hasMoreElements()) {
            String attrName = (String) en.nextElement();
            try {
                addRow(debuggingPrinter, split(attrName, 50), toString2(session.getAttribute(attrName), 120));
            } catch (Exception e) {
                addRow(debuggingPrinter, split(attrName, 50), toString(e, 120));
            }
        }
        debuggingPrinter.endSection();

        debuggingPrinter.addSection("Request Info");
        addRow(debuggingPrinter, "AuthType", request.getAuthType());
        addRow(debuggingPrinter, "ContextPath", request.getContextPath());
        addRow(debuggingPrinter, "Method", request.getMethod());
        addRow(debuggingPrinter, "PathInfo", request.getPathInfo());
        addRow(debuggingPrinter, "PathTranslated", request.getPathTranslated());
        addRow(debuggingPrinter, "Protocol", request.getProtocol());
        addRow(debuggingPrinter, "QueryString", request.getQueryString());
        addRow(debuggingPrinter, "RemoteAddr", request.getRemoteAddr());
        addRow(debuggingPrinter, "RemoteUser", request.getRemoteUser());
        addRow(debuggingPrinter, "RequestedSessionId", request.getRequestedSessionId());
        addRow(debuggingPrinter, "RequestURI", request.getRequestURI());
        addRow(debuggingPrinter, "RequestURL", request.getRequestURL().toString());
        addRow(debuggingPrinter, "ServletPath", request.getServletPath());
        addRow(debuggingPrinter, "Scheme", request.getScheme());
        addRow(debuggingPrinter, "ServletPath", request.getServletPath());
    }
    if (debugAll) {
        debuggingPrinter.addSection("Server");
        addRow(debuggingPrinter, "Server Info", servletContext.getServerInfo());
        addRow(debuggingPrinter, "Servlet Engine Version",
                servletContext.getMajorVersion() + "." + servletContext.getMinorVersion());
        addRow(debuggingPrinter, "JSP Version", jspFactory.getEngineInfo().getSpecificationVersion());
        debuggingPrinter.endSection();

        debuggingPrinter.addSection("JVM Properties");
        for (Enumeration e = System.getProperties().propertyNames(); e.hasMoreElements();) {
            String parameterName = (String) e.nextElement();
            addRow(debuggingPrinter, parameterName,
                    debuggingPrinter.transform(System.getProperty(parameterName)));
        }
        debuggingPrinter.endSection();

        debuggingPrinter.addSection("Environment");
        for (Map.Entry<String, String> property : System.getenv().entrySet()) {
            addRow(debuggingPrinter, property.getKey(), debuggingPrinter.transform(property.getValue()));
        }
        debuggingPrinter.endSection();

        debuggingPrinter.addSection("Debugger Provided by");
        addRow(debuggingPrinter, "provided by", "raisercostin");
        debuggingPrinter.addRow("source",
                "<a target='_blank' href='http://code.google.com/p/raisercostin/wiki/DebuggingFilter'>http://code.google.com/p/raisercostin/wiki/DebuggingFilter</a>");
        addRow(debuggingPrinter, "version", "1.0");
        addRow(debuggingPrinter, "timestamp", "2008.June.14");
        addRow(debuggingPrinter, "license",
                "<a target='_blank' href='http://www.apache.org/licenses/LICENSE-2.0.html'>Apache License 2.0</a>");
        debuggingPrinter.endSection();
    }
    debuggingPrinter.addFooter();
    return debuggingPrinter.getString();
}