|
Hi
I have a generic servlet which checks if the request is of
content-type=multipart/form-data
then uses Jason's MultipartRequest
let us suppose we need to redirect to our-self with different url
parameters after handling the multipart request
then the next request should not be multipart but I get request with
content-type=multipart, but actually it is not so
MultipartRequest class throws IOException(Corrupt form data: premature
ending)
Please help me out
Thanks in advance
Babar
The code is just for testing purpose
----------------------------------------------------------------------------------------------------------
package com.objectcrafts.wib;
import java.io.*;
import javax.servlet.*; import javax.servlet.http.*; import
com.oreilly.servlet.MultipartRequest;
public class WibServlet extends HttpServlet
{
public void service(HttpServletRequest
request, HttpServletResponse response) throws ServletException,
IOException{
String type =
request.getContentType();
if (type != null && type.toLowerCase().startsWith("multipart/form-data")) { MultipartRequest req = new MultipartRequest(request, "/temp/"); } if(due to some reason we send redirect to
ourself)
response.sendRedirect("http://localhost/servlets/tomyself/"); } } ----------------------------------------------------------------------------------
|
