users@jersey.java.net

Re: [Jersey] regarding Multipart missing dependencies and bug ID 575

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Fri, 3 Sep 2010 10:08:01 +0200

On Sep 2, 2010, at 11:36 PM, Mark Petrovic wrote:

> I'm having this same problem with Jersey 1.3 multipart form
> operations:
>
> http://jersey.576304.n2.nabble.com/Jersey-Multipart-Missing-Dependencies-td5453046.html
>
> Until Jersey 1.4 is released,

We have released a promoted build 1.40-ea06 that should work, if you
would like to use that.


> this thread says there is a workaround "to explicitly register the
> class:
> com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider
> withthe resource config."
>
> Can someone please explain how to perform this registration?
>

Otherwise you can create your own instance of Application. For example
if you are using package scanning in your web.xml you can use:

public class MyApp extends PackagesResourceConfig {
   public MyMap(Map<String, String> props) {
     super(props);
      
getClasses
().add
(com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider.class);
   }
}

then add the following init param (retain the init param declaring the
packages):

            <init-param>
                <param-name>javax.ws.rs.Application</param-name>
                <param-value>foo.MyApp</param-value>
            </init-param>
Paul.