I have created a wrapper class to validate all the input parameters by assigning them into an array. I am getting request from Filter class. getParameterValues is not working which I am using to get the request parameters into an array.
public class XSSRequestWrapper extends HttpServletRequestWrapper {
public XSSRequestWrapper(HttpServletRequest servletRequest) {
super(servletRequest);
}
Following code works fine
public String getParameter(String name) {
// TODO Auto-generated method stub
return super.getParameter(name);
}
Following doesn't work at all
public String[] getParameterValues(String name) {
// TODO Auto-generated method stub
return super.getParameterValues(name);
}
Following is the filter.java
//@WebFilter("/filter")
public class filter implements Filter {
public filter() {
// TODO Auto-generated constructor stub
}
public void destroy() {
// TODO Auto-generated method stub
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(new XSSRequestWrapper((HttpServletRequest) request), response);
}
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
}
}