You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Bayer <mi...@gameforge.de> on 2010/09/16 17:42:09 UTC

ComponentSource.getPage ignores Annotations

Hi!

I've searched google far and wide, but I don't seem to be able to find a 
solution to this problem:

The instance of java.lang.Class returned by ComponentSource.getPage() 
seems to be broken - it does not have any of the Annotations the 
original Page class does have...

To reproduce this I created a TestAnnotation:

---------

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface TestAnnotation {

}

---------

... and added it to my page class. I then created a 
ComponentRequestFilter that uses a ComponentSource to acquire  an 
instance of said class and tries to determine whether it is annotated 
with TestAnnotation:

---------

     private void annotationTest(String pageName) {
         Component page = componentSource.getPage(pageName);

         Class<?> pageClass = page.getClass();

         if (isAnnotationPresent(pageClass)) {
             System.out.println("heureka!");
         } else {
             System.out.println("wtf tapestry? You're doing it wrong!");
         }

         if (isAnnotationPresent(Index.class)) {
             System.out.println("this is how it should be!");
         } else {
             System.out.println("Java is broken - we're all gonna die!");
         }

         System.out.println(String.format("oh, and by the way: %b", 
(page instanceof Index)));
         System.out.println(String.format("and neither is: %b", 
Index.class.equals(pageClass)));
     }

     private boolean isAnnotationPresent(Class<?> pageClass) {
         System.out.println(String.format("class: %s", pageClass));
         boolean annotationPresent = 
pageClass.isAnnotationPresent(TestAnnotation.class);
         System.out.println(String.format("annotation present: %b", 
annotationPresent));
         return annotationPresent;
     }

---------

The output is:

---------
class: class test.pages.Index
annotation present: false
wtf tapestry? You're doing it wrong!
class: class test.pages.Index
annotation present: true
this is how it should be!
oh, and by the way: false
and neither is: false
---------

The page that is returned by ComponentSource.getPage() seems to not have 
the annotation.
Is this desired behavior? I found many tutorials out there (some in the 
tapestry wiki) that seem to use the exact same method to get the 
annotations of a page class.

I've put together a small project containing my test code, you can find 
it here:

http://satansoft.de/tapestry/annotationtest.zip  (~20k)

Just run
# > mvn package jetty:run
and access
http://localhost:8080/annotationtest/
to reproduce this behavior.

Does anybody else experience this? Is it my fault?

Thanks in advance for your time

Tapestry Version: 5.2.0
Reproduced on Jetty and Glassfish

-- 
Michael Bayer
Software Developer

Gameforge Productions GmbH
Albert-Nestler-Straße 8
D-76131 Karlsruhe

Tel. +49 721 354 808-0
Fax  +49 721 354 808-152

michael.bayer@gameforge.de

http://www.gameforge.de

Amtsgericht Mannheim, HRB 701682
USt-ID: DE 254 298 652

Geschäftsführer: Alexander Rösner, Christoph Jennen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ComponentSource.getPage ignores Annotations

Posted by françois facon <fr...@gmail.com>.
my 2 cents

same ComponentRequestFilter same annotation moved into the test web app of
andreas fork of got5 http://github.com/andyhot/tapestry5-jquery.git (5.2)
provide the following output

class: class org.got5.tapestry5.jquery.test.pages.Index
annotation present: true
heureka!
class: class org.got5.tapestry5.jquery.test.pages.Index
annotation present: true
this is how it should be!
oh, and by the way: false
and neither is: false

HTH

Re: ComponentSource.getPage ignores Annotations

Posted by françois facon <fr...@gmail.com>.
Hi Michael,

Same Trace on my noteBook

[DEBUG] services.TestFilter Loading class test.services.TestFilter.
class: class test.pages.Index
annotation present: false
wtf tapestry? You're doing it wrong!
class: class test.pages.Index
annotation present: true
this is how it should be!
oh, and by the way: false
and neither is: false

HTH

Re: ComponentSource.getPage ignores Annotations

Posted by Michael Bayer <mi...@gameforge.de>.
well, there is only one Index.class in the .war file:

# >jar -tf annotationtest.war |grep Index.class
WEB-INF/classes/test/pages/Index.class

The application I put together really doesn't contain much besides the 
classes I mentioned:

http://satansoft.de/tapestry/annotationtest.zip

Could anyone try to verify this behavior? Just unpack the archive and do 
a quick mvn jetty:run, then direct your browser to

http://localhost:8080/annotationtest/

Right now I only have access to my notebook so I can't try this with 
different setups...


On 09/16/2010 06:24 PM, Howard Lewis Ship wrote:
> Something else must be in play ... I have a lot of code that looks
> just like yours (get the page class, look for custom annotations) and
> I have tests to prove it works.
>
> I wonder if you are picking up two different versions of Index.class
> through some kind of class loader snafu.  I'd start by searching your
> WAR or target directory for Index.class files and see if there's more
> than one.
>
> On Thu, Sep 16, 2010 at 9:02 AM, Josh Canfield<jo...@gmail.com>  wrote:
>    
>> Ignore that.. I was thinking about another API, I see that you are
>> getting it from componentsource which is returning the root component
>>
>> On Thu, Sep 16, 2010 at 8:58 AM, Josh Canfield<jo...@gmail.com>  wrote:
>>      
>>> Correct, the Page you get is not the class that represents the page.
>>>
>>> Check the docs:
>>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/internal/structure/Page.html
>>>
>>> Check the root component of the page.
>>>
>>> Josh
>>>
>>> On Thu, Sep 16, 2010 at 8:42 AM, Michael Bayer
>>> <mi...@gameforge.de>  wrote:
>>>        
>>>> Hi!
>>>>
>>>> I've searched google far and wide, but I don't seem to be able to find a
>>>> solution to this problem:
>>>>
>>>> The instance of java.lang.Class returned by ComponentSource.getPage() seems
>>>> to be broken - it does not have any of the Annotations the original Page
>>>> class does have...
>>>>
>>>> To reproduce this I created a TestAnnotation:
>>>>
>>>> ---------
>>>>
>>>> @Target(ElementType.TYPE)
>>>> @Retention(RetentionPolicy.RUNTIME)
>>>> @Documented
>>>> public @interface TestAnnotation {
>>>>
>>>> }
>>>>
>>>> ---------
>>>>
>>>> ... and added it to my page class. I then created a ComponentRequestFilter
>>>> that uses a ComponentSource to acquire  an instance of said class and tries
>>>> to determine whether it is annotated with TestAnnotation:
>>>>
>>>> ---------
>>>>
>>>>     private void annotationTest(String pageName) {
>>>>         Component page = componentSource.getPage(pageName);
>>>>
>>>>         Class<?>  pageClass = page.getClass();
>>>>
>>>>         if (isAnnotationPresent(pageClass)) {
>>>>             System.out.println("heureka!");
>>>>         } else {
>>>>             System.out.println("wtf tapestry? You're doing it wrong!");
>>>>         }
>>>>
>>>>         if (isAnnotationPresent(Index.class)) {
>>>>             System.out.println("this is how it should be!");
>>>>         } else {
>>>>             System.out.println("Java is broken - we're all gonna die!");
>>>>         }
>>>>
>>>>         System.out.println(String.format("oh, and by the way: %b", (page
>>>> instanceof Index)));
>>>>         System.out.println(String.format("and neither is: %b",
>>>> Index.class.equals(pageClass)));
>>>>     }
>>>>
>>>>     private boolean isAnnotationPresent(Class<?>  pageClass) {
>>>>         System.out.println(String.format("class: %s", pageClass));
>>>>         boolean annotationPresent =
>>>> pageClass.isAnnotationPresent(TestAnnotation.class);
>>>>         System.out.println(String.format("annotation present: %b",
>>>> annotationPresent));
>>>>         return annotationPresent;
>>>>     }
>>>>
>>>> ---------
>>>>
>>>> The output is:
>>>>
>>>> ---------
>>>> class: class test.pages.Index
>>>> annotation present: false
>>>> wtf tapestry? You're doing it wrong!
>>>> class: class test.pages.Index
>>>> annotation present: true
>>>> this is how it should be!
>>>> oh, and by the way: false
>>>> and neither is: false
>>>> ---------
>>>>
>>>> The page that is returned by ComponentSource.getPage() seems to not have the
>>>> annotation.
>>>> Is this desired behavior? I found many tutorials out there (some in the
>>>> tapestry wiki) that seem to use the exact same method to get the annotations
>>>> of a page class.
>>>>
>>>> I've put together a small project containing my test code, you can find it
>>>> here:
>>>>
>>>> http://satansoft.de/tapestry/annotationtest.zip  (~20k)
>>>>
>>>> Just run
>>>> #>  mvn package jetty:run
>>>> and access
>>>> http://localhost:8080/annotationtest/
>>>> to reproduce this behavior.
>>>>
>>>> Does anybody else experience this? Is it my fault?
>>>>
>>>> Thanks in advance for your time
>>>>
>>>> Tapestry Version: 5.2.0
>>>> Reproduced on Jetty and Glassfish
>>>>
>>>> --
>>>> Michael Bayer
>>>> Software Developer
>>>>
>>>> Gameforge Productions GmbH
>>>> Albert-Nestler-Straße 8
>>>> D-76131 Karlsruhe
>>>>
>>>> Tel. +49 721 354 808-0
>>>> Fax  +49 721 354 808-152
>>>>
>>>> michael.bayer@gameforge.de
>>>>
>>>> http://www.gameforge.de
>>>>
>>>> Amtsgericht Mannheim, HRB 701682
>>>> USt-ID: DE 254 298 652
>>>>
>>>> Geschäftsführer: Alexander Rösner, Christoph Jennen
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>          
>>>
>>>
>>> --
>>> --
>>> http://www.bodylabgym.com - a private, by appointment only, one-on-one
>>> health and fitness facility.
>>> --
>>> http://www.ectransition.com - Quality Electronic Cigarettes at a
>>> reasonable price!
>>> --
>>> TheDailyTube.com. Sign up and get the best new videos on the internet
>>> delivered fresh to your inbox.
>>>
>>>        
>>
>>
>> --
>> --
>> http://www.bodylabgym.com - a private, by appointment only, one-on-one
>> health and fitness facility.
>> --
>> http://www.ectransition.com - Quality Electronic Cigarettes at a
>> reasonable price!
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>      
>
>
>    


-- 
Michael Bayer
Software Developer

Gameforge Productions GmbH
Albert-Nestler-Straße 8
D-76131 Karlsruhe

Tel. +49 721 354 808-0
Fax  +49 721 354 808-152

michael.bayer@gameforge.de

http://www.gameforge.de

Amtsgericht Mannheim, HRB 701682
USt-ID: DE 254 298 652

Geschäftsführer: Alexander Rösner, Christoph Jennen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ComponentSource.getPage ignores Annotations

Posted by Howard Lewis Ship <hl...@gmail.com>.
Something else must be in play ... I have a lot of code that looks
just like yours (get the page class, look for custom annotations) and
I have tests to prove it works.

I wonder if you are picking up two different versions of Index.class
through some kind of class loader snafu.  I'd start by searching your
WAR or target directory for Index.class files and see if there's more
than one.

On Thu, Sep 16, 2010 at 9:02 AM, Josh Canfield <jo...@gmail.com> wrote:
> Ignore that.. I was thinking about another API, I see that you are
> getting it from componentsource which is returning the root component
>
> On Thu, Sep 16, 2010 at 8:58 AM, Josh Canfield <jo...@gmail.com> wrote:
>> Correct, the Page you get is not the class that represents the page.
>>
>> Check the docs:
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/internal/structure/Page.html
>>
>> Check the root component of the page.
>>
>> Josh
>>
>> On Thu, Sep 16, 2010 at 8:42 AM, Michael Bayer
>> <mi...@gameforge.de> wrote:
>>> Hi!
>>>
>>> I've searched google far and wide, but I don't seem to be able to find a
>>> solution to this problem:
>>>
>>> The instance of java.lang.Class returned by ComponentSource.getPage() seems
>>> to be broken - it does not have any of the Annotations the original Page
>>> class does have...
>>>
>>> To reproduce this I created a TestAnnotation:
>>>
>>> ---------
>>>
>>> @Target(ElementType.TYPE)
>>> @Retention(RetentionPolicy.RUNTIME)
>>> @Documented
>>> public @interface TestAnnotation {
>>>
>>> }
>>>
>>> ---------
>>>
>>> ... and added it to my page class. I then created a ComponentRequestFilter
>>> that uses a ComponentSource to acquire  an instance of said class and tries
>>> to determine whether it is annotated with TestAnnotation:
>>>
>>> ---------
>>>
>>>    private void annotationTest(String pageName) {
>>>        Component page = componentSource.getPage(pageName);
>>>
>>>        Class<?> pageClass = page.getClass();
>>>
>>>        if (isAnnotationPresent(pageClass)) {
>>>            System.out.println("heureka!");
>>>        } else {
>>>            System.out.println("wtf tapestry? You're doing it wrong!");
>>>        }
>>>
>>>        if (isAnnotationPresent(Index.class)) {
>>>            System.out.println("this is how it should be!");
>>>        } else {
>>>            System.out.println("Java is broken - we're all gonna die!");
>>>        }
>>>
>>>        System.out.println(String.format("oh, and by the way: %b", (page
>>> instanceof Index)));
>>>        System.out.println(String.format("and neither is: %b",
>>> Index.class.equals(pageClass)));
>>>    }
>>>
>>>    private boolean isAnnotationPresent(Class<?> pageClass) {
>>>        System.out.println(String.format("class: %s", pageClass));
>>>        boolean annotationPresent =
>>> pageClass.isAnnotationPresent(TestAnnotation.class);
>>>        System.out.println(String.format("annotation present: %b",
>>> annotationPresent));
>>>        return annotationPresent;
>>>    }
>>>
>>> ---------
>>>
>>> The output is:
>>>
>>> ---------
>>> class: class test.pages.Index
>>> annotation present: false
>>> wtf tapestry? You're doing it wrong!
>>> class: class test.pages.Index
>>> annotation present: true
>>> this is how it should be!
>>> oh, and by the way: false
>>> and neither is: false
>>> ---------
>>>
>>> The page that is returned by ComponentSource.getPage() seems to not have the
>>> annotation.
>>> Is this desired behavior? I found many tutorials out there (some in the
>>> tapestry wiki) that seem to use the exact same method to get the annotations
>>> of a page class.
>>>
>>> I've put together a small project containing my test code, you can find it
>>> here:
>>>
>>> http://satansoft.de/tapestry/annotationtest.zip  (~20k)
>>>
>>> Just run
>>> # > mvn package jetty:run
>>> and access
>>> http://localhost:8080/annotationtest/
>>> to reproduce this behavior.
>>>
>>> Does anybody else experience this? Is it my fault?
>>>
>>> Thanks in advance for your time
>>>
>>> Tapestry Version: 5.2.0
>>> Reproduced on Jetty and Glassfish
>>>
>>> --
>>> Michael Bayer
>>> Software Developer
>>>
>>> Gameforge Productions GmbH
>>> Albert-Nestler-Straße 8
>>> D-76131 Karlsruhe
>>>
>>> Tel. +49 721 354 808-0
>>> Fax  +49 721 354 808-152
>>>
>>> michael.bayer@gameforge.de
>>>
>>> http://www.gameforge.de
>>>
>>> Amtsgericht Mannheim, HRB 701682
>>> USt-ID: DE 254 298 652
>>>
>>> Geschäftsführer: Alexander Rösner, Christoph Jennen
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> --
>> http://www.bodylabgym.com - a private, by appointment only, one-on-one
>> health and fitness facility.
>> --
>> http://www.ectransition.com - Quality Electronic Cigarettes at a
>> reasonable price!
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>
>
>
> --
> --
> http://www.bodylabgym.com - a private, by appointment only, one-on-one
> health and fitness facility.
> --
> http://www.ectransition.com - Quality Electronic Cigarettes at a
> reasonable price!
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ComponentSource.getPage ignores Annotations

Posted by Josh Canfield <jo...@gmail.com>.
Ignore that.. I was thinking about another API, I see that you are
getting it from componentsource which is returning the root component

On Thu, Sep 16, 2010 at 8:58 AM, Josh Canfield <jo...@gmail.com> wrote:
> Correct, the Page you get is not the class that represents the page.
>
> Check the docs:
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/internal/structure/Page.html
>
> Check the root component of the page.
>
> Josh
>
> On Thu, Sep 16, 2010 at 8:42 AM, Michael Bayer
> <mi...@gameforge.de> wrote:
>> Hi!
>>
>> I've searched google far and wide, but I don't seem to be able to find a
>> solution to this problem:
>>
>> The instance of java.lang.Class returned by ComponentSource.getPage() seems
>> to be broken - it does not have any of the Annotations the original Page
>> class does have...
>>
>> To reproduce this I created a TestAnnotation:
>>
>> ---------
>>
>> @Target(ElementType.TYPE)
>> @Retention(RetentionPolicy.RUNTIME)
>> @Documented
>> public @interface TestAnnotation {
>>
>> }
>>
>> ---------
>>
>> ... and added it to my page class. I then created a ComponentRequestFilter
>> that uses a ComponentSource to acquire  an instance of said class and tries
>> to determine whether it is annotated with TestAnnotation:
>>
>> ---------
>>
>>    private void annotationTest(String pageName) {
>>        Component page = componentSource.getPage(pageName);
>>
>>        Class<?> pageClass = page.getClass();
>>
>>        if (isAnnotationPresent(pageClass)) {
>>            System.out.println("heureka!");
>>        } else {
>>            System.out.println("wtf tapestry? You're doing it wrong!");
>>        }
>>
>>        if (isAnnotationPresent(Index.class)) {
>>            System.out.println("this is how it should be!");
>>        } else {
>>            System.out.println("Java is broken - we're all gonna die!");
>>        }
>>
>>        System.out.println(String.format("oh, and by the way: %b", (page
>> instanceof Index)));
>>        System.out.println(String.format("and neither is: %b",
>> Index.class.equals(pageClass)));
>>    }
>>
>>    private boolean isAnnotationPresent(Class<?> pageClass) {
>>        System.out.println(String.format("class: %s", pageClass));
>>        boolean annotationPresent =
>> pageClass.isAnnotationPresent(TestAnnotation.class);
>>        System.out.println(String.format("annotation present: %b",
>> annotationPresent));
>>        return annotationPresent;
>>    }
>>
>> ---------
>>
>> The output is:
>>
>> ---------
>> class: class test.pages.Index
>> annotation present: false
>> wtf tapestry? You're doing it wrong!
>> class: class test.pages.Index
>> annotation present: true
>> this is how it should be!
>> oh, and by the way: false
>> and neither is: false
>> ---------
>>
>> The page that is returned by ComponentSource.getPage() seems to not have the
>> annotation.
>> Is this desired behavior? I found many tutorials out there (some in the
>> tapestry wiki) that seem to use the exact same method to get the annotations
>> of a page class.
>>
>> I've put together a small project containing my test code, you can find it
>> here:
>>
>> http://satansoft.de/tapestry/annotationtest.zip  (~20k)
>>
>> Just run
>> # > mvn package jetty:run
>> and access
>> http://localhost:8080/annotationtest/
>> to reproduce this behavior.
>>
>> Does anybody else experience this? Is it my fault?
>>
>> Thanks in advance for your time
>>
>> Tapestry Version: 5.2.0
>> Reproduced on Jetty and Glassfish
>>
>> --
>> Michael Bayer
>> Software Developer
>>
>> Gameforge Productions GmbH
>> Albert-Nestler-Straße 8
>> D-76131 Karlsruhe
>>
>> Tel. +49 721 354 808-0
>> Fax  +49 721 354 808-152
>>
>> michael.bayer@gameforge.de
>>
>> http://www.gameforge.de
>>
>> Amtsgericht Mannheim, HRB 701682
>> USt-ID: DE 254 298 652
>>
>> Geschäftsführer: Alexander Rösner, Christoph Jennen
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> --
> http://www.bodylabgym.com - a private, by appointment only, one-on-one
> health and fitness facility.
> --
> http://www.ectransition.com - Quality Electronic Cigarettes at a
> reasonable price!
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ComponentSource.getPage ignores Annotations

Posted by Josh Canfield <jo...@gmail.com>.
Correct, the Page you get is not the class that represents the page.

Check the docs:
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/internal/structure/Page.html

Check the root component of the page.

Josh

On Thu, Sep 16, 2010 at 8:42 AM, Michael Bayer
<mi...@gameforge.de> wrote:
> Hi!
>
> I've searched google far and wide, but I don't seem to be able to find a
> solution to this problem:
>
> The instance of java.lang.Class returned by ComponentSource.getPage() seems
> to be broken - it does not have any of the Annotations the original Page
> class does have...
>
> To reproduce this I created a TestAnnotation:
>
> ---------
>
> @Target(ElementType.TYPE)
> @Retention(RetentionPolicy.RUNTIME)
> @Documented
> public @interface TestAnnotation {
>
> }
>
> ---------
>
> ... and added it to my page class. I then created a ComponentRequestFilter
> that uses a ComponentSource to acquire  an instance of said class and tries
> to determine whether it is annotated with TestAnnotation:
>
> ---------
>
>    private void annotationTest(String pageName) {
>        Component page = componentSource.getPage(pageName);
>
>        Class<?> pageClass = page.getClass();
>
>        if (isAnnotationPresent(pageClass)) {
>            System.out.println("heureka!");
>        } else {
>            System.out.println("wtf tapestry? You're doing it wrong!");
>        }
>
>        if (isAnnotationPresent(Index.class)) {
>            System.out.println("this is how it should be!");
>        } else {
>            System.out.println("Java is broken - we're all gonna die!");
>        }
>
>        System.out.println(String.format("oh, and by the way: %b", (page
> instanceof Index)));
>        System.out.println(String.format("and neither is: %b",
> Index.class.equals(pageClass)));
>    }
>
>    private boolean isAnnotationPresent(Class<?> pageClass) {
>        System.out.println(String.format("class: %s", pageClass));
>        boolean annotationPresent =
> pageClass.isAnnotationPresent(TestAnnotation.class);
>        System.out.println(String.format("annotation present: %b",
> annotationPresent));
>        return annotationPresent;
>    }
>
> ---------
>
> The output is:
>
> ---------
> class: class test.pages.Index
> annotation present: false
> wtf tapestry? You're doing it wrong!
> class: class test.pages.Index
> annotation present: true
> this is how it should be!
> oh, and by the way: false
> and neither is: false
> ---------
>
> The page that is returned by ComponentSource.getPage() seems to not have the
> annotation.
> Is this desired behavior? I found many tutorials out there (some in the
> tapestry wiki) that seem to use the exact same method to get the annotations
> of a page class.
>
> I've put together a small project containing my test code, you can find it
> here:
>
> http://satansoft.de/tapestry/annotationtest.zip  (~20k)
>
> Just run
> # > mvn package jetty:run
> and access
> http://localhost:8080/annotationtest/
> to reproduce this behavior.
>
> Does anybody else experience this? Is it my fault?
>
> Thanks in advance for your time
>
> Tapestry Version: 5.2.0
> Reproduced on Jetty and Glassfish
>
> --
> Michael Bayer
> Software Developer
>
> Gameforge Productions GmbH
> Albert-Nestler-Straße 8
> D-76131 Karlsruhe
>
> Tel. +49 721 354 808-0
> Fax  +49 721 354 808-152
>
> michael.bayer@gameforge.de
>
> http://www.gameforge.de
>
> Amtsgericht Mannheim, HRB 701682
> USt-ID: DE 254 298 652
>
> Geschäftsführer: Alexander Rösner, Christoph Jennen
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org