You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
(16) |
Apr
(18) |
May
(13) |
Jun
(100) |
Jul
(165) |
Aug
(53) |
Sep
(41) |
Oct
(84) |
Nov
(113) |
Dec
(171) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(84) |
Feb
(30) |
Mar
(75) |
Apr
(113) |
May
(87) |
Jun
(96) |
Jul
(127) |
Aug
(106) |
Sep
(191) |
Oct
(142) |
Nov
(106) |
Dec
(83) |
| 2010 |
Jan
(62) |
Feb
(93) |
Mar
(92) |
Apr
(58) |
May
(52) |
Jun
(104) |
Jul
(109) |
Aug
(94) |
Sep
(75) |
Oct
(54) |
Nov
(65) |
Dec
(38) |
| 2011 |
Jan
(53) |
Feb
(84) |
Mar
(95) |
Apr
(24) |
May
(10) |
Jun
(49) |
Jul
(74) |
Aug
(23) |
Sep
(67) |
Oct
(21) |
Nov
(62) |
Dec
(50) |
| 2012 |
Jan
(26) |
Feb
(7) |
Mar
(9) |
Apr
(5) |
May
(13) |
Jun
(7) |
Jul
(18) |
Aug
(48) |
Sep
(58) |
Oct
(79) |
Nov
(19) |
Dec
(15) |
| 2013 |
Jan
(33) |
Feb
(21) |
Mar
(10) |
Apr
(22) |
May
(39) |
Jun
(31) |
Jul
(15) |
Aug
(6) |
Sep
(8) |
Oct
(1) |
Nov
(4) |
Dec
(3) |
| 2014 |
Jan
(17) |
Feb
(18) |
Mar
(15) |
Apr
(12) |
May
(11) |
Jun
(3) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(4) |
Nov
(4) |
Dec
(1) |
| 2015 |
Jan
|
Feb
(6) |
Mar
(5) |
Apr
(13) |
May
(2) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(6) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
| 2016 |
Jan
(10) |
Feb
(3) |
Mar
(8) |
Apr
(4) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Michael B. <mic...@gm...> - 2008-10-31 08:33:31
|
client interface:
@GET
@Path("basic")
ClientResponse<byte[]> getBasicBytes();
stacktrace:
org.jboss.resteasy.client.ClientResponseFailure: Unable to find a
MessageBodyReader of content-type text/plain for response of public
abstract org.jboss.resteasy.client.ClientResponse
org.jboss.resteasy.test.finegrain.client.ClientResponseTest$Client.getBasicBytes()
at org.jboss.resteasy.client.core.ClientInvoker.extractClientResponse(ClientInvoker.java:334)
at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:229)
at org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:22)
at $Proxy19.getBasicBytes(Unknown Source)
at org.jboss.resteasy.test.finegrain.client.ClientResponseTest.testClientResponse(ClientResponseTest.java:103)
i tracked it down to this comment in Types.java
// can't figure out how to get a typed array here :(
a patch is attached (fix only, no testcase)
BTW, do you prefer jira tickets directly, or a discussion on the list first?
Michael Brackx
|
|
From: Michael B. <mic...@gm...> - 2008-10-30 21:42:29
|
the client framework requires a content type on response without content
client interface:
@GET
@Path("header")
ClientResponse<Void> getHeader();
use case: no response body, but client needs access to headers
stacktrace:
org.jboss.resteasy.client.ClientResponseFailure: No Content-Type
header specified
at org.jboss.resteasy.client.core.ClientInvoker.extractClientResponse(ClientInvoker.java:309)
at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:229)
at org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:22)
at $Proxy19.getHeader(Unknown Source)
at org.jboss.resteasy.test.finegrain.client.ClientResponseTest.testClientResponse(ClientResponseTest.java:97)
a patch with unit test is included
Michael Brackx
|
|
From: Michael B. <mic...@gm...> - 2008-10-30 21:07:03
|
For me, the build fails on the trunk. Adding a version (0.4?) to the jaxb2 plugin in the resteasy-test-data module fixed it. In general it is best to lock down all plugin versions. Michael Brackx |
|
From: Bill B. <bb...@re...> - 2008-10-30 18:18:57
|
You mean gzip for Content-Encoding, right? No, we don't support it. We'll probably need to add an interceptor layer around response marshalling to do this (unless Tomcat can do it already automatically). I need this anyways for the server-side caching stuff I want to do. Solomon Duskis wrote: > Is there a way to GZip responses in RESTEasy right now? > > -Solomon > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Bill B. <bb...@re...> - 2008-10-30 18:12:44
|
Sweet man! yeah, let's move the spring code out of the main project. I'm going to start to do that with some of the providers too (like YAML for example). Solomon Duskis wrote: > I put in some significant changes in regards to RESTEasy integration > with both Spring and SpringMVC. Currently, all of these changes are in > the resteasy-springwebmvc project. We may want to either put all of > them back into the resteasy-jaxrs, or have a full resteasy-spring > package, and remove dependencies from resteasy-jaxrs. I'll leave that > up to you :). Anyway, here's the functionality > > 1) I added a way for Spring to know how to inject @Context annotations > for either member variables or methods (Constructors/setters) that are > marked with @Autowired > 2) I added a way to customize Resource registration > 3) I added a basic test for the "neat" MVC integration - GroovyView to > follow soon :) > 4) I added the ability to have prototype/request scoped Resources > created by Spring > > take a look at: > > resteasy-springwebmvc/src/test/java/org/jboss/resteasy/springmvc/resources/BasicResource.java > > resteasy-springwebmvc/src/test/java/org/jboss/resteasy/springmvc/resources/BasicSpringTest.java > resteasy-springwebmvc/src/test/resources/spring-test1.xml > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Solomon D. <sd...@gm...> - 2008-10-30 18:05:21
|
Is there a way to GZip responses in RESTEasy right now? -Solomon |
|
From: Solomon D. <sd...@gm...> - 2008-10-30 18:04:42
|
I put in some significant changes in regards to RESTEasy integration with both Spring and SpringMVC. Currently, all of these changes are in the resteasy-springwebmvc project. We may want to either put all of them back into the resteasy-jaxrs, or have a full resteasy-spring package, and remove dependencies from resteasy-jaxrs. I'll leave that up to you :). Anyway, here's the functionality 1) I added a way for Spring to know how to inject @Context annotations for either member variables or methods (Constructors/setters) that are marked with @Autowired 2) I added a way to customize Resource registration 3) I added a basic test for the "neat" MVC integration - GroovyView to follow soon :) 4) I added the ability to have prototype/request scoped Resources created by Spring take a look at: resteasy-springwebmvc/src/test/java/org/jboss/resteasy/springmvc/resources/BasicResource.java resteasy-springwebmvc/src/test/java/org/jboss/resteasy/springmvc/resources/BasicSpringTest.java resteasy-springwebmvc/src/test/resources/spring-test1.xml |
|
From: Solomon D. <sd...@gm...> - 2008-10-30 17:58:05
|
I'm not familiar withe JAXB runtime. How would you hand-code each type? Do
you mean take MyJPAObject and wrap it in MyJPAObjectJAXBWrapper? That's
what Jersy/Netbeans does, which really sucks. This is a fundamental
imedence mismatch between RESTful data and relational data. I'm not sure
how to solve it, but it should be solved.
-Solomon
On Thu, Oct 30, 2008 at 8:30 AM, Bill Burke <bb...@re...> wrote:
> Yes there is something in JAXB, but you have to hand-code each type. I
> wanted to automatically convert relationships to URLs, but I just couldn't
> find a way to generically do it within JAXB.
>
> You have any ideas to get around this?
>
> Solomon Duskis wrote:
>
>> Is there anyway to get something like this to work with JAXB? Can a
>> "Providers" use JPA/Hibernate to convert an object from and to a URL?
>>
>> -Solomon
>>
>> On Wed, Oct 29, 2008 at 5:09 PM, Bill Burke <bb...@re... <mailto:
>> bb...@re...>> wrote:
>>
>> Implemented in Trunk:
>>
>> @PathParam, @QueryParam, @MatrixParam, @FormParam, and @HeaderParam are
>> represented as strings in a raw HTTP request. The specification says
>> that these types of injected parameters can be converted to objects if
>> these objects have a valueOf(String) static method or a constructor
>> that
>> takes one String parameter. What if you have a class where valueOf() or
>> this string constructor doesn't exist or is inappropriate for an HTTP
>> request? Resteasy has a proprietary @Provider interface that you can
>> plug in:
>>
>> package org.jboss.resteasy.spi;
>>
>> public interface StringConverter<T>
>> {
>> T fromString(String str);
>>
>> String toString(T value);
>> }
>>
>>
>> You implement this interface to provide your own custom string
>> marshalling. It is registered within your web.xml under the
>> resteasy.providers context-param (See Installation and Configuration
>> chapter). You can do it manually by calling the
>> ResteasyProviderFactory.addStringConverter() method. Here's a simple
>> example of using a StringConverter:
>>
>> import org.jboss.resteasy.client.ProxyFactory;
>> import org.jboss.resteasy.spi.StringConverter;
>> import org.jboss.resteasy.test.BaseResourceTest;
>> import org.junit.Assert;
>> import org.junit.Before;
>> import org.junit.Test;
>>
>> import javax.ws.rs.HeaderParam;
>> import javax.ws.rs.MatrixParam;
>> import javax.ws.rs.PUT;
>> import javax.ws.rs.Path;
>> import javax.ws.rs.PathParam;
>> import javax.ws.rs.QueryParam;
>> import javax.ws.rs.ext.Provider;
>>
>> public class StringConverterTest extends BaseResourceTest
>> {
>> public static class POJO
>> {
>> private String name;
>>
>> public String getName()
>> {
>> return name;
>> }
>>
>> public void setName(String name)
>> {
>> this.name <http://this.name> = name;
>>
>> }
>> }
>>
>> @Provider
>> public static class POJOConverter implements
>> StringConverter<POJO>
>> {
>> public POJO fromString(String str)
>> {
>> System.out.println("FROM STRNG: " + str);
>> POJO pojo = new POJO();
>> pojo.setName(str);
>> return pojo;
>> }
>>
>> public String toString(POJO value)
>> {
>> return value.getName();
>> }
>> }
>>
>> @Path("/")
>> public static class MyResource
>> {
>> @Path("{pojo}")
>> @PUT
>> public void put(@QueryParam("pojo")POJO q,
>> @PathParam("pojo")POJO pp,
>> @MatrixParam("pojo")POJO mp,
>> @HeaderParam("pojo")POJO hp)
>> {
>> Assert.assertEquals(q.getName(), "pojo");
>> Assert.assertEquals(pp.getName(), "pojo");
>> Assert.assertEquals(mp.getName(), "pojo");
>> Assert.assertEquals(hp.getName(), "pojo");
>> }
>> }
>>
>> @Before
>> public void setUp() throws Exception
>> {
>>
>>
>> dispatcher.getProviderFactory().addStringConverter(POJOConverter.class);
>>
>> dispatcher.getRegistry().addPerRequestResource(MyResource.class);
>> }
>>
>> @Path("/")
>> public static interface MyClient
>> {
>> @Path("{pojo}")
>> @PUT
>> void put(@QueryParam("pojo")POJO q, @PathParam("pojo")POJO pp,
>> @MatrixParam("pojo")POJO mp, @HeaderParam("pojo")POJO
>> hp);
>> }
>>
>> @Test
>> public void testIt() throws Exception
>> {
>> MyClient client = ProxyFactory.create(MyClient.class,
>> "http://localhost:8081");
>> POJO pojo = new POJO();
>> pojo.setName("pojo");
>> client.put(pojo, pojo, pojo, pojo);
>> }
>> }
>>
>>
>>
>> Bill Burke wrote:
>> > I don't want to overload HeaderDelegate.
>> >
>> > I will create a new @Provider interface for this. Something like
>> >
>> > public interface StringConverter<T>
>> > {
>> > T fromString(String val);
>> > String toString(T val);
>> > }
>> >
>> > And then allow its use with @HeaderParam, @QueryParam, @PathParam,
>> > @MatrixParam, and @FormParam injected objects.
>> >
>> > Sound good?
>> >
>> > Michael Brackx wrote:
>> >> That would be nice.
>> >> How could a HeaderDelegate be "activated" for a parameter?
>> >>
>> >> Michael
>> >>
>> >> On Fri, Oct 24, 2008 at 6:19 PM, Bill Burke <bb...@re...
>> <mailto:bb...@re...>> wrote:
>> >>> There's is HeaderDelegate in the specification. I could make
>> sure that is
>> >>> used for all String parameters.
>> >>>
>> >>> Michael Brackx wrote:
>> >>>> Hi,
>> >>>>
>> >>>> It would be nice to have some sort of custom parameter
>> unmarshalling.
>> >>>> Currently parameter types can be String, primitive, or a class
>> that
>> >>>> has a String constructor or static valueOf(String) method.
>> >>>> Some use cases:
>> >>>> - injecting interfaces
>> >>>> - injecting Enums (they already have a static valueOf(String)
>> method)
>> >>>> - injecting thirdparty classes
>> >>>> - injecting factory created objects
>> >>>>
>> >>>> example:
>> >>>>
>> >>>> @GET
>> >>>> @Path("/book/{isbn}")
>> >>>> public String getBook(@PathParm(value = "isbn", provider =
>> >>>> ISBNFactory.class) ISBN id) {
>> >>>> ...
>> >>>> }
>> >>>>
>> >>>> @Provider
>> >>>> public class ISBNFactory {
>> >>>> @ProviderMethod
>> >>>> public ISBN create(String value) {
>> >>>> return new ISBNImpl(value);
>> >>>> }
>> >>>> }
>> >>>>
>> >>>> The @ProviderMethod could be left out if there is only one
>> matching
>> >>>> method.
>> >>>> Or a new interface could be used, to be more in line with
>> ExceptionMapper.
>> >>>>
>> >>>> I realize the spec is final, but someday the will be a 1.1 or
>> 2.0 :)
>> >>>> Any comments?
>> >>>>
>> >>>> Michael Brackx
>> >>>>
>> >>>>
>>
>> -------------------------------------------------------------------------
>> >>>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's
>> >>>> challenge
>> >>>> Build the coolest Linux based applications with Moblin SDK &
>> win great
>> >>>> prizes
>> >>>> Grand prize is a trip for two to an Open Source event anywhere
>> in the
>> >>>> world
>> >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>> >>>> _______________________________________________
>> >>>> Resteasy-developers mailing list
>> >>>> Res...@li...
>> <mailto:Res...@li...>
>> >>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>> >>> --
>> >>> Bill Burke
>> >>> JBoss, a division of Red Hat
>> >>> http://bill.burkecentral.com
>> >>>
>> >
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> <mailto:Res...@li...>
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>>
>>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
|
|
From: Bill B. <bb...@re...> - 2008-10-30 13:06:09
|
There's two ways to do this:
@PUT
public void put(@Context UriInfo uri)
{
boolean exists = uri.getQueryParameters().containsKey("doTest");
}
@PUT
public void put(@QueryParam("doTest") @DefaultValue("NOT EXISTS") String
doTest)
{
boolean exists = !"NOT EXISTS".equals(doTest);
}
Gennady Shumakher wrote:
> Hi,
>
> I wonder whether it is possible to identify the @QueryParam existence
> regardless of the parameter value.
> I mean suppose I want to have service uri to be .../myService?doTest where
> 'doTest' is optional.
> Annotating the method with @Param("doTest") will inject the parameter value
> if parameter is passed or default if it is not, but is there a way to
> differentiate between the cases?
>
> Thanks,
> Gennady
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Bill B. <bb...@re...> - 2008-10-30 12:30:36
|
Yes there is something in JAXB, but you have to hand-code each type. I
wanted to automatically convert relationships to URLs, but I just
couldn't find a way to generically do it within JAXB.
You have any ideas to get around this?
Solomon Duskis wrote:
> Is there anyway to get something like this to work with JAXB? Can a
> "Providers" use JPA/Hibernate to convert an object from and to a URL?
>
> -Solomon
>
> On Wed, Oct 29, 2008 at 5:09 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> Implemented in Trunk:
>
> @PathParam, @QueryParam, @MatrixParam, @FormParam, and @HeaderParam are
> represented as strings in a raw HTTP request. The specification says
> that these types of injected parameters can be converted to objects if
> these objects have a valueOf(String) static method or a constructor that
> takes one String parameter. What if you have a class where valueOf() or
> this string constructor doesn't exist or is inappropriate for an HTTP
> request? Resteasy has a proprietary @Provider interface that you can
> plug in:
>
> package org.jboss.resteasy.spi;
>
> public interface StringConverter<T>
> {
> T fromString(String str);
>
> String toString(T value);
> }
>
>
> You implement this interface to provide your own custom string
> marshalling. It is registered within your web.xml under the
> resteasy.providers context-param (See Installation and Configuration
> chapter). You can do it manually by calling the
> ResteasyProviderFactory.addStringConverter() method. Here's a simple
> example of using a StringConverter:
>
> import org.jboss.resteasy.client.ProxyFactory;
> import org.jboss.resteasy.spi.StringConverter;
> import org.jboss.resteasy.test.BaseResourceTest;
> import org.junit.Assert;
> import org.junit.Before;
> import org.junit.Test;
>
> import javax.ws.rs.HeaderParam;
> import javax.ws.rs.MatrixParam;
> import javax.ws.rs.PUT;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
> import javax.ws.rs.QueryParam;
> import javax.ws.rs.ext.Provider;
>
> public class StringConverterTest extends BaseResourceTest
> {
> public static class POJO
> {
> private String name;
>
> public String getName()
> {
> return name;
> }
>
> public void setName(String name)
> {
> this.name <http://this.name> = name;
> }
> }
>
> @Provider
> public static class POJOConverter implements StringConverter<POJO>
> {
> public POJO fromString(String str)
> {
> System.out.println("FROM STRNG: " + str);
> POJO pojo = new POJO();
> pojo.setName(str);
> return pojo;
> }
>
> public String toString(POJO value)
> {
> return value.getName();
> }
> }
>
> @Path("/")
> public static class MyResource
> {
> @Path("{pojo}")
> @PUT
> public void put(@QueryParam("pojo")POJO q,
> @PathParam("pojo")POJO pp,
> @MatrixParam("pojo")POJO mp,
> @HeaderParam("pojo")POJO hp)
> {
> Assert.assertEquals(q.getName(), "pojo");
> Assert.assertEquals(pp.getName(), "pojo");
> Assert.assertEquals(mp.getName(), "pojo");
> Assert.assertEquals(hp.getName(), "pojo");
> }
> }
>
> @Before
> public void setUp() throws Exception
> {
>
> dispatcher.getProviderFactory().addStringConverter(POJOConverter.class);
>
> dispatcher.getRegistry().addPerRequestResource(MyResource.class);
> }
>
> @Path("/")
> public static interface MyClient
> {
> @Path("{pojo}")
> @PUT
> void put(@QueryParam("pojo")POJO q, @PathParam("pojo")POJO pp,
> @MatrixParam("pojo")POJO mp, @HeaderParam("pojo")POJO
> hp);
> }
>
> @Test
> public void testIt() throws Exception
> {
> MyClient client = ProxyFactory.create(MyClient.class,
> "http://localhost:8081");
> POJO pojo = new POJO();
> pojo.setName("pojo");
> client.put(pojo, pojo, pojo, pojo);
> }
> }
>
>
>
> Bill Burke wrote:
> > I don't want to overload HeaderDelegate.
> >
> > I will create a new @Provider interface for this. Something like
> >
> > public interface StringConverter<T>
> > {
> > T fromString(String val);
> > String toString(T val);
> > }
> >
> > And then allow its use with @HeaderParam, @QueryParam, @PathParam,
> > @MatrixParam, and @FormParam injected objects.
> >
> > Sound good?
> >
> > Michael Brackx wrote:
> >> That would be nice.
> >> How could a HeaderDelegate be "activated" for a parameter?
> >>
> >> Michael
> >>
> >> On Fri, Oct 24, 2008 at 6:19 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
> >>> There's is HeaderDelegate in the specification. I could make
> sure that is
> >>> used for all String parameters.
> >>>
> >>> Michael Brackx wrote:
> >>>> Hi,
> >>>>
> >>>> It would be nice to have some sort of custom parameter
> unmarshalling.
> >>>> Currently parameter types can be String, primitive, or a class
> that
> >>>> has a String constructor or static valueOf(String) method.
> >>>> Some use cases:
> >>>> - injecting interfaces
> >>>> - injecting Enums (they already have a static valueOf(String)
> method)
> >>>> - injecting thirdparty classes
> >>>> - injecting factory created objects
> >>>>
> >>>> example:
> >>>>
> >>>> @GET
> >>>> @Path("/book/{isbn}")
> >>>> public String getBook(@PathParm(value = "isbn", provider =
> >>>> ISBNFactory.class) ISBN id) {
> >>>> ...
> >>>> }
> >>>>
> >>>> @Provider
> >>>> public class ISBNFactory {
> >>>> @ProviderMethod
> >>>> public ISBN create(String value) {
> >>>> return new ISBNImpl(value);
> >>>> }
> >>>> }
> >>>>
> >>>> The @ProviderMethod could be left out if there is only one
> matching
> >>>> method.
> >>>> Or a new interface could be used, to be more in line with
> ExceptionMapper.
> >>>>
> >>>> I realize the spec is final, but someday the will be a 1.1 or
> 2.0 :)
> >>>> Any comments?
> >>>>
> >>>> Michael Brackx
> >>>>
> >>>>
> -------------------------------------------------------------------------
> >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>>> challenge
> >>>> Build the coolest Linux based applications with Moblin SDK &
> win great
> >>>> prizes
> >>>> Grand prize is a trip for two to an Open Source event anywhere
> in the
> >>>> world
> >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> >>>> _______________________________________________
> >>>> Resteasy-developers mailing list
> >>>> Res...@li...
> <mailto:Res...@li...>
> >>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
> >>> --
> >>> Bill Burke
> >>> JBoss, a division of Red Hat
> >>> http://bill.burkecentral.com
> >>>
> >
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Michael B. <mic...@gm...> - 2008-10-30 09:45:07
|
some documentation corrections Michael Brackx |
|
From: Gennady S. <gsh...@gm...> - 2008-10-30 06:37:20
|
Hi,
I wonder whether it is possible to identify the @QueryParam existence
regardless of the parameter value.
I mean suppose I want to have service uri to be .../myService?doTest where
'doTest' is optional.
Annotating the method with @Param("doTest") will inject the parameter value
if parameter is passed or default if it is not, but is there a way to
differentiate between the cases?
Thanks,
Gennady
|
|
From: Solomon D. <sd...@gm...> - 2008-10-30 00:08:13
|
Is there anyway to get something like this to work with JAXB? Can a
"Providers" use JPA/Hibernate to convert an object from and to a URL?
-Solomon
On Wed, Oct 29, 2008 at 5:09 PM, Bill Burke <bb...@re...> wrote:
> Implemented in Trunk:
>
> @PathParam, @QueryParam, @MatrixParam, @FormParam, and @HeaderParam are
> represented as strings in a raw HTTP request. The specification says
> that these types of injected parameters can be converted to objects if
> these objects have a valueOf(String) static method or a constructor that
> takes one String parameter. What if you have a class where valueOf() or
> this string constructor doesn't exist or is inappropriate for an HTTP
> request? Resteasy has a proprietary @Provider interface that you can
> plug in:
>
> package org.jboss.resteasy.spi;
>
> public interface StringConverter<T>
> {
> T fromString(String str);
>
> String toString(T value);
> }
>
>
> You implement this interface to provide your own custom string
> marshalling. It is registered within your web.xml under the
> resteasy.providers context-param (See Installation and Configuration
> chapter). You can do it manually by calling the
> ResteasyProviderFactory.addStringConverter() method. Here's a simple
> example of using a StringConverter:
>
> import org.jboss.resteasy.client.ProxyFactory;
> import org.jboss.resteasy.spi.StringConverter;
> import org.jboss.resteasy.test.BaseResourceTest;
> import org.junit.Assert;
> import org.junit.Before;
> import org.junit.Test;
>
> import javax.ws.rs.HeaderParam;
> import javax.ws.rs.MatrixParam;
> import javax.ws.rs.PUT;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
> import javax.ws.rs.QueryParam;
> import javax.ws.rs.ext.Provider;
>
> public class StringConverterTest extends BaseResourceTest
> {
> public static class POJO
> {
> private String name;
>
> public String getName()
> {
> return name;
> }
>
> public void setName(String name)
> {
> this.name = name;
> }
> }
>
> @Provider
> public static class POJOConverter implements StringConverter<POJO>
> {
> public POJO fromString(String str)
> {
> System.out.println("FROM STRNG: " + str);
> POJO pojo = new POJO();
> pojo.setName(str);
> return pojo;
> }
>
> public String toString(POJO value)
> {
> return value.getName();
> }
> }
>
> @Path("/")
> public static class MyResource
> {
> @Path("{pojo}")
> @PUT
> public void put(@QueryParam("pojo")POJO q,
> @PathParam("pojo")POJO pp,
> @MatrixParam("pojo")POJO mp,
> @HeaderParam("pojo")POJO hp)
> {
> Assert.assertEquals(q.getName(), "pojo");
> Assert.assertEquals(pp.getName(), "pojo");
> Assert.assertEquals(mp.getName(), "pojo");
> Assert.assertEquals(hp.getName(), "pojo");
> }
> }
>
> @Before
> public void setUp() throws Exception
> {
>
> dispatcher.getProviderFactory().addStringConverter(POJOConverter.class);
> dispatcher.getRegistry().addPerRequestResource(MyResource.class);
> }
>
> @Path("/")
> public static interface MyClient
> {
> @Path("{pojo}")
> @PUT
> void put(@QueryParam("pojo")POJO q, @PathParam("pojo")POJO pp,
> @MatrixParam("pojo")POJO mp, @HeaderParam("pojo")POJO
> hp);
> }
>
> @Test
> public void testIt() throws Exception
> {
> MyClient client = ProxyFactory.create(MyClient.class,
> "http://localhost:8081");
> POJO pojo = new POJO();
> pojo.setName("pojo");
> client.put(pojo, pojo, pojo, pojo);
> }
> }
>
>
>
> Bill Burke wrote:
> > I don't want to overload HeaderDelegate.
> >
> > I will create a new @Provider interface for this. Something like
> >
> > public interface StringConverter<T>
> > {
> > T fromString(String val);
> > String toString(T val);
> > }
> >
> > And then allow its use with @HeaderParam, @QueryParam, @PathParam,
> > @MatrixParam, and @FormParam injected objects.
> >
> > Sound good?
> >
> > Michael Brackx wrote:
> >> That would be nice.
> >> How could a HeaderDelegate be "activated" for a parameter?
> >>
> >> Michael
> >>
> >> On Fri, Oct 24, 2008 at 6:19 PM, Bill Burke <bb...@re...> wrote:
> >>> There's is HeaderDelegate in the specification. I could make sure that
> is
> >>> used for all String parameters.
> >>>
> >>> Michael Brackx wrote:
> >>>> Hi,
> >>>>
> >>>> It would be nice to have some sort of custom parameter unmarshalling.
> >>>> Currently parameter types can be String, primitive, or a class that
> >>>> has a String constructor or static valueOf(String) method.
> >>>> Some use cases:
> >>>> - injecting interfaces
> >>>> - injecting Enums (they already have a static valueOf(String) method)
> >>>> - injecting thirdparty classes
> >>>> - injecting factory created objects
> >>>>
> >>>> example:
> >>>>
> >>>> @GET
> >>>> @Path("/book/{isbn}")
> >>>> public String getBook(@PathParm(value = "isbn", provider =
> >>>> ISBNFactory.class) ISBN id) {
> >>>> ...
> >>>> }
> >>>>
> >>>> @Provider
> >>>> public class ISBNFactory {
> >>>> @ProviderMethod
> >>>> public ISBN create(String value) {
> >>>> return new ISBNImpl(value);
> >>>> }
> >>>> }
> >>>>
> >>>> The @ProviderMethod could be left out if there is only one matching
> >>>> method.
> >>>> Or a new interface could be used, to be more in line with
> ExceptionMapper.
> >>>>
> >>>> I realize the spec is final, but someday the will be a 1.1 or 2.0 :)
> >>>> Any comments?
> >>>>
> >>>> Michael Brackx
> >>>>
> >>>>
> -------------------------------------------------------------------------
> >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >>>> challenge
> >>>> Build the coolest Linux based applications with Moblin SDK & win great
> >>>> prizes
> >>>> Grand prize is a trip for two to an Open Source event anywhere in the
> >>>> world
> >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>>> _______________________________________________
> >>>> Resteasy-developers mailing list
> >>>> Res...@li...
> >>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
> >>> --
> >>> Bill Burke
> >>> JBoss, a division of Red Hat
> >>> http://bill.burkecentral.com
> >>>
> >
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
|
|
From: Bill B. <bb...@re...> - 2008-10-29 21:09:18
|
Implemented in Trunk:
@PathParam, @QueryParam, @MatrixParam, @FormParam, and @HeaderParam are
represented as strings in a raw HTTP request. The specification says
that these types of injected parameters can be converted to objects if
these objects have a valueOf(String) static method or a constructor that
takes one String parameter. What if you have a class where valueOf() or
this string constructor doesn't exist or is inappropriate for an HTTP
request? Resteasy has a proprietary @Provider interface that you can
plug in:
package org.jboss.resteasy.spi;
public interface StringConverter<T>
{
T fromString(String str);
String toString(T value);
}
You implement this interface to provide your own custom string
marshalling. It is registered within your web.xml under the
resteasy.providers context-param (See Installation and Configuration
chapter). You can do it manually by calling the
ResteasyProviderFactory.addStringConverter() method. Here's a simple
example of using a StringConverter:
import org.jboss.resteasy.client.ProxyFactory;
import org.jboss.resteasy.spi.StringConverter;
import org.jboss.resteasy.test.BaseResourceTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.ext.Provider;
public class StringConverterTest extends BaseResourceTest
{
public static class POJO
{
private String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
@Provider
public static class POJOConverter implements StringConverter<POJO>
{
public POJO fromString(String str)
{
System.out.println("FROM STRNG: " + str);
POJO pojo = new POJO();
pojo.setName(str);
return pojo;
}
public String toString(POJO value)
{
return value.getName();
}
}
@Path("/")
public static class MyResource
{
@Path("{pojo}")
@PUT
public void put(@QueryParam("pojo")POJO q,
@PathParam("pojo")POJO pp,
@MatrixParam("pojo")POJO mp,
@HeaderParam("pojo")POJO hp)
{
Assert.assertEquals(q.getName(), "pojo");
Assert.assertEquals(pp.getName(), "pojo");
Assert.assertEquals(mp.getName(), "pojo");
Assert.assertEquals(hp.getName(), "pojo");
}
}
@Before
public void setUp() throws Exception
{
dispatcher.getProviderFactory().addStringConverter(POJOConverter.class);
dispatcher.getRegistry().addPerRequestResource(MyResource.class);
}
@Path("/")
public static interface MyClient
{
@Path("{pojo}")
@PUT
void put(@QueryParam("pojo")POJO q, @PathParam("pojo")POJO pp,
@MatrixParam("pojo")POJO mp, @HeaderParam("pojo")POJO
hp);
}
@Test
public void testIt() throws Exception
{
MyClient client = ProxyFactory.create(MyClient.class,
"http://localhost:8081");
POJO pojo = new POJO();
pojo.setName("pojo");
client.put(pojo, pojo, pojo, pojo);
}
}
Bill Burke wrote:
> I don't want to overload HeaderDelegate.
>
> I will create a new @Provider interface for this. Something like
>
> public interface StringConverter<T>
> {
> T fromString(String val);
> String toString(T val);
> }
>
> And then allow its use with @HeaderParam, @QueryParam, @PathParam,
> @MatrixParam, and @FormParam injected objects.
>
> Sound good?
>
> Michael Brackx wrote:
>> That would be nice.
>> How could a HeaderDelegate be "activated" for a parameter?
>>
>> Michael
>>
>> On Fri, Oct 24, 2008 at 6:19 PM, Bill Burke <bb...@re...> wrote:
>>> There's is HeaderDelegate in the specification. I could make sure that is
>>> used for all String parameters.
>>>
>>> Michael Brackx wrote:
>>>> Hi,
>>>>
>>>> It would be nice to have some sort of custom parameter unmarshalling.
>>>> Currently parameter types can be String, primitive, or a class that
>>>> has a String constructor or static valueOf(String) method.
>>>> Some use cases:
>>>> - injecting interfaces
>>>> - injecting Enums (they already have a static valueOf(String) method)
>>>> - injecting thirdparty classes
>>>> - injecting factory created objects
>>>>
>>>> example:
>>>>
>>>> @GET
>>>> @Path("/book/{isbn}")
>>>> public String getBook(@PathParm(value = "isbn", provider =
>>>> ISBNFactory.class) ISBN id) {
>>>> ...
>>>> }
>>>>
>>>> @Provider
>>>> public class ISBNFactory {
>>>> @ProviderMethod
>>>> public ISBN create(String value) {
>>>> return new ISBNImpl(value);
>>>> }
>>>> }
>>>>
>>>> The @ProviderMethod could be left out if there is only one matching
>>>> method.
>>>> Or a new interface could be used, to be more in line with ExceptionMapper.
>>>>
>>>> I realize the spec is final, but someday the will be a 1.1 or 2.0 :)
>>>> Any comments?
>>>>
>>>> Michael Brackx
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>>> challenge
>>>> Build the coolest Linux based applications with Moblin SDK & win great
>>>> prizes
>>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>>> world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> _______________________________________________
>>>> Resteasy-developers mailing list
>>>> Res...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>>
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Bill B. <bb...@re...> - 2008-10-29 18:23:38
|
SURE Solomon Duskis wrote: > Can I update the pom.xml to the latest production version of Spring? > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Solomon D. <sd...@gm...> - 2008-10-29 18:12:36
|
Can I update the pom.xml to the latest production version of Spring? |
|
From: Bill B. <bb...@re...> - 2008-10-28 23:58:00
|
Bug. Didn't know that was the behavior.
Michael Brackx wrote:
> I get a NullPointerException if setting a header to null with the
> ResponseBuilder
> Response.ok().header("header", null).build;
>
> The javadoc for ResponseBuilder.header(String name,Object value)
> states "If value is null then all current headers of the same name
> will be removed."
> So I removed my if's and tried the fluent style for adding multiple
> (optional) headers assuming null's are ok.
> Response.ok().header("header1", value1).header("header2", value2).build;
>
> stacktrace:
> java.lang.NullPointerException
> at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseHeaders.addResponseHeader(HttpServletResponseHeaders.java:56)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseHeaders.add(HttpServletResponseHeaders.java:51)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseHeaders.putAll(HttpServletResponseHeaders.java:120)
> at org.jboss.resteasy.core.SynchronousDispatcher.outputHeaders(SynchronousDispatcher.java:456)
> at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:430)
> at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:357)
> at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:182)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:90)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:66)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> ...
>
>
> Michael Brackx
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Michael B. <mic...@gm...> - 2008-10-28 14:50:22
|
I get a NullPointerException if setting a header to null with the
ResponseBuilder
Response.ok().header("header", null).build;
The javadoc for ResponseBuilder.header(String name,Object value)
states "If value is null then all current headers of the same name
will be removed."
So I removed my if's and tried the fluent style for adding multiple
(optional) headers assuming null's are ok.
Response.ok().header("header1", value1).header("header2", value2).build;
stacktrace:
java.lang.NullPointerException
at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseHeaders.addResponseHeader(HttpServletResponseHeaders.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseHeaders.add(HttpServletResponseHeaders.java:51)
at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseHeaders.putAll(HttpServletResponseHeaders.java:120)
at org.jboss.resteasy.core.SynchronousDispatcher.outputHeaders(SynchronousDispatcher.java:456)
at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:430)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:357)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:182)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:90)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
...
Michael Brackx
|
|
From: Bill B. <bb...@re...> - 2008-10-28 14:25:07
|
Michael Brackx wrote: >> Speaking of security... >> >> Anything Resteasy could do to make it easier? > > What about a filter/interceptor similar to servlet filters, but with a > jax-rs like API (e.g. injectable *Param)? > This would abstract away the problems of the servlet API (like the non > resettable input stream Mike Chack mentioned). > Its a great idea, but will you actually use it? If you promise to use it, I'll do it ;) Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Michael B. <mic...@gm...> - 2008-10-28 12:12:18
|
On Tue, Oct 28, 2008 at 12:59 PM, Bill Burke <bb...@re...> wrote: > Its a great idea, but will you actually use it? If you promise to use it, > I'll do it ;) I'll promise to use it if you promise to try to get it standardized :) Michael Brackx |
|
From: Michael B. <mic...@gm...> - 2008-10-28 07:45:52
|
> Speaking of security... > > Anything Resteasy could do to make it easier? What about a filter/interceptor similar to servlet filters, but with a jax-rs like API (e.g. injectable *Param)? This would abstract away the problems of the servlet API (like the non resettable input stream Mike Chack mentioned). Michael Brackx |
|
From: Solomon D. <sd...@gm...> - 2008-10-27 14:40:30
|
I loaded my first release of the Spring MVC integration into SVN. I made a new Spring MVC module, and made a small change in SynchronousDispatcher. -Solomon |
|
From: Bill B. <bb...@re...> - 2008-10-27 12:23:35
|
Yeah, client and server, although headers can be in response or request.
Michael Brackx wrote:
>> I will create a new @Provider interface for this. Something like
>>
>> public interface StringConverter<T>
>> {
>> T fromString(String val);
>> String toString(T val);
>> }
>>
>> And then allow its use with @HeaderParam, @QueryParam, @PathParam,
>> @MatrixParam, and @FormParam injected objects.
>>
>> Sound good?
> yes, it does.
>
> Should the interface not be split in 2 parts? I suppose the from will
> be used at the server side and the to at the client side.
>
> Michael Brackx
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Michael B. <mic...@gm...> - 2008-10-27 08:40:26
|
> I will create a new @Provider interface for this. Something like
>
> public interface StringConverter<T>
> {
> T fromString(String val);
> String toString(T val);
> }
>
> And then allow its use with @HeaderParam, @QueryParam, @PathParam,
> @MatrixParam, and @FormParam injected objects.
>
> Sound good?
yes, it does.
Should the interface not be split in 2 parts? I suppose the from will
be used at the server side and the to at the client side.
Michael Brackx
|
|
From: Bill B. <bb...@re...> - 2008-10-24 20:29:42
|
I don't want to overload HeaderDelegate.
I will create a new @Provider interface for this. Something like
public interface StringConverter<T>
{
T fromString(String val);
String toString(T val);
}
And then allow its use with @HeaderParam, @QueryParam, @PathParam,
@MatrixParam, and @FormParam injected objects.
Sound good?
Michael Brackx wrote:
> That would be nice.
> How could a HeaderDelegate be "activated" for a parameter?
>
> Michael
>
> On Fri, Oct 24, 2008 at 6:19 PM, Bill Burke <bb...@re...> wrote:
>> There's is HeaderDelegate in the specification. I could make sure that is
>> used for all String parameters.
>>
>> Michael Brackx wrote:
>>> Hi,
>>>
>>> It would be nice to have some sort of custom parameter unmarshalling.
>>> Currently parameter types can be String, primitive, or a class that
>>> has a String constructor or static valueOf(String) method.
>>> Some use cases:
>>> - injecting interfaces
>>> - injecting Enums (they already have a static valueOf(String) method)
>>> - injecting thirdparty classes
>>> - injecting factory created objects
>>>
>>> example:
>>>
>>> @GET
>>> @Path("/book/{isbn}")
>>> public String getBook(@PathParm(value = "isbn", provider =
>>> ISBNFactory.class) ISBN id) {
>>> ...
>>> }
>>>
>>> @Provider
>>> public class ISBNFactory {
>>> @ProviderMethod
>>> public ISBN create(String value) {
>>> return new ISBNImpl(value);
>>> }
>>> }
>>>
>>> The @ProviderMethod could be left out if there is only one matching
>>> method.
>>> Or a new interface could be used, to be more in line with ExceptionMapper.
>>>
>>> I realize the spec is final, but someday the will be a 1.1 or 2.0 :)
>>> Any comments?
>>>
>>> Michael Brackx
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Resteasy-developers mailing list
>>> Res...@li...
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|