When I use Apache Tomcat 7.0.34 for file uploading using "org.apache.tomcat.util.fileupload" no error is displayed and everything works fine. But when I use Apache Tomcat 7.0.40 one error occurred in the line "parseRequest(request)". I can't tell this as an error because if I use RequestContext then the error will go but I don't know how to use RequestContext Interface. Please help me how to use RequestContext because I need to pass the instance to "parseRequest(RequestContext ctx)" method.
public void service(HttpServletRequest request,HttpServletResponse response)
{
response.setContentType("text/html;charset=UTF-8");
String status=null;
List<FileItem> items=null;
try
{
if(ServletFileUpload.isMultipartContent(request))
{
items=new ServletFileUpload(new
DiskFileItemFactory()).parseRequest(request);
for(FileItem item:items)
{
if(item.getFieldName().equals("status"))
status=item.getString();
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
I need to put RequestContext instance inside parseRequest(RequestContext ctx) but don't know how to use RequestContext.