我正在实现ServletRequestListener并重写其方法requestInitialized和requestDestroyed。当调用requestDestroyed时,我想知道请求是否是GET / POST请求以及随之发送的参数等详细信息。该方法应该是什么?
public void requestDestroyed(ServletRequestEvent event) {
ServletRequest s = event.getServletRequest();
//use this to get those details
答案 0 :(得分:1)
您可以执行以下操作。
public void requestDestroyed(ServletRequestEvent event) {
ServletRequest s = event.getServletRequest();
HttpSevletRequest request = (HttpServletRequest) s;
String method = request.getMethod();
Map<String,String[]> parameters = request.getParameterMap();
}