7 Replies Latest reply on Oct 30, 2007 8:59 PM by Shane Bryzak

    After adding SeamServletFilte, request.getInputStream() retu

    Chico Chen Newbie

       

      <filter>
       <filter-name>Seam Servlet Filter</filter-name>
       <filter-class>
       org.jboss.seam.servlet.SeamServletFilter
       </filter-class>
       </filter>
       <filter-mapping>
       <filter-name>Seam Servlet Filter</filter-name>
       <url-pattern>*.serv</url-pattern>
       </filter-mapping>


      <servlet>
       <servlet-name>testServlet</servlet-name>
       <servlet-class>
       com.eastidea.menglishweb.action.TestServlet
       </servlet-class>
       </servlet>
       <servlet-mapping>
       <servlet-name>testServlet</servlet-name>
       <url-pattern>/testServlet.serv</url-pattern>
       </servlet-mapping>


      public void doPost(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
      
       response.setContentType("text/html");
       response.setCharacterEncoding("utf-8");
      
       ServletInputStream servletInputStream = request.getInputStream(); File file = new File("d:/out.txt");
       int readCount;
       byte[] readByte = new byte[1024];
       FileOutputStream fileOutputStream;
       try {
       fileOutputStream = new FileOutputStream(file);
       readCount = servletInputStream.readLine(readByte, 0,
       readByte.length);
      
       while (readCount != -1) {
       fileOutputStream.write(readByte, 0, readCount);
       readCount = servletInputStream.readLine(readByte, 0, 1024);
       }
       fileOutputStream.flush();
      
       } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }}