You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/04/13 17:01:18 UTC

T5: obtaining a list of valid pages

Hi,

Is there a way to obtain a list of pages in the app? Thanks.

Angelo
-- 
View this message in context: http://www.nabble.com/T5%3A-obtaining-a-list-of-valid-pages-tp16659716p16659716.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5 regExp problem

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
That expression does exactly what you ask of it: checks if there is a 
combination of five digits *somewhere* in the input string. You'll have 
to anchor the expression to do what you really want.

So ^\d{5}$ should work.

-Filip

On 2008-04-16 02:39, Sige wrote:
> i might have found the reason:
> 
> it is not that @Validate("regexp") doesnt work, it
> actually checked the input and think the input is
> valid. However, it dosnt check the rest of the string.
> for example:
> 
> zip-regexp=\\d{5}
> 
> @Validate("regexp") checks only the first 5 chars in
> the input, and doesnt care about those following, and
> all the following inputs would be valid:
> 
> 12345
> 12345a
> 12345abcd
> ....
> 
> i have tested Tapestry 5.0.9 and 5.0.11 tutorial, and
> i think this may be a bug.
> 
> Cheers
> 
> Sige
> 
> 
> 
>  
> 
> 
> --- Sige <si...@yahoo.co.nz> wrote:
> 
>> Thank you, but still no luck.
>>
>> the only difference is that i use tomcat and i don't
>> pack the classes into a jar file. this doesn't seem
>> to
>> be the problem, since regular expressions provided
>> in
>> the tutorial work fine, such as:
>>
>> zip-regexp=\\d{5}(-\\d{4})?
>> credit-regexp=\\d{4}(\\-?\\d{4}){3}
>>
>> Cheers,
>>
>> Sige
>>
>>
>>
>> --- Lance Java <la...@googlemail.com> wrote:
>>
>>> Since your regex is defined in a property file,
>> you
>>> don't need to escape
>>> your backslashes as you do with a java string.
>>>
>>> try \-*\d*\.*\d*
>>>
>>> Cheers,
>>> Lance.
>>>
>>> On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com>
>>> wrote:
>>>> That's odd, it works for me alright... Tapestry
>>> doesn't do anything
>>>> special wrt. regular expressions, it just uses
>> the
>>> java.util.regex stuff.
>>>> -Filip
>>>>
>>>> Sige skrev:
>>>>
>>>>> It seems @Validate("regexp") only support
>> fixed
>>> number
>>>>> of matches such as \\d{4}, and doesnt support
>>> "one or
>>>>> more" or "zero or more" matches(\\d* or \\d+).
>>>>>
>>>>> Sige
>>>>>
>>>>>
>>>>> --- Sige <si...@yahoo.co.nz> wrote:
>>>>>
>>>>>  Hi,
>>>>>> I have tried to use a  @Validate("regexp")
>> to
>>>>>> validate
>>>>>> a number field, the regexp used is:
>>>>>> numField-regexp=\\-*\\d*\\.*\\d*
>>>>>>
>>>>>> However this doesnt work in T5 (5.0.9), the
>>>>>> validation
>>>>>> is simply ignored, i have tested the regular
>>>>>> expression  in Java correct. I wonder if T5
>>> supports
>>>>>> all java.util.regex.Pattern, or what I have
>>> gone
>>>>>> wrong?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Sige
>>>>>>
>>>>>> Send instant messages to your online friends
>>>>>> http://au.messenger.yahoo.com
>>>>>>
>>>>>>
> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail:
>>>>>> users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail:
>>>>>> users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>> Send instant messages to your online friends
>>>>> http://au.messenger.yahoo.com
>>>>>
> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail:
>>> users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail:
>>> users-help@tapestry.apache.org
>>>>>
> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail:
>>> users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail:
>>> users-help@tapestry.apache.org
>>>>
>>
>> Send instant messages to your online friends
>> http://au.messenger.yahoo.com 
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail:
>> users-help@tapestry.apache.org
>>
>>
> 
> 
> Send instant messages to your online friends http://au.messenger.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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


Re: T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
i might have found the reason:

it is not that @Validate("regexp") doesnt work, it
actually checked the input and think the input is
valid. However, it dosnt check the rest of the string.
for example:

zip-regexp=\\d{5}

@Validate("regexp") checks only the first 5 chars in
the input, and doesnt care about those following, and
all the following inputs would be valid:

12345
12345a
12345abcd
....

i have tested Tapestry 5.0.9 and 5.0.11 tutorial, and
i think this may be a bug.

Cheers

Sige



 


--- Sige <si...@yahoo.co.nz> wrote:

> Thank you, but still no luck.
> 
> the only difference is that i use tomcat and i don't
> pack the classes into a jar file. this doesn't seem
> to
> be the problem, since regular expressions provided
> in
> the tutorial work fine, such as:
> 
> zip-regexp=\\d{5}(-\\d{4})?
> credit-regexp=\\d{4}(\\-?\\d{4}){3}
> 
> Cheers,
> 
> Sige
> 
> 
> 
> --- Lance Java <la...@googlemail.com> wrote:
> 
> > Since your regex is defined in a property file,
> you
> > don't need to escape
> > your backslashes as you do with a java string.
> > 
> > try \-*\d*\.*\d*
> > 
> > Cheers,
> > Lance.
> > 
> > On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com>
> > wrote:
> > >
> > > That's odd, it works for me alright... Tapestry
> > doesn't do anything
> > > special wrt. regular expressions, it just uses
> the
> > java.util.regex stuff.
> > >
> > > -Filip
> > >
> > > Sige skrev:
> > >
> > > > It seems @Validate("regexp") only support
> fixed
> > number
> > > > of matches such as \\d{4}, and doesnt support
> > "one or
> > > > more" or "zero or more" matches(\\d* or \\d+).
> > > >
> > > > Sige
> > > >
> > > >
> > > > --- Sige <si...@yahoo.co.nz> wrote:
> > > >
> > > >  Hi,
> > > > >
> > > > > I have tried to use a  @Validate("regexp")
> to
> > > > > validate
> > > > > a number field, the regexp used is:
> > > > > numField-regexp=\\-*\\d*\\.*\\d*
> > > > >
> > > > > However this doesnt work in T5 (5.0.9), the
> > > > > validation
> > > > > is simply ignored, i have tested the regular
> > > > > expression  in Java correct. I wonder if T5
> > supports
> > > > > all java.util.regex.Pattern, or what I have
> > gone
> > > > > wrong?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Sige
> > > > >
> > > > > Send instant messages to your online friends
> > > > > http://au.messenger.yahoo.com
> > > > >
> > > > > 
> >
>
---------------------------------------------------------------------
> > > >
> > > > > To unsubscribe, e-mail:
> > > > > users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail:
> > > > > users-help@tapestry.apache.org
> > > > >
> > > > >
> > > > >
> > > >
> > > > Send instant messages to your online friends
> > > > http://au.messenger.yahoo.com
> > > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> > >
> > >
> > 
> 
> 
> Send instant messages to your online friends
> http://au.messenger.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

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


Re: T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
Thank you, but still no luck.

the only difference is that i use tomcat and i don't
pack the classes into a jar file. this doesn't seem to
be the problem, since regular expressions provided in
the tutorial work fine, such as:

zip-regexp=\\d{5}(-\\d{4})?
credit-regexp=\\d{4}(\\-?\\d{4}){3}

Cheers,

Sige



--- Lance Java <la...@googlemail.com> wrote:

> Since your regex is defined in a property file, you
> don't need to escape
> your backslashes as you do with a java string.
> 
> try \-*\d*\.*\d*
> 
> Cheers,
> Lance.
> 
> On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com>
> wrote:
> >
> > That's odd, it works for me alright... Tapestry
> doesn't do anything
> > special wrt. regular expressions, it just uses the
> java.util.regex stuff.
> >
> > -Filip
> >
> > Sige skrev:
> >
> > > It seems @Validate("regexp") only support fixed
> number
> > > of matches such as \\d{4}, and doesnt support
> "one or
> > > more" or "zero or more" matches(\\d* or \\d+).
> > >
> > > Sige
> > >
> > >
> > > --- Sige <si...@yahoo.co.nz> wrote:
> > >
> > >  Hi,
> > > >
> > > > I have tried to use a  @Validate("regexp") to
> > > > validate
> > > > a number field, the regexp used is:
> > > > numField-regexp=\\-*\\d*\\.*\\d*
> > > >
> > > > However this doesnt work in T5 (5.0.9), the
> > > > validation
> > > > is simply ignored, i have tested the regular
> > > > expression  in Java correct. I wonder if T5
> supports
> > > > all java.util.regex.Pattern, or what I have
> gone
> > > > wrong?
> > > >
> > > > Thanks
> > > >
> > > > Sige
> > > >
> > > > Send instant messages to your online friends
> > > > http://au.messenger.yahoo.com
> > > >
> > > > 
>
---------------------------------------------------------------------
> > >
> > > > To unsubscribe, e-mail:
> > > > users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail:
> > > > users-help@tapestry.apache.org
> > > >
> > > >
> > > >
> > >
> > > Send instant messages to your online friends
> > > http://au.messenger.yahoo.com
> > >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> users-help@tapestry.apache.org
> > >
> > >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> users-help@tapestry.apache.org
> >
> >
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

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


Re: T5 regExp problem

Posted by Lance Java <la...@googlemail.com>.
Since your regex is defined in a property file, you don't need to escape
your backslashes as you do with a java string.

try \-*\d*\.*\d*

Cheers,
Lance.

On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com> wrote:
>
> That's odd, it works for me alright... Tapestry doesn't do anything
> special wrt. regular expressions, it just uses the java.util.regex stuff.
>
> -Filip
>
> Sige skrev:
>
> > It seems @Validate("regexp") only support fixed number
> > of matches such as \\d{4}, and doesnt support "one or
> > more" or "zero or more" matches(\\d* or \\d+).
> >
> > Sige
> >
> >
> > --- Sige <si...@yahoo.co.nz> wrote:
> >
> >  Hi,
> > >
> > > I have tried to use a  @Validate("regexp") to
> > > validate
> > > a number field, the regexp used is:
> > > numField-regexp=\\-*\\d*\\.*\\d*
> > >
> > > However this doesnt work in T5 (5.0.9), the
> > > validation
> > > is simply ignored, i have tested the regular
> > > expression  in Java correct. I wonder if T5 supports
> > > all java.util.regex.Pattern, or what I have gone
> > > wrong?
> > >
> > > Thanks
> > >
> > > Sige
> > >
> > > Send instant messages to your online friends
> > > http://au.messenger.yahoo.com
> > >
> > >  ---------------------------------------------------------------------
> >
> > > To unsubscribe, e-mail:
> > > users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> > > users-help@tapestry.apache.org
> > >
> > >
> > >
> >
> > Send instant messages to your online friends
> > http://au.messenger.yahoo.com
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5 regExp problem

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
That's odd, it works for me alright... Tapestry doesn't do anything 
special wrt. regular expressions, it just uses the java.util.regex stuff.

-Filip

Sige skrev:
> It seems @Validate("regexp") only support fixed number
> of matches such as \\d{4}, and doesnt support "one or
> more" or "zero or more" matches(\\d* or \\d+).
> 
> Sige
> 
> 
> --- Sige <si...@yahoo.co.nz> wrote:
> 
>> Hi,
>>
>> I have tried to use a  @Validate("regexp") to
>> validate
>> a number field, the regexp used is:
>> numField-regexp=\\-*\\d*\\.*\\d*
>>
>> However this doesnt work in T5 (5.0.9), the
>> validation
>> is simply ignored, i have tested the regular
>> expression  in Java correct. I wonder if T5 supports
>> all java.util.regex.Pattern, or what I have gone
>> wrong?
>>
>> Thanks
>>
>> Sige
>>
>> Send instant messages to your online friends
>> http://au.messenger.yahoo.com 
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail:
>> users-help@tapestry.apache.org
>>
>>
> 
> 
> Send instant messages to your online friends http://au.messenger.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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


Re: T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
It seems @Validate("regexp") only support fixed number
of matches such as \\d{4}, and doesnt support "one or
more" or "zero or more" matches(\\d* or \\d+).

Sige


--- Sige <si...@yahoo.co.nz> wrote:

> Hi,
> 
> I have tried to use a  @Validate("regexp") to
> validate
> a number field, the regexp used is:
> numField-regexp=\\-*\\d*\\.*\\d*
> 
> However this doesnt work in T5 (5.0.9), the
> validation
> is simply ignored, i have tested the regular
> expression  in Java correct. I wonder if T5 supports
> all java.util.regex.Pattern, or what I have gone
> wrong?
> 
> Thanks
> 
> Sige
> 
> Send instant messages to your online friends
> http://au.messenger.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

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


T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
Hi,

I have tried to use a  @Validate("regexp") to validate
a number field, the regexp used is:
numField-regexp=\\-*\\d*\\.*\\d*

However this doesnt work in T5 (5.0.9), the validation
is simply ignored, i have tested the regular
expression  in Java correct. I wonder if T5 supports
all java.util.regex.Pattern, or what I have gone
wrong?

Thanks

Sige

Send instant messages to your online friends http://au.messenger.yahoo.com 

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


Re: T5: obtaining a list of valid pages

Posted by Howard Lewis Ship <hl...@gmail.com>.
Chris is right, ComponentClassResolver is the service that "knows" the
pages, and could easily provide a list of pages.

I do have a concern that in the future, we may become a bit more
"dynamic" about what pages are available; i.e., pages with templates
but no Java class, or pages created from the aether (i.e., to support
some of the things Trails does in T4).  I'm sure I'll be able to come
up with something reasonable.

On Mon, Apr 14, 2008 at 2:16 PM, Chris Lewis <ch...@bellsouth.net> wrote:
> The problem with this approach is that it doesn't address any other page
>  packages that may have been added via other modules (in the same manner
>  that additional component packages can be added).
>  The idea of copying what ComponentClassResolverImpl does would be the
>  'correct' method, and an extension to the API was request some time ago
>  to expose this as a legitimate feature. See:
>  https://issues.apache.org/jira/browse/TAPESTRY-1923. There's a patch
>  included that extends the interface as well as implements it. Hopefully
>  this will make it in...
>
>  chris
>
>
>
>  Marcus wrote:
>  > Hi Angelo,
>  >
>  > - get ContextClassLoader from current Thread
>  > - get path of your pages package (org.exemplo.teste.pages) from ClassLoader
>  > - get files on this path that ends with ".class", skiping inner classes.
>  >
>  > I think this topic already has been discussed here.
>  >
>  > Marcus.
>  >
>  >
>
>  --
>  http://thegodcode.net
>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: obtaining a list of valid pages

Posted by Chris Lewis <ch...@bellsouth.net>.
The problem with this approach is that it doesn't address any other page
packages that may have been added via other modules (in the same manner
that additional component packages can be added).
The idea of copying what ComponentClassResolverImpl does would be the
'correct' method, and an extension to the API was request some time ago
to expose this as a legitimate feature. See:
https://issues.apache.org/jira/browse/TAPESTRY-1923. There's a patch
included that extends the interface as well as implements it. Hopefully
this will make it in...

chris

Marcus wrote:
> Hi Angelo,
>
> - get ContextClassLoader from current Thread
> - get path of your pages package (org.exemplo.teste.pages) from ClassLoader
> - get files on this path that ends with ".class", skiping inner classes.
>
> I think this topic already has been discussed here.
>
> Marcus.
>
>   

-- 
http://thegodcode.net


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


Re: T5: obtaining a list of valid pages

Posted by Davor Hrg <hr...@gmail.com>.
there is also ClassNameLocator service
with methods to list classes in a package

On Mon, Apr 14, 2008 at 10:55 PM, Marcus <mv...@gmail.com> wrote:

> Hi Angelo,
>
> - get ContextClassLoader from current Thread
> - get path of your pages package (org.exemplo.teste.pages) from
> ClassLoader
> - get files on this path that ends with ".class", skiping inner classes.
>
> I think this topic already has been discussed here.
>
> Marcus.
>

Re: T5: obtaining a list of valid pages

Posted by Marcus <mv...@gmail.com>.
Hi Angelo,

- get ContextClassLoader from current Thread
- get path of your pages package (org.exemplo.teste.pages) from ClassLoader
- get files on this path that ends with ".class", skiping inner classes.

I think this topic already has been discussed here.

Marcus.

Re: T5: obtaining a list of valid pages

Posted by Angelo Chen <an...@yahoo.com.hk>.
good idea.


HugoPalma wrote:
> 
> I don't think there's any public API that you can use to get the list of
> pages.
> Still, i guess you can always copy what ComponentClassResolverImpl does.
> That's the service that prints the list of all pages at startup.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-obtaining-a-list-of-valid-pages-tp16659716p16676063.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: obtaining a list of valid pages

Posted by Hugo Palma <hu...@gmail.com>.
I don't think there's any public API that you can use to get the list of
pages.
Still, i guess you can always copy what ComponentClassResolverImpl does.
That's the service that prints the list of all pages at startup.

Angelo Chen wrote:
> Hi,
>
> Is there a way to obtain a list of pages in the app? Thanks.
>
> Angelo
>   

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