Dump-Methoden

/** * Ausgabe Request-Parameter mit Wert im Log * @param req HttpServletRequest */ public static void dump( HttpServletRequest req ) { Enumeration en = req.getParameterNames() ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = req.getParameter( s ) ; log( "HttpServletRequest-Parameter " + s + " -> " + o ) ; } en = req.getAttributeNames() ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = req.getAttribute( s ) ; log( "HttpServletRequest-Attribute " + s + " -> " + o ) ; } } // end method dump(HttpServletRequest) /** * Ausgabe Session-Attribute mit Wert im Log * @param session HttpSession */ public static void dump( HttpSession session ) { Enumeration en = session.getAttributeNames() ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = session.getAttribute( s ) ; log( "HttpSession-Attribute " + s + " -> " + o ) ; } } // end method dump(HttpSession) /** * Ausgabe PageContext-Attribute mit Wert im Log * @param req HttpServletRequest */ public static void dump( PageContext pageContext ) { Enumeration en ; int scope ; scope = 0; en = pageContext.getAttributeNamesInScope( scope ) ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = pageContext.getAttribute( s , scope ) ; log( "PageContext-Attribute (scope " + scope + ") " + s + " -> " + o ) ; } scope = PageContext.PAGE_SCOPE; en = pageContext.getAttributeNamesInScope( scope ) ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = pageContext.getAttribute( s , scope ) ; log( "PageContext-Attribute (scope PAGE_SCOPE " + scope + ") " + s + " -> " + o ) ; } scope = PageContext.REQUEST_SCOPE; en = pageContext.getAttributeNamesInScope( scope ) ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = pageContext.getAttribute( s , scope ) ; log( "PageContext-Attribute (scope REQUEST_SCOPE " + scope + ") " + s + " -> " + o ) ; } scope = PageContext.SESSION_SCOPE; en = pageContext.getAttributeNamesInScope( scope ) ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = pageContext.getAttribute( s , scope ) ; log( "PageContext-Attribute (scope SESSION_SCOPE " + scope + ") " + s + " -> " + o ) ; } scope = PageContext.APPLICATION_SCOPE; en = pageContext.getAttributeNamesInScope( scope ) ; while ( en.hasMoreElements() ) { String s = (String) en.nextElement(); Object o = pageContext.getAttribute( s , scope ) ; log( "PageContext-Attribute (scope APPLICATION_SCOPE " + scope + ") " + s + " -> " + o ) ; } } // end method dump(PageContext)
Home Anfang weiter