开发者

Printing Request debug information on a Java Servlet

开发者 https://www.devze.com 2023-03-20 19:13 出处:网络
I find it extremely useful when doing Django/Python web development to fully inspect a HTTP request like this:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号