Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get raw parameters before mapping
    primarykey
    data
    text
    <p>I've got new issue with Struts 1 framework. I need to filter some input values from page, so I wrote my custom filter to do this.</p> <p>It works great for single parameters, that are not mapped to any form. But it doesn't get parameters when it have been mapped to some struts Form field.</p> <p>Does anyone have idea how to deal with it?</p> <p>Here is code of my Filter</p> <pre><code>public class XSSFillter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(new XSSRequest((HttpServletRequest) request), response); } @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void destroy() { } } </code></pre> <p>And </p> <pre><code>public class XSSRequest extends MultipartRequestWrapper{ public XSSRequest(HttpServletRequest request) { super(request); } @Override public String[] getParameterValues(String name) { String[] values = super.getParameterValues(name); if(values == null){ return null; } String[] newValues = new String[values.length]; for(int index = 0; index &lt; values.length; index++ ){ newValues[index] = XSSFilterUtil.removeXSSTokens(values[index]); } return newValues; } @Override public String getParameter(String name) { String value = super.getParameter(name); return XSSFilterUtil.removeXSSTokens(value); } @Override public String getHeader(String name) { String value = super.getHeader(name); return XSSFilterUtil.removeXSSTokens(value); } } </code></pre> <p>Of course I've defined it in web.xml</p> <p>Here is one of most important part, I guess.</p> <pre><code>if (isMultipart) { parameterValue = multipartParameters.get(name); } else { parameterValue = request.getParameterValues(name); } </code></pre> <p>So in one case <code>parameterValue</code> is taken from <code>multipartParameters</code>, and in turn they are defined in some temporary files. I thinks the best way will be modified all request parameters and then let it go throw Struts 1.3.8 library.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload