users@jersey.java.net

[Jersey] How to annotate the _at_MultipartConfig togethe with @ApplicationPath?

From: Charlee Chitsuk <charlee.ch_at_gmail.com>
Date: Wed, 13 Aug 2014 12:59:20 +0700

Hi All,

I've tried to perform the Multipart with Jersey by following the [1]. My
Jersey Application is annotated with "@ApplicationPath" by following the
[2].

I also have some customization by using "@Context HttpServletRequest
request" since I've some old utility class that extract the Multipart from
the Servlet and I would like to reuse it.

Sadly the old utility class give me an exception when accessing the
"request.getParts()" as

java.lang.IllegalStateException:
   Request.getParts is called without multipart configuration.
   Either add a @MultipartConfig to the servlet, or
   a multipart-config element to web.xml

I've tried to annotate my Jersey Application with @MultipartConfig but
there is no luck. I'm not sure I'm doing something wrong or
misunderstanding somewhere or not.

By overview my environment is

OS: MS Widdows 7 - 64 Bits
JDK: 1.7.0_65-b19 - 64Bits
AppServer: Glassfish 4.0.0
Jersey: 2.0 (Since I cannot upgrade the newer Jersey to Glassfish 4.0.0 due
the HK2 issue)

Could you please help to advise further? Thank you very much for your help
in advance.


[1] https://jersey.java.net/documentation/latest/media.html#multipart
[2]
https://jersey.java.net/documentation/latest/deployment.html#deployment.servlet.3

--
   Best Regards,
   Charlee Ch.