users@jax-rs-spec.java.net

[jax-rs-spec users] Re: _at_Logged deep binding

From: Alex Rojkov <alex_at_caucho.com>
Date: Tue, 5 Feb 2013 09:18:07 -0800

> IMO it should.

Thanks. I am adding conditional return to MyResourceClass#hello.

MyResourceClass#hello may return any implementation of Foo. Some implementations may not be annotated with @Logged.

Can you explain how a jaxrs implementation can determine that LogginFilter should be invoked?

Thanks,
Alex

>
> Marek
>
> On Feb 5, 2013, at 3:59 AM, Alex Rojkov <alex_at_caucho.com> wrote:
>
>> Hi All,
>>
>> Given the mapping below, should LoggingFilter get invoked?
>>
>> @Provider
>> @Logged
>> class LoggingFilter implements ContainerRequestFilter,
>> ContainerResponseFilter {
>>
>> }
>>
>> @Path("/")
>> public class MyResourceClass {
>> @Path("{name}")
>> public Foo hello(@PathParam("name") String name) {
            if (name.contains("bogus"))
              return new FooBean2();
            else
>> return new FooBean();
>> }
>> }
>>
>> public interface Foo {
>> }
>>
>> public class FooBean implements Foo {
>> @Logged
>> @GET
>> public String hello() {
>> return "FooBean[]";
>> }
>> }

public class FooBean2 implements Foo {
  @GET
  public String hello() {
      return "FooBean2[]";
  }
}

>>
>> Thanks,
>> Alex
>>
>
>