Hi,
I try your code and it give me this errors when I hit the upload
button.
[INFO] <H1>HTTP Status 500 - </H1>
<HR noShade SIZE=1>
<P><B>type</B> Exception report</P>
<P><B>message</B> <U></U></P>
<P><B>description</B> <U>The server encountered an internal error ()
that prevented it from fulfilling this request.</U></P>
<P><B>exception</B> <PRE>javax.servlet.ServletException: Servlet
execution threw an exception
</PRE>
<P></P>
<P><B>root cause</B> <PRE>java.lang.StackOverflowError
sun.nio.cs.ISO_8859_1$Encoder.encodeArrayLoop(Unknown Source)
sun.nio.cs.ISO_8859_1$Encoder.encodeLoop(Unknown Source)
java.nio.charset.CharsetEncoder.encode(Unknown Source)
java.lang.StringCoding$StringEncoder.encode(Unknown Source)
java.lang.StringCoding.encode(Unknown Source)
java.lang.String.getBytes(Unknown Source)
org.apache.commons.fileupload.FileUploadBase.getBoundary(FileUploadBase.java:
409)
org.apache.commons.fileupload.FileUploadBase
$FileItemIteratorImpl.<init>(FileUploadBase.java:929)
org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:
331)
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:
349)
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:
126)
com.driftmark.ui.server.FileUploadImpl.getFileItem(FileUploadImpl.java:
63)
com.driftmark.ui.server.FileUploadImpl.doPost(FileUploadImpl.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
com.driftmark.ui.server.FileUploadImpl.doPost(FileUploadImpl.java:31)
</PRE>
<P></P>
<P><B>note</B> <U>The full stack trace of the root cause is available
in the Apache Tomcat/5.0.28 logs.</U></P>
<HR noShade SIZE=1>
<H3>Apache Tomcat/5.0.28</H3>
On Aug 30, 3:29 am, Ron Lawrence <[EMAIL PROTECTED]> wrote:
> FYI all, you can use the same RPC servlet to handle thefileupload,
> simply override "service" in the RPC servlet, then handle thefileuploadas
> shown in the examples above. In the case where it's not
> multipart, or there is no uploadedfile, just call super to keep the
> RPC framework happy.
>
> You will also need to set your form's action with
> formPanel.setAction( GWT.getModuleBaseURL() + "Servletname" ); use the
> same servlet name that's in your module's or web.xmlfile.
>
> @Override
> protected void service( HttpServletRequest request,
> HttpServletResponse response ) throws ServletException,
> IOException
> {
> boolean isMultipart = ServletFileUpload.isMultipartContent( new
> ServletRequestContext(
> request ) );
> if ( isMultipart )
> {
> FileItem uploadItem = getFileItem( request );
> if ( uploadItem == null )
> {
> super.service( request, response );
> return;
> }
>
> response.setContentType( "text/plain" );
> byte[] fileContents = uploadItem.get();
> // verify thefilehere....
> String myFile = new String(fileContents);
> if (myFile.contains( "xxxx" ))
> {
> //do stuff with the data....
> response.getWriter().write( "OK" );
> }
> else
> {
> response.getWriter().write( "Invalidfile");
> }
> }
> else
> {
> super.service( request, response );
> }
> }
>
> private FileItem getFileItem( HttpServletRequest request )
> {
> FileItemFactory factory = new DiskFileItemFactory();
> ServletFileUploadupload= new ServletFileUpload( factory );
> upload.setSizeMax( 10000000 );
>
> try
> {
> List<FileItem> items =upload.parseRequest( request );
> for ( FileItem item : items )
> {
> if ( !item.isFormField()
> && "upload".equals( item.getFieldName() ) )
> {
> return item;
> }
> }
> }
> catch ( FileUploadException e )
> {
> return null;
> }
> return null;
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---