Paul Sandoz wrote:
> Hi Craig,
>
> Ah! drat forgot to do this in the Client constructor:
>
> injectableFactory.configure(providerServices);
>
> which processes use-registered providers. I will fix that tomorrow.
>
Your fix does indeed make my injectable provider work on the client side
... thanks! However, I find that I still have to explicitly register
all my providers in the client config before they are recognized.
Shouldn't the following code (from the setup method of
MultiPartReaderWriterTest) work without the four add() calls? All of
the listed providers are in package "com.sun.jersey.impl.multipart" so I
would have expected the package scanner to find them.
Craig
@Override
protected void setUp() throws Exception {
super.setUp();
Map<String,String> initParams = new HashMap<String,String>();
initParams.put("com.sun.jersey.config.property.resourceConfigClass",
"com.sun.jersey.api.core.PackagesResourceConfig");
initParams.put("com.sun.jersey.config.property.packages",
"com.sun.jersey.impl.multipart");
System.out.println("Starting grizzly ...");
selectorThread = GrizzlyWebContainerFactory.create(BASE_URI,
initParams)
;
ClientConfig config = new DefaultClientConfig();
config.getClasses().add(MultiPartReader.class);
config.getClasses().add(MultiPartWriter.class);
config.getClasses().add(MultiPartBeanProvider.class);
config.getClasses().add(MultiPartConfigProvider.class);
client = Client.create(config);
}