title: Get httpservletrequest in doFilter without type casting from ServletRequest
body: <p>I introduced filter in my application for a validation. When I invoke doFilter method,  </p>
  
  <pre><code>public void doFilter (ServletRequest servletRequest, ServletResponse servletResponse,FilterChain filterChain)
  </code></pre>
  
  <p>I can't use <code>getParts()</code> in <code>doFilter()</code>. <code>getParts()</code> is available in <code>HttpServletRequest</code>.</p>
  
  <p>Even though I type cast from <code>ServletRequest</code> to <code>HttpServletRequest</code>, I am getting null value. </p>
  
  <p>Question is,is there any way to access <code>HttpServletRequest</code> inside <code>doFilter()</code> without type cast from <code>ServletRequest</code>? Or how can I directly access <code>HttpServletRequest</code> inside <code>doFilter()</code> without passing it into the method?</p>
  
  <p>Below snippet I get error</p>
  
  <pre><code>for(final Part part : ((HttpServletRequest) servletRequest).getParts())
  </code></pre>