RE: Tapestry 4.1 Numeric Validation

2008-06-10 Thread Jason.Yankus
Ok, originally I tried a numeric translator with what must have been a
bad number format specification.  I revisited my reading in the Kent
Tong book and pulled a different number format specification out, and
presto! It worked.

Thanks -- it's nice to get some Tapestry 4.1 advice on the boards.

Finally, for the nabble and gmane archives:

One solution to numeric validation of TextField in tapestry 4.1 is to
use a validator and translator combination similar to:




Thanks Andreas,

-jason

-Original Message-
From: Andreas Andreou [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 09, 2008 7:29 PM
To: Tapestry users
Subject: Re: Tapestry 4.1 Numeric Validation

Are you defining a translator? (like NumberTranslator)

On Mon, Jun 9, 2008 at 11:28 PM,  <[EMAIL PROTECTED]> wrote:
>
> Greetings,
>
> I have a TextField bound to an Integer property.  I want to add
> validation to my TextField such that it will not overflow or cause
> errors when converting to my Integer property.
>
> I've tried:
>
> 
>
> I get a class cast exception at line 60 of
> org.apache.tapestry.form.validator.Max when I enter a test value of
> 123456789123456789 into the TextField and submit the form.
>
> This doesn't feel like it should be rocket science.  What am I missing
> here?
>
> -jason
>
> ps: Here is my exception
>
> # org.apache.tapestry.form.validator.Max.validate(Max.java:60)
> #
>
org.apache.tapestry.form.ValidatableFieldSupportImpl.validate(Validatabl
> eFieldSupportImpl.java:99)
> #
>
$ValidatableFieldSupport_11a6efd7504.validate($ValidatableFieldSupport_1
> 1a6efd7504.java)
> #
>
org.apache.tapestry.form.TextField.rewindFormComponent(TextField.java:10
> 3)
> #
>
org.apache.tapestry.form.AbstractFormComponent.renderComponent(AbstractF
> ormComponent.java:90)
> #
>
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:724)
> #
>
org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultR
> esponseBuilder.java:187)
> #
>
org.apache.tapestry.form.FormSupportImpl.prerenderField(FormSupportImpl.
> java:797)
> # org.apache.tapestry.form.Form.prerenderField(Form.java:350)
> #
>
org.apache.tapestry.valid.FieldLabel.renderComponent(FieldLabel.java:49)
> #
>
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:724)
> #
>
org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultR
> esponseBuilder.java:187)
> #
>
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:
> 538)
>
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapestry 4.1 Numeric Validation

2008-06-09 Thread Jason.Yankus

Greetings,

I have a TextField bound to an Integer property.  I want to add
validation to my TextField such that it will not overflow or cause
errors when converting to my Integer property.

I've tried:



I get a class cast exception at line 60 of
org.apache.tapestry.form.validator.Max when I enter a test value of
123456789123456789 into the TextField and submit the form.

This doesn't feel like it should be rocket science.  What am I missing
here?

-jason

ps: Here is my exception

# org.apache.tapestry.form.validator.Max.validate(Max.java:60)
#
org.apache.tapestry.form.ValidatableFieldSupportImpl.validate(Validatabl
eFieldSupportImpl.java:99)
#
$ValidatableFieldSupport_11a6efd7504.validate($ValidatableFieldSupport_1
1a6efd7504.java)
#
org.apache.tapestry.form.TextField.rewindFormComponent(TextField.java:10
3)
#
org.apache.tapestry.form.AbstractFormComponent.renderComponent(AbstractF
ormComponent.java:90)
#
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:724)
#
org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultR
esponseBuilder.java:187)
#
org.apache.tapestry.form.FormSupportImpl.prerenderField(FormSupportImpl.
java:797)
# org.apache.tapestry.form.Form.prerenderField(Form.java:350)
#
org.apache.tapestry.valid.FieldLabel.renderComponent(FieldLabel.java:49)
#
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:724)
#
org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultR
esponseBuilder.java:187)
#
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:
538)





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Refer to a page component in a library

2008-03-14 Thread Jason.Yankus
Tony,

We use an annotation to perform the page injection, but fundamentally
under the hood the annotation simply prepends the namespace onto the
pagename.  

I think, based on
 
http://tapestry.apache.org/tapestry4/tapestry/hivedocs/config/tapestry.e
nhance.InjectWorkers.html

that the page type inject depends on the InjectPageWorker class, which
in 4.1 adds a method with the body (drawn from line 66 of the
InjectPageWorker class):

getPage().getRequestCycle().getPage(\"{0}\") 

The parameter is filled by the page name part of the object.  This
should support prepending the namespace in the fashion described.   For
convenience, We ended up adding an annotation to help detect namespaces
automatically, however, the out of the box inject page worker appears to
support the explicit addition of namespace to the page name.

-jason

-Original Message-
From: Tony Giaccone [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2008 5:25 PM
To: Tapestry users
Subject: Re: Refer to a page component in a library

Jason,

First nice to talk to you again. Second if I follow your suggestion
correctly, to inject the page from the library into a page in the
application
you would use the namespace as part of the object binding? Like this?





Tony


On Thu, Mar 13, 2008 at 3:23 PM, <[EMAIL PROTECTED]> wrote:

>
> Use the namespace, just as you did with the component.  It can depend
on
> the component you're using, but for the most part you just specify the
> namespace as you did with the component.  For things like page links,
> you can set the namespace parameter.
>
> -jason
>
> -Original Message-
> From: Tony Giaccone [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 13, 2008 2:41 PM
> To: users@tapestry.apache.org
> Subject: Refer to a page component in a library
>
> Tapestry 4.0 Question.
>
> I have a created a very simple library. It's included in my
.application
> file like this:
>
>
specification-path="/com/company/project/reportlibrary/ReportLibrary.lib
> rary"/>
>
>
> As a result components in the library can be referenced in page files.
> For
> example:
>
>
>
> That declaration work just fine.
>
> But now, but I'm a bit at a loss.
>
> If I have a page in my library and it's defined in the library file
like
> this:
>
>
>
> How do I then make use of that page in a application .page file.
>
>
> If the page is in my normal Application page space, it's easy:
>
> 
>
> but when I try that I get this error:
>
>
> Page 'SimplePage' not found in application namespace.
>
> How do I inform Tapestry that the page is in the library?
>
>
>
> Tony
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Refer to a page component in a library

2008-03-13 Thread Jason.Yankus

Use the namespace, just as you did with the component.  It can depend on
the component you're using, but for the most part you just specify the
namespace as you did with the component.  For things like page links,
you can set the namespace parameter.

-jason

-Original Message-
From: Tony Giaccone [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2008 2:41 PM
To: users@tapestry.apache.org
Subject: Refer to a page component in a library

Tapestry 4.0 Question.

I have a created a very simple library. It's included in my .application
file like this:




As a result components in the library can be referenced in page files.
For
example:



That declaration work just fine.

But now, but I'm a bit at a loss.

If I have a page in my library and it's defined in the library file like
this:



How do I then make use of that page in a application .page file.


If the page is in my normal Application page space, it's easy:



but when I try that I get this error:


Page 'SimplePage' not found in application namespace.

How do I inform Tapestry that the page is in the library?



Tony

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Overriding Exception Page in Library module.

2007-07-20 Thread Jason.Yankus
Ok, I tried that and got:

javax.servlet.ServletException: Library 'branding' not found in
namespace 'branding'.

org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.servi
ce(WebRequestServicerPipelineBridge.java:60)

$ServletRequestServicer_113e3ef5f0d.service($ServletRequestServicer_113e
3ef5f0d.java)

$ServletRequestServicer_113e3ef5f0c.service($ServletRequestServicer_113e
3ef5f0c.java)

org.apache.tapestry.request.DecodedRequestInjector.service(DecodedReques
tInjector.java:55)

$ServletRequestServicerFilter_113e3ef5f09.service($ServletRequestService
rFilter_113e3ef5f09.java)

Thanks for all your help,

-jason

-Original Message-
From: Igor Drobiazko [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 20, 2007 9:58 AM
To: Tapestry users
Subject: Re: Overriding Exception Page in Library module.

Hi,
try 


br, Igor

On 7/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Greetings:
>
> I'm trying to override the infrastructure property for
exceptionPageName
> in the hivemodule.xml for a common library module in our application.
>
> The page definition in my tapestry library file looks like:
>
>  specification-path="pages/Edis3ApplicationException.page"/>
>
> The definition in my hivemodule.xml for the same library looks like:
>
> 
>  value="Edis3ApplicationException" />
> 
>
> The library is included in a number of our presentation .application
> files like this:
>
>  specification-path="/gov/usitc/tapestry/Edis3Contrib.library"/>
>
> When I trigger the error page in one of presentation applications that
> imports the library containing the error page infrastructure override
I
> get a Page not found in Namespace exception:
>
> javax.servlet.ServletException: Page 'Edis3ApplicationException' not
> found in application namespace.
>
>
org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.servi
> ce(WebRequestServicerPipelineBridge.java:60)
>
>
$ServletRequestServicer_113e3cc130f.service($ServletRequestServicer_113e
> 3cc130f.java)
>
>
org.apache.tapestry.request.DecodedRequestInjector.service(DecodedReques
> tInjector.java:55)
>
>
$ServletRequestServicerFilter_113e3cc130b.service($ServletRequestService
> rFilter_113e3cc130b.java)
>
>
$ServletRequestServicer_113e3cc1311.service($ServletRequestServicer_113e
> 3cc1311.java)
> ... plus much more.
>
>
> What do I need to do to enable the framework to identify this page and
> use it as the default Exception page within any application importing
> our common library.
>
> Help,
>
> -jason
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Overriding Exception Page in Library module.

2007-07-20 Thread Jason.Yankus

Greetings:

I'm trying to override the infrastructure property for exceptionPageName
in the hivemodule.xml for a common library module in our application.

The page definition in my tapestry library file looks like:



The definition in my hivemodule.xml for the same library looks like:





The library is included in a number of our presentation .application
files like this:



When I trigger the error page in one of presentation applications that
imports the library containing the error page infrastructure override I
get a Page not found in Namespace exception:

javax.servlet.ServletException: Page 'Edis3ApplicationException' not
found in application namespace.

org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.servi
ce(WebRequestServicerPipelineBridge.java:60)

$ServletRequestServicer_113e3cc130f.service($ServletRequestServicer_113e
3cc130f.java)

org.apache.tapestry.request.DecodedRequestInjector.service(DecodedReques
tInjector.java:55)

$ServletRequestServicerFilter_113e3cc130b.service($ServletRequestService
rFilter_113e3cc130b.java)

$ServletRequestServicer_113e3cc1311.service($ServletRequestServicer_113e
3cc1311.java)
... plus much more.


What do I need to do to enable the framework to identify this page and
use it as the default Exception page within any application importing
our common library.

Help,

-jason

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



TAP 4: How to override asset service.

2007-07-05 Thread Jason.Yankus
Hello,

We're a Tapestry 4 shop.  I need to override the asset service within
the  tapestry.services.FactoryServices contribution point with my own
asset service.  

My wrinkle is that I also need to inject the existing asset service as a
property during construction of my own asset service.

How may I do this?

This is my configuration, nonfunctional, today:
















The error I'm receiving is:

org.apache.hivemind.ApplicationRuntimeException: Element service (at
jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central/
WEB-INF/lib/tapestry-4.0.2.patched.jar!/META-INF/tapestry.services.xml,
line 59, column 51) contains errors: Value for attribute 'name'
('asset') duplicates a prior instance at
jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central/
WEB-INF/lib/UsitcTapestryLibrary-1.0-SNAPSHOT.jar!/META-INF/gov.usitc.en
hance.xml, line 19, column 64.
[jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central
/WEB-INF/lib/tapestry-4.0.2.patched.jar!/META-INF/tapestry.services.xml,
line 59, column 51]

Thanks,

-jason

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Access Session-scoped ASO from HttpSessionListener

2006-09-14 Thread Jason.Yankus
Thanks for taking a look at my problem.  However, I still don't think I
can get the ASO from within the listener.

While within the sessionDestroyed(HttpSessionEvent) method in the
HttpSessionListener I don't have the source data (a
HttpServletRequest/Response) to create a WebRequest object with which to
populate the SessionScopeManager.

I guess I still remain confused about the dependency of
SessionScopeManager on the WebRequest object to retrieve the WebSession,
and any way to retrieve the ASO from outside of the request/response
cycle.

Any advice is greatly appreciated,

-jason


-Original Message-
From: Shing Hing Man [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 14, 2006 3:12 PM
To: Tapestry users
Subject: Re: Access Session-scoped ASO from HttpSessionListener



>The problem here is that the SessionScopeManager
depends on a 
>WebRequest
>being injected to retrieve the WebSession.  During
execution of the
>HttpSessionListener, no WebRequest is available, and
as such the method
>call to the SessionScopeManager to retrieve a session
scoped ASO throws
>a NullPointerException in getWebSession (at or about
line 53).

You might like to try manually  setting the  property 
'webRequest' in the 
 (the hivemind service) 
tapestry.globals.RequestGlobals.
The following post in the archive shows how to do it.

http://article.gmane.org/gmane.comp.java.tapestry.user/39168/match=shing

Shing



--- [EMAIL PROTECTED] wrote:

> 
> I know this has been discussed here recently, but I
> haven't really seen
> a satisfactory conclusion yet.  Perhaps someone can
> clear this up for
> me.
>  
> --- Our situation ---
> 
> We have a need to, upon session timeout, clean up a
> number of file
> system resources that may have been created by the
> application user.
> The (apparently) only available method to do this
> reliably is the
> HttpSessionListener. 
> 
> In order to accurately locate these file system
> resources, we need to
> retrieve a String value from a Session scoped ASO.  
> 
> I have seen the various methods to retrieve the
> Hivemind registry and
> the ApplicationStateManager, however, I have run
> into a problem.  
> 
> --- The Problem ---
> 
> The ApplicationStateManager depends upon the
> SessionScopeManager for
> session scoped ASOs.  The SessionScopeManager uses a
> WebSession object
> to retrieve ASO objects for return.  
> 
> The problem here is that the SessionScopeManager
> depends on a WebRequest
> being injected to retrieve the WebSession.  During
> execution of the
> HttpSessionListener, no WebRequest is available, and
> as such the method
> call to the SessionScopeManager to retrieve a
> session scoped ASO throws
> a NullPointerException in getWebSession (at or about
> line 53).
> 
> --- The Question ---
> 
> Why does SessionScopeManager depend on the
> WebRequest to retrieve the
> session?  What am I missing here, and what, if any,
> recourse to I have
> to retrieve a session scoped ASO from withi the
> HttpSessionListener?
> 
> Grateful for any insight,
> 
> -jason
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


Home page :
  http://uk.geocities.com/matmsh/index.html



___ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to
use" - The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Access Session-scoped ASO from HttpSessionListener

2006-09-14 Thread Jason.Yankus

I know this has been discussed here recently, but I haven't really seen
a satisfactory conclusion yet.  Perhaps someone can clear this up for
me.
 
--- Our situation ---

We have a need to, upon session timeout, clean up a number of file
system resources that may have been created by the application user.
The (apparently) only available method to do this reliably is the
HttpSessionListener. 

In order to accurately locate these file system resources, we need to
retrieve a String value from a Session scoped ASO.  

I have seen the various methods to retrieve the Hivemind registry and
the ApplicationStateManager, however, I have run into a problem.  

--- The Problem ---

The ApplicationStateManager depends upon the SessionScopeManager for
session scoped ASOs.  The SessionScopeManager uses a WebSession object
to retrieve ASO objects for return.  

The problem here is that the SessionScopeManager depends on a WebRequest
being injected to retrieve the WebSession.  During execution of the
HttpSessionListener, no WebRequest is available, and as such the method
call to the SessionScopeManager to retrieve a session scoped ASO throws
a NullPointerException in getWebSession (at or about line 53).

--- The Question ---

Why does SessionScopeManager depend on the WebRequest to retrieve the
session?  What am I missing here, and what, if any, recourse to I have
to retrieve a session scoped ASO from withi the HttpSessionListener?

Grateful for any insight,

-jason

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Populating Tapestry ASO after successful Acegi Auth

2006-08-30 Thread Jason.Yankus
James:

I can't get access to the svn repo.  Can you send the jars?

Thanks,

-jason

-Original Message-
From: James Carman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 30, 2006 10:41 AM
To: 'Tapestry users'
Subject: RE: Populating Tapestry ASO after successful Acegi Auth

You can use the tapestry-acegi module found at [EMAIL PROTECTED] (if
you
can get the stupid anonymous login to work).  If you can't let me know
and I
can send you the jar files directly.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 30, 2006 10:29 AM
To: users@tapestry.apache.org
Subject: RE: Populating Tapestry ASO after successful Acegi Auth

Hi John,

Just curious. . . would that code need to be inserted in *every* page's
pageValidate() method considering that a user can bookmark or type in
any secured URL?  

Acegi will intercept the request, throw up the Login page and then
redirect to the requested page (which in this example would not be the
default page and would therefore require it's on pageValidate() code)

Or is there a more clever way to do this?

Thanks,
Tom

-Original Message-
From: Jonathan Barker [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 30, 2006 10:05 AM
To: 'Tapestry users'
Subject: RE: Populating Tapestry ASO after successful Acegi Auth


I can't say it's a best practice, but it should be a reasonable
strategy.  

In your pageValidate() method, 
if your ASO is not set
Authentication auth = 
SecurityContext.getContext().getAuthentication();
If auth is not null
Object principal = auth.getPrincipal();
If (principal instanceof UserDetails)
Cast and put into ASO

If you are using Hibernate or another persistence framework, and need to
navigate the object graph from your ASO, reattach / refresh before doing
it.
I'm doing that in pageValidate() as well (and I'm using the Spring OSIV
filter).


It would be a little neater to extract out all of the Acegi stuff so
your UI
code doesn't depend on Acegi.


Jonathan

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 30, 2006 7:34 AM
> To: users@tapestry.apache.org
> Subject: Populating Tapestry ASO after successful Acegi Auth
> 
> Greetings:
> 
> I'm using Tapestry 4 and Acegi 1.0.1.  I have acegi set up to perform
> authentication using the AuthenticationProcessingFilter.  I have a
> requirement to place the domain object the Acegi UserDetails object is
> based upon into a Tapestry ASO for use during the user session. =20
> 
> My question is: what the best practice for filling the Tapestry ASO
with
> the domain model's user object upon successful authentication with
> Acegi?
> 
> Thanks,
> 
> -jason
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Populating Tapestry ASO after successful Acegi Auth

2006-08-30 Thread Jason.Yankus
Greetings:

I'm using Tapestry 4 and Acegi 1.0.1.  I have acegi set up to perform
authentication using the AuthenticationProcessingFilter.  I have a
requirement to place the domain object the Acegi UserDetails object is
based upon into a Tapestry ASO for use during the user session. =20

My question is: what the best practice for filling the Tapestry ASO with
the domain model's user object upon successful authentication with
Acegi?

Thanks,

-jason

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]