users@jersey.java.net

Re: [Jersey] Custom Providers by URL

From: Chris Carrier <ctcarrier_at_gmail.com>
Date: Tue, 13 Jul 2010 13:12:44 -0700

You can inject the information you want. Something like:

@Context UriInfo uri;

That should give you a UriInfo object that has the path and everything you want.

Chris

On Tue, Jul 13, 2010 at 11:27 AM, Tan, Mark <mark.tan_at_mlb.com> wrote:
> Hi Jersey developers,
>
> The JAX-WS spec is great and simplifies the development of REST services.
>
> I have a question regarding registering custom providers.  I have created a
> JIBX provider that allows one to unmarshal and marshall between XML and Java
> types.  I would like to also version my service by specifying the version in
> the URL path.  Versioning would include the version of message binding used
> to marshal and unmarshall the Java types.  Therefore, it is necessary that
> the custom JIBX provider is passed the version, and therefore the URL path
> that contains the version, to be passed to the provider when marshalling or
> unmarshalling.  However, the Provider interfaces (MessageBodyWriter and
> MessageBodyReader) do not provide these parameters to the methods.
>
> The following is the method signature of the writeTo() method of the
> MessageBodyWriter interface:
>
> writeTo(Object, Type, Annotation[], MediaType, MultivaluedMap, OutputStream)
>
> This method parameters does not contain the path uri, therefore, the custom
> jibx provider cannot know which message binding version it should use to
> marshall the Java type.  Is there a way around this?  Is it possible we
> could update the API to include the Path URL.
>
> Your help is greatly appreciated.
>
> Thanks,
> mark
>
>
> Tan, Mark
> mark.tan_at_mlb.com
> phone: 212-485-4503
> cell: 973-943-1224
> aim: markjtan4
>
>
>
>
>
>
> **********************************************************
>
> MLB.com: Where Baseball is Always On
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>