Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multipart content not working after release 9.3.11 #3596

Closed
exdirectory opened this issue Apr 26, 2019 · 6 comments
Closed

Multipart content not working after release 9.3.11 #3596

exdirectory opened this issue Apr 26, 2019 · 6 comments

Comments

@exdirectory
Copy link

exdirectory commented Apr 26, 2019

I have tried a few times to use later versions but find our file upload code fails each time, this is what we are doing...

  request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, new MultipartConfigElement(System.getProperty("java.io.tmpdir")));
  String contentType = request.getContentType();
  if (contentType != null && contentType.startsWith("multipart/form-data")) {
     for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
	    ...

On 3.11 this works fine, on anything later it crashes out on the request.getParameterMap(). Did a new library get added that we might be missing or a change in spec?

@sbordet
Copy link
Contributor

sbordet commented Apr 26, 2019

Multipart must be handled with https://docs.oracle.com/javaee/6/tutorial/doc/gmhba.html.

I'm surprised getParameterMap() ever worked with multipart.

Please update your code to use the correct API and report back if it works for you.
Also update to 9.4.x is recommended (wait for 9.4.18).

@exdirectory
Copy link
Author

exdirectory commented May 3, 2019

Hi, yes, i am using already getParts after getParameterMap(). So if i lose getParameterMap() and then call
for (Part part : request.getParts()) {

I get the same, crashes out. I am now thinking maybe i am missing a library, we use ant builds so not automatically pulling in all jetty and javax libs maybe. Would you happen to know which one this would be looking for and I can check that?

I am using 9.4.9 BTW.

@joakime
Copy link
Contributor

joakime commented May 3, 2019 via email

@exdirectory
Copy link
Author

No , unusually not, which is why it makes me think it could be missing library. Using Eclipse in debug, just literally bombs out. Like the web servlet call terminates and nothing more happens.

@joakime
Copy link
Contributor

joakime commented May 5, 2019

Regarding the debugging in Eclipse ...

The Jetty threads are likely timing out and being terminated.
So make sure you set your ServerConnector and HttpConfiguration idle timeouts to something huge when you are debugging.

@exdirectory
Copy link
Author

Solved, was bringing in wrong servlet-api jar version.

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants