I will add the example in the karaf-rest-example then.
> Le 1 déc. 2020 à 14:50, Alex Soto <alex.s...@envieta.com> a écrit :
>
> No problem, thanks.
>
> I think it will help others to have a working example of a File Upload using
> pure OSGi JAX-RS Whiteboard Specification, all the samples I have found do
> not go there.
>
> Best regards,
> Alex soto
>
>
>
>
>> On Dec 1, 2020, at 8:43 AM, Jean-Baptiste Onofre <j...@nanthrax.net
>> <mailto:j...@nanthrax.net>> wrote:
>>
>> Thanks for the update.
>>
>> I’m pretty busy with ActiveMQ, Decanter, Camel and Karaf5 PoC, but I will
>> take a look tomorrow.
>>
>> Regards
>> JB
>>
>>> Le 1 déc. 2020 à 14:29, Alex Soto <alex.s...@envieta.com
>>> <mailto:alex.s...@envieta.com>> a écrit :
>>>
>>> Hi JB,
>>>
>>> Yes, Aries JAXRS 1.0.10.
>>> I suppose it is PAX-WEB, or whatever the default is for Karaf 4.3.0.
>>>
>>> The class:
>>>
>>> import javax.servlet.ServletException;
>>> import javax.servlet.annotation.MultipartConfig;
>>> import javax.servlet.http.HttpServletRequest;
>>> import javax.servlet.http.Part;
>>> import javax.ws.rs.Consumes;
>>> import javax.ws.rs.DELETE;
>>> import javax.ws.rs.GET;
>>> import javax.ws.rs.PATCH;
>>> import javax.ws.rs.POST;
>>> import javax.ws.rs.Path;
>>> import javax.ws.rs.PathParam;
>>> import javax.ws.rs.Produces;
>>> import javax.ws.rs.core.Context;
>>> import javax.ws.rs.core.MediaType;
>>> import javax.ws.rs.core.SecurityContext;
>>> import javax.ws.rs.core.UriInfo;
>>>
>>> @Component(service = FirmwareResource.class, scope = ServiceScope.PROTOTYPE)
>>> @JaxrsResource
>>> @Path(ResourceConstants.FIRMWARE_PATH)
>>> @JaxrsName("firmware")
>>> @JaxrsApplicationSelect(Constants.JAXRS_APP_SELECT)
>>> @Produces(Constants.API_MEDIA_TYPE)
>>> @Protected
>>> @MultipartConfig
>>> public class FirmwareResource {
>>>
>>> @POST
>>> @Consumes(MediaType.MULTIPART_FORM_DATA)
>>> public void upload(@Context HttpServletRequest request) throws
>>> IOException, ServletException {
>>> Collection<Part> parts = request.getParts();
>>> ...
>>>
>>>
>>> Thank you for taking a look at this.
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Dec 1, 2020, at 1:23 AM, Jean-Baptiste Onofre <j...@nanthrax.net
>>>> <mailto:j...@nanthrax.net>> wrote:
>>>>
>>>> Hi Alex,
>>>>
>>>> In order for me to reproduce, are you using:
>>>>
>>>> - Aries JAXRS 1.0.10 still (or did you update) ?
>>>> - Pax Web or Felix as HTTP service ?
>>>> - Do you have JEE @MultipartConfig annotation on your JAXRS class ?
>>>> - @Consumers is set to MediaType.MULTIPART ?
>>>>
>>>> It could be necessary to mimic the JAXRS tests by adding a fragment to
>>>> bring org.apache.cxf.jaxrs.utils.multipart to Aries JAXRS bundle.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>>> Le 30 nov. 2020 à 19:19, Alex Soto <alex.s...@envieta.com
>>>>> <mailto:alex.s...@envieta.com>> a écrit :
>>>>>
>>>>> Hello,
>>>>>
>>>>> Anybody has any insight about this?
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On Nov 13, 2020, at 8:54 AM, Alex Soto <alex.s...@envieta.com
>>>>>> <mailto:alex.s...@envieta.com>> wrote:
>>>>>>
>>>>>> 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
>>>>>>> <joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com>>
>>>>>>> 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: joao.assun...@exploitsys.com
>>>>>>> <mailto:joao.assun...@exploitsys.com>
>>>>>>> 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 <alex.s...@envieta.com
>>>>>>> <mailto:alex.s...@envieta.com>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>