Thank you, João, for your response.

Unfortunately, it is not working for me.  I tested adding the annotation, and 
my service look almost identical to yours. 

I found this thread https://github.com/osgi/osgi.enroute/issues/65 
<https://github.com/osgi/osgi.enroute/issues/65> in which Tim Ward  explains 
about the need to set “osgi.http.whiteboard.servlet.multipart.enabled=true” in  
the configuration PID “org.apache.aries.jax.rs.whiteboard.default” but that is 
not working either.   It still fails with exception:


java.lang.IllegalStateException: No multipart config for servlet
        at org.eclipse.jetty.server.Request.getParts(Request.java:2378) 
~[!/:9.4.31.v20200723]
        at org.eclipse.jetty.server.Request.getParts(Request.java:2366) 
~[!/:9.4.31.v20200723]
        at 
javax.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:375)
 ~[!/:3.1.0]



Best regards,
Alex soto




> On Nov 13, 2020, at 4:30 AM, João Assunção <[email protected]> 
> wrote:
> 
> Hello Alex,
> 
> I used Multipart with Aries JAX-RS and I'm almost sure I didn't need to mess 
> with the configuration.
> I annotated the class with @MultipartConfig and placed a 
> @Consumes(MediaType.MULIPART_FOR_DATA).
> 
> @Path("/firmware")
> @Component(service = FirmwareService.class, //
> immediate = true, //
> scope = ServiceScope.SINGLETON, property = {
>         JaxrsWhiteboardConstants.JAX_RS_RESOURCE + "=true",
>         JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT + "=(" + 
> JaxrsWhiteboardConstants.JAX_RS_NAME + "=myApp)"
> })
> @MultipartConfig
> public class FirmwareService {
> ....
>     @POST
>     @Path("/upload")
>     @Consumes(MediaType.MULTIPART_FORM_DATA)
>     public Response uploadFirmware(@Context HttpServletRequest request) {
>         try {
>             doUploadFirmware(request);
> 
> Hope this helps
> 
> João Assunção
> 
> Email: [email protected] <mailto:[email protected]>
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com <http://www.exploitsys.com/>
> 
> 
> 
> 
> On Thu, Nov 12, 2020 at 5:25 PM Alex Soto <[email protected] 
> <mailto:[email protected]>> wrote:
> With Karaf 4.3.0, using Aries JAX-RS 1.0.10,  how can I enable multi part 
> support?
> 
> I am  adding configuration file 
> “org.apache.aries.jax.rs.whiteboard.default.cfg”  to the “etc” directory  
> with property:
> 
>       osgi.http.whiteboard.servlet.multipart.enabled=true
> 
> But I am still getting error: 
> 
>       java.lang.IllegalStateException: No multipart config for servlet
> 
> When getting parts from  HttpServletRequest.
> Any help will be appreciated.
> 
> Best regards,
> Alex soto
> 
> 
> 
> 

Reply via email to