You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Parchuri, Chad" <cp...@ets.org> on 2004/01/28 17:43:11 UTC

RE: Websphere and fileupload problem -- Error"Stream ended unexpe cted ly

The code is same. In the html side i am setting 
the  

   top.Body.document.calform.encoding = "multipart/form-data";
      top.Body.document.calform.url.value = "save";
      top.Body.document.calform.submit();

and the form parameters are

  <form name=calform method="POST" Action="<%=
response.encodeRedirectURL("/TopicSupportPresentation?as_presentation=toSave
OrAddTopicDataMaintenance") %>" > 

and Are you saying there is a setting in websphere or webserver to use
multipart handler?

If yes, can you tell me the setting parameter, so i can check on it.


Thanks
Chad

-----Original Message-----
From: Martin Cooper [mailto:martinc@apache.org]
Sent: Wednesday, January 28, 2004 01:20 AM
To: Jakarta Commons Users List
Subject: Re: Websphere and fileupload problem -- Error"Stream ended
unexpected ly


On Tue, 27 Jan 2004, Parchuri, Chad wrote:

> I tried file upload in my local environment NT IE Browser 5.5, Websphere
> Studio, which works fine. when I migrarted the code to SUN SOLARIS
websphere
> 4.0 box, IE 5.5. i am getting the following error.
>
> "Stream ended unexpectedly."

This most commonly happens when some other code has already consumed the
request input stream. I'm not too familiar with Websphere, but is it
possible that one version includes a multipart handler by default, while
it is disabled by default in the other? (Or that your code is in not quite
the same web app environment in the two different containers?)

--
Martin Cooper


>
> i could only upupload a file size of 6K
>
> Any help will be highly appreciated. thanks
>
> Here is the snippet of code, i am using.
>
>
> 			boolean isMultipart =
> FileUpload.isMultipartContent(req);
>
> 			// if not, send to message page with the error
> message
> 			if(!isMultipart){
> 				throw new OSNException("Request was
> notmultipart, and cannot be uploaded. ", 3, "NO", "N/A");
> 			}
> 			// now lets create a handler for the upload request.
> 			DiskFileUpload upload = new DiskFileUpload();
>
> 			upload.setSizeMax(1000000);
>         	// maximum size that will be stored in memory
>         	upload.setSizeThreshold(1024000);
>         	// the location for saving data that is larger than
> getSizeThreshold()
>         	upload.setRepositoryPath("/tmp");
>
> 			// parse this request by the handler
> 			// this gives us a list of items from the request
> 			List items = upload.parseRequest(req);
>
> 			// now iterate over this list
> 			Iterator itr = items.iterator();
> 	        long formDatalength = 0;
> 			while(itr.hasNext())
> 			{
> 				FileItem item = (FileItem) itr.next();
>
> 				if
>
> (!item.getFieldName().equalsIgnoreCase("myimage"))
> 				{
> 					.....
> 				}
> 				else
> 				{
> 					byte[] dataByte = item.get();
>
> 					TopicImageImpl topicImageImpl =
> newTopicImageImpl();
>
>
> topicImageImpl.setTopicImage(dataByte);
> 				}
>
>
>
>
>
>
>
> **************************************************************************
> This e-mail and any files transmitted with it may contain privileged or
> confidential information. It is solely for use by the individual for whom
> it is intended, even if addressed incorrectly. If you received this e-mail
> in error, please notify the sender; do not disclose, copy, distribute, or
> take any action in reliance on the contents of this information; and
delete
> it from your system. Any other use of this e-mail is prohibited. Thank you
> for your compliance.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



************************************************************************** 
This e-mail and any files transmitted with it may contain privileged or 
confidential information. It is solely for use by the individual for whom 
it is intended, even if addressed incorrectly. If you received this e-mail 
in error, please notify the sender; do not disclose, copy, distribute, or 
take any action in reliance on the contents of this information; and delete 
it from your system. Any other use of this e-mail is prohibited. Thank you 
for your compliance.




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


RE: Websphere and fileupload problem -- Error"Stream ended unexpe cted ly

Posted by Martin Cooper <ma...@apache.org>.
On Wed, 28 Jan 2004, Parchuri, Chad wrote:

> The code is same. In the html side i am setting
> the
>
>    top.Body.document.calform.encoding = "multipart/form-data";
>       top.Body.document.calform.url.value = "save";
>       top.Body.document.calform.submit();
>
> and the form parameters are
>
>   <form name=calform method="POST" Action="<%=
> response.encodeRedirectURL("/TopicSupportPresentation?as_presentation=toSave
> OrAddTopicDataMaintenance") %>" >
>
> and Are you saying there is a setting in websphere or webserver to use
> multipart handler?

No, I'm asking you. ;-) I'm speculating that the reason the error is
occurring is that some part of Websphere has already consumed the input
stream. If your HTML is the same, the browser is the same, and the web app
is the same, that pretty much narrows it down to the container, I think...
But since I'm not familiar with Websphere, I can't help you there, I'm
afraid.

--
Martin Cooper


>
> If yes, can you tell me the setting parameter, so i can check on it.
>
>
> Thanks
> Chad
>
> -----Original Message-----
> From: Martin Cooper [mailto:martinc@apache.org]
> Sent: Wednesday, January 28, 2004 01:20 AM
> To: Jakarta Commons Users List
> Subject: Re: Websphere and fileupload problem -- Error"Stream ended
> unexpected ly
>
>
> On Tue, 27 Jan 2004, Parchuri, Chad wrote:
>
> > I tried file upload in my local environment NT IE Browser 5.5, Websphere
> > Studio, which works fine. when I migrarted the code to SUN SOLARIS
> websphere
> > 4.0 box, IE 5.5. i am getting the following error.
> >
> > "Stream ended unexpectedly."
>
> This most commonly happens when some other code has already consumed the
> request input stream. I'm not too familiar with Websphere, but is it
> possible that one version includes a multipart handler by default, while
> it is disabled by default in the other? (Or that your code is in not quite
> the same web app environment in the two different containers?)
>
> --
> Martin Cooper
>
>
> >
> > i could only upupload a file size of 6K
> >
> > Any help will be highly appreciated. thanks
> >
> > Here is the snippet of code, i am using.
> >
> >
> > 			boolean isMultipart =
> > FileUpload.isMultipartContent(req);
> >
> > 			// if not, send to message page with the error
> > message
> > 			if(!isMultipart){
> > 				throw new OSNException("Request was
> > notmultipart, and cannot be uploaded. ", 3, "NO", "N/A");
> > 			}
> > 			// now lets create a handler for the upload request.
> > 			DiskFileUpload upload = new DiskFileUpload();
> >
> > 			upload.setSizeMax(1000000);
> >         	// maximum size that will be stored in memory
> >         	upload.setSizeThreshold(1024000);
> >         	// the location for saving data that is larger than
> > getSizeThreshold()
> >         	upload.setRepositoryPath("/tmp");
> >
> > 			// parse this request by the handler
> > 			// this gives us a list of items from the request
> > 			List items = upload.parseRequest(req);
> >
> > 			// now iterate over this list
> > 			Iterator itr = items.iterator();
> > 	        long formDatalength = 0;
> > 			while(itr.hasNext())
> > 			{
> > 				FileItem item = (FileItem) itr.next();
> >
> > 				if
> >
> > (!item.getFieldName().equalsIgnoreCase("myimage"))
> > 				{
> > 					.....
> > 				}
> > 				else
> > 				{
> > 					byte[] dataByte = item.get();
> >
> > 					TopicImageImpl topicImageImpl =
> > newTopicImageImpl();
> >
> >
> > topicImageImpl.setTopicImage(dataByte);
> > 				}
> >
> >
> >
> >
> >
> >
> >
> > **************************************************************************
> > This e-mail and any files transmitted with it may contain privileged or
> > confidential information. It is solely for use by the individual for whom
> > it is intended, even if addressed incorrectly. If you received this e-mail
> > in error, please notify the sender; do not disclose, copy, distribute, or
> > take any action in reliance on the contents of this information; and
> delete
> > it from your system. Any other use of this e-mail is prohibited. Thank you
> > for your compliance.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
> **************************************************************************
> This e-mail and any files transmitted with it may contain privileged or
> confidential information. It is solely for use by the individual for whom
> it is intended, even if addressed incorrectly. If you received this e-mail
> in error, please notify the sender; do not disclose, copy, distribute, or
> take any action in reliance on the contents of this information; and delete
> it from your system. Any other use of this e-mail is prohibited. Thank you
> for your compliance.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org