I am trying to accomplish the same thing but am taking a different 
approach.  I have not changed any Struts code, instead I am trying to use 
the error page functionality to handle the ServletException.  I tried a 
file upload with the same limitations as you mention below and did not have 
a problem with the browser continuing to upload.  My problem, however, is 
that the error page is not being displayed.  I can see in the trace that it 
is being called but then just as it should be displayed in the browser I 
get a RuntimeException:

java.lang.RuntimeException: Bad request, no URL !
         at 
com.sssw.shr.http.HttpRequestMessage.notifyBeginParsing(HttpRequestMessage.java:187)
         at com.sssw.shr.mime.MimeParser.parse(MimeParser.java:104)
         at com.sssw.srv.http.Client.getNextRequest(Client.java:334)
         at com.sssw.srv.http.Client.loop(Client.java:1194)
         at com.sssw.srv.http.Client.runConnection(Client.java:1421)
         at com.sssw.srv.http.Client.run(Client.java:1381)
         at java.lang.Thread.run(Thread.java:484)

I then get a DNS server not found error in the browser.

I believe that it has something to do with how Struts is forwarding control 
to the error page.  I'm not sure but I think it might be because the 
response was already "committed" by the time the forward is taking 
place.  I tried reconfiguring Struts to use a redirect instead of a forward 
but that didn't seem to help.  Anyone have any ideas?

Ricky



At 12:04 PM 9/13/2001 -0700, you wrote:
>Hello,
>
>Does anybody know what I can do to resolve the following problem with the
>file upload?
>
>Summary of problem:
>
>When I try to upload a file larger than the maximum limit allowed, the 
>"Maximum
>length exceeded" message doesn't appear on the screen until the entire file
>is uploaded.  In other words, even though the server throws 
>MaxLengthExceededException
>right away, the browser keeps processing the file.  I can't figure out a
>way to cancel the processing so that the message is displayed right away!
>
>This happens within "Struts Framework" as well as outside Struts framework.
>
>
>
>
>Detail Description:
>
>To see how Struts handles file uploading here's what I am doing;
>
>1)  One of the business requirement for my project is that the user is not
>allowed to attach files larger than a certain limit.
>2)  To catch this condition I added 'maxFileSize' to web.xml (as described
>in the attached email).
>3)  This is when I started getting MaxLengthExceededException and Internal
>Server Error (as described in the attached email).
>4)  To resolve this "temporarily", I decided to "play around" with the struts
>code, so I changed the code to pass the 'MaxLengthExceededException' all
>the way up to the ActionServlet.  I changed the following methods;
>
>MultipartIterator Constructor
>DiskMultipartRequestHanlder.handleRequest()
>RequestUtils.populate()
>ActionServlet.processPopulate()
>ActionServlet.process()
>
>5)  This works really well for files of small size.  But when I set the
>maxFileSize to 1Meg and try to upload a 30Meg file the server throws the
>MaxLengthExceededException right away, but the browser keeps processing
>the 30Meg file.  The "Maximum file limit exceeded" message doesn't show
>up for about 10 minutes - until the browser is finished processing the file.
>  Is there a way to cancel browser processing right away?
>
>Thanks for your time.
>
>- Ajay
>
>
> >
> >-----Original Message-----
> >From: Ajay Chitre [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, September 10, 2001 11:56 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: file upload problems
> >
> >
> >Mike,
> >
> >I tried setting the maxFileSize as follows;
> >
> >    <init-param>
> >      <param-name>maxFileSize</param-name>
> >      <param-value>100K</param-value>
> >    </init-param>
> >
> >This throws a MaxLengthExceededException as expected.  I would like to
>catch
> >this exception and show a user friendly message on the screen.  How can
>I
> >do
> >that?  Please help....
> >
> >
> >Here's what I am doing;
> >
> >1)  I unzipped the struts-upload.war file that came with Struts 1.0.  (I
> >believe you wrote this sample app - thanks!)
> >2)  In the web.xml I made the changes shown above.
> >3)  I ran this app in Weblogic 5.1 (sp 9) and Tomcat 3.2.3.  In both cases,
> >when I submit a file larger than 100K I get
> >a MaxLengthExceededException and I get Error 500 - Internal Server Error
> >on
> >the screen.
> >
> >
> >Here's my understanding of the problem - Please ignore this if it doesn't
> >make sense...
> >
> >This exception is thrown in the BufferedMultipartInputStream constructor.
> >Shouldn't this exception be passed all the way up to the
> >ActionServlet.processPopulate()?  This method has access to the
> >'formInstance' which can be used to notify the user.  Does this make sense?
> >
> >Anyway, any help in this matter will be greatly appreciated.  Thanks.
> >
> >- Ajay
> >
> >
> >
> >-----Original Message-----
> >From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, September 10, 2001 10:18 AM
> >To: '[EMAIL PROTECTED]'
> >Subject: RE: file upload problems
> >
> >
> >Ricky,
> >
> >The maximum upload size is represented as an init-param for ActionServlet:
> >
> >To set it as an init-param in web.xml:
> >
> ><servlet>
> >    <servlet-name>action</servlet-name>
> >    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >    <init-param>
> >      <param-name>maxFileSize</param-name>
> >      <param-value>100K</param-value>
> >    </init-param>
> >    <load-on-startup>2</load-on-startup>
> ></servlet>
> >
> >The value of "maxFileSize" can be represented as in bytes by not appending
> >any
> >characters to the end, kilobytes by appending a "K" at the end, megabytes
> >by
> >appending an "M" at the end, and gigabytes by appending a "G" at the end.
> >
> >Example:
> >
> >100 bytes:
> ><servlet>
> >    <servlet-name>action</servlet-name>
> >    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >    <init-param>
> >      <param-name>maxFileSize</param-name>
> >      <param-value>100</param-value>
> >    </init-param>
> >    <load-on-startup>2</load-on-startup>
> ></servlet>
> >
> >100 kilobytes:
> >
> ><servlet>
> >    <servlet-name>action</servlet-name>
> >    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >    <init-param>
> >      <param-name>maxFileSize</param-name>
> >      <param-value>100K</param-value>
> >    </init-param>
> >    <load-on-startup>2</load-on-startup>
> ></servlet>
> >
> >100 Megabytes:
> >
> ><servlet>
> >    <servlet-name>action</servlet-name>
> >    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >    <init-param>
> >      <param-name>maxFileSize</param-name>
> >      <param-value>100M</param-value>
> >    </init-param>
> >    <load-on-startup>2</load-on-startup>
> ></servlet>
> >
> >100 Gigabytes
> ><servlet>
> >    <servlet-name>action</servlet-name>
> >    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >    <init-param>
> >      <param-name>maxFileSize</param-name>
> >      <param-value>100G</param-value>
> >    </init-param>
> >    <load-on-startup>2</load-on-startup>
> ></servlet>
> >
> >
> >
> >-----Original Message-----
> >From: Ricky Frank [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, September 10, 2001 12:29 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: file upload problems
> >
> >
> >Can you also provide an example of the tag for limiting the size of the
> >file uploaded?  Or is this not supported?  I've dug through some of the
> >underlying code and it looks like it is but I don't see anything in the
>tag
> >definition on how to invoke this limitation.  Thanks.  Ricky Frank
> >
> >At 12:10 PM 9/10/2001 -0400, you wrote:
> >>Rightfully Disgruntled File Upload Users,
> >>
> >>I'll set aside some time next week to address
> >>all the file upload issues, I apologize for the
> >>long delay.
> >>
> >>In the interim, please use bug reports
> >>(http://nagoya.apache.org/bugzilla/)
> >>to report all file upload issues that you
> >>come across.  Check to see if it's reported,
> >>if not, go ahead and do so.  This notifies
> >>me directly.
> >>
> >>
> >>-----Original Message-----
> >>From: Tom Tibbetts [mailto:[EMAIL PROTECTED]]
> >>Sent: Monday, September 10, 2001 9:59 AM
> >>To: [EMAIL PROTECTED]
> >>Subject: file upload mangling files
> >>
> >>
> >>Hi.  What's the status on fixing the file upload problem of files getting
> >>mangled?  I use Struts ver 1.0.  Is there a fix available??? Thanks, This
> >>is very important to us.  Tom Tibbetts
> >
> >
> >_________________________________________________________
> >Do You Yahoo!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to