[ http://issues.apache.org/struts/browse/WW-1331?page=comments#action_38197 ] Vlasov Igor commented on WW-1331: ---------------------------------
What if I get an xml data from many outer sources and I can not control a content type of a stream in each case. I am asking to implement some feature like my solution in Struts (with similar functionality). Some people may have a problem with inventing such solution. It would be petty good to have this ability as a standard case. > Ability to get an request.getInputStream() data > ----------------------------------------------- > > Key: WW-1331 > URL: http://issues.apache.org/struts/browse/WW-1331 > Project: Struts 2 > Issue Type: New Feature > Components: Dispatch > Affects Versions: WW 2.2.1 > Environment: Windows XP Tomcat 5.5.12 > Reporter: Vlasov Igor > > if we look in com.opensymphony.webwork.dispatcher.FilterDispatcher on > doFilter then find ActionMapping mapping = mapper.getMapping(request);. That > method call :Map parameterMap = request.getParameterMap(); > Thereforeif we want to call InputStream in = request.getInputStream() in > some action class in any method(e.g. execute) > then we get an EMPTY stream!!! > That is too Bad!!! > To avoid this i must use some izvrashenija(dirty hack): > write a filter: > public class RawPostFilter > extends HttpServlet implements Filter { > public static String RAW_POST = "rawPostData"; > public void init(FilterConfig filterConfig) throws ServletException { > } > public void doFilter(ServletRequest request, ServletResponse response, > FilterChain filterChain) throws java.io.IOException, > ServletException { > InputStream in = request.getInputStream(); > String origRP = FileUtil.getContent(in, "UTF-8"); > request.setAttribute(RAW_POST, origRP); > //further > filterChain.doFilter(request, response); > } > } > and inset it upper than WW filter > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
