Printing Request debug information on a Java Servlet
I find it extremely useful when doing Django/Python web development to fully inspect a HTTP request like this:
logger = logging.getLogger(__nam开发者_如何学Pythone__)
def index(request):
logger.info(request)
Is there something similar for a Java Servlet?
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// debugInfo should print something similar to what you get in DJANGO
debugInfo(request);
}
Since I got no answers, I wrote a little helper class to help me with this issue. Hope someone else finds it interesting and useful.
精彩评论