Re: Login page + post login page .... OR Getting a page from a dispatcher

2010-02-07 Thread Geoff Callender
Hi Uli et al,

Is there a neater way to tidier way to extract the activation context 
parameters from the Request than the way I'm doing it below? It assumes I've 
already extracted the pageName from the Request path.

String path = request.getPath();

String[] activationContextParams = path.substring(pageName.length() + 
1).split();
for (int i = 0; i  activationContextParams.length; i++) {
if (activationContextParams[i].length()  0) {
activationContextParams[i] = 
activationContextParams[i].substring(1);
}
}
Link pageAfterLoginLink = 
pageRenderLinkSource.createPageRenderLinkWithContext(pageName,
(Object[]) activationContextParams);

Cheers,

Geoff

On 30/10/2009, at 5:53 AM, Ulrich Stärk wrote:

 That's weird. It's exactly how I'm doing it:
 
 PageCallbackContainer login = (PageCallbackContainer) 
 componentSource.getPage(Login.class);
 login.setCallback(new PageCallback(pageName, pageActivationContext, 
 linkSource));
 Link link = linkSource.createPageRenderLink(Login.class);
 response.sendRedirect(link);
 
 PageCallbackContainer is the interface implemented by the Login page class. 
 I'm calling it from inside a ComponentRequestFilter but that shouldn't matter.
 
 Are you sure that Login really implements ILogin?
 
 Cheers,
 
 Uli
 
 Am 29.10.2009 15:41 schrieb Gunnar Eketrapp:
 Hum ... your advice seemed quite straighforward 
 By some reason I can't cast to the interface either ...
 Weirdo ...
 I have rebuild the project and restarted the APP since i thought that the
 old Login.class could spoke me ...
 java.lang.ClassCastException com.tellpoker.pages.Login cannot be cast to
 com.tellpoker.pages.ILogin
 Stack trace
   - 
 com.tellpoker.services.ProtectedPageGateKeeper.checkAccess(ProtectedPageGateKeeper.java:147)
   - 
 com.tellpoker.services.ProtectedPageGateKeeper.dispatch(ProtectedPageGateKeeper.java:64)
   - $Dispatcher_124a0b9d291.dispatch($Dispatcher_124a0b9d291.java)
   - $Dispatcher_124a0b9d286.dispatch($Dispatcher_124a0b9d286.java)
   - 
 org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)
   - com.tellpoker.services.AppModule$1.service(AppModule.java:144)
   - $RequestFilter_124a0b9d285.service($RequestFilter_124a0b9d285.java)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
 org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
 org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
 org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
 org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
   - 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)
   - 
 org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
   - 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - $RequestHandler_124a0b9d27c.service($RequestHandler_124a0b9d27c.java)
   - 
 org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197)
   - org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
   - 
 $HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)
   - 
 org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
   - 
 $HttpServletRequestFilter_124a0b9d27b.service($HttpServletRequestFilter_124a0b9d27b.java)
   - 
 $HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)
   - 
 org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:726)
   - 
 $HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)
   - 
 $HttpServletRequestHandler_124a0b9d279.service($HttpServletRequestHandler_124a0b9d279.java)
   - org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:127)
 2009/10/29 Gunnar Eketrapp gunnar.eketr...@gmail.com
 Thanks a lot !!!
 
 2009/10/29 Ulrich Stärk u...@spielviel.de
 
 Have your page implement an interface that provides methods for setting the
 desired information and cast the result from componentSource.getPage() to
 that interface.
 The reason behind this is that the thing returned from componentSource 

Re: Login page + post login page .... OR Getting a page from a dispatcher

2010-02-07 Thread Ulrich Stärk

There are several ways, depending on what you are doing.

If inside a ComponentRequestHandler's handlePageRender() method, you can 
ask the PageRenderRequestParameters for getActivationContext(). If you 
are handling a component event in handleComponentEvent(), just ask the 
ComponentEventRequestParameters for getEventContext() or 
getPageActivationContext() (depending on what you need).


PageRenderRequestParameters and ComponentEventRequestParameters are also 
available in a PageRenderRequestHandler or a ComponentEventRequestHandler.


If you are not inside one of these handlers, try injecting the 
ContextPathEncoder service and call its decodePath() method.


HTH,

Uli

Geoff Callender schrieb:

Hi Uli et al,

Is there a neater way to tidier way to extract the activation context 
parameters from the Request than the way I'm doing it below? It assumes I've 
already extracted the pageName from the Request path.

String path = request.getPath();

String[] activationContextParams = path.substring(pageName.length() + 
1).split();
for (int i = 0; i  activationContextParams.length; i++) {
if (activationContextParams[i].length()  0) {
activationContextParams[i] = 
activationContextParams[i].substring(1);
}
}
Link pageAfterLoginLink = 
pageRenderLinkSource.createPageRenderLinkWithContext(pageName,
(Object[]) activationContextParams);

Cheers,

Geoff

On 30/10/2009, at 5:53 AM, Ulrich Stärk wrote:


That's weird. It's exactly how I'm doing it:

PageCallbackContainer login = (PageCallbackContainer) 
componentSource.getPage(Login.class);
login.setCallback(new PageCallback(pageName, pageActivationContext, 
linkSource));
Link link = linkSource.createPageRenderLink(Login.class);
response.sendRedirect(link);

PageCallbackContainer is the interface implemented by the Login page class. I'm 
calling it from inside a ComponentRequestFilter but that shouldn't matter.

Are you sure that Login really implements ILogin?

Cheers,

Uli

Am 29.10.2009 15:41 schrieb Gunnar Eketrapp:

Hum ... your advice seemed quite straighforward 
By some reason I can't cast to the interface either ...
Weirdo ...
I have rebuild the project and restarted the APP since i thought that the
old Login.class could spoke me ...
java.lang.ClassCastException com.tellpoker.pages.Login cannot be cast to
com.tellpoker.pages.ILogin
Stack trace
  - 
com.tellpoker.services.ProtectedPageGateKeeper.checkAccess(ProtectedPageGateKeeper.java:147)
  - 
com.tellpoker.services.ProtectedPageGateKeeper.dispatch(ProtectedPageGateKeeper.java:64)
  - $Dispatcher_124a0b9d291.dispatch($Dispatcher_124a0b9d291.java)
  - $Dispatcher_124a0b9d286.dispatch($Dispatcher_124a0b9d286.java)
  - 
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)
  - com.tellpoker.services.AppModule$1.service(AppModule.java:144)
  - $RequestFilter_124a0b9d285.service($RequestFilter_124a0b9d285.java)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
  - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)
  - 
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
  - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - $RequestHandler_124a0b9d27c.service($RequestHandler_124a0b9d27c.java)
  - 
org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197)
  - org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
  - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)
  - 
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
  - 
$HttpServletRequestFilter_124a0b9d27b.service($HttpServletRequestFilter_124a0b9d27b.java)
  - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)
  - 

Re: Login page + post login page .... OR Getting a page from a dispatcher

2010-02-07 Thread Geoff Callender
Thanks, I'll give that a try. BTW, the code I posted earlier doesn't work, but 
this seems to:

String path = request.getPath();
String[] activationContextParams = path.substring(pageName.length() + 
2).split(\\/);
Link pageAfterLoginLink = 
pageRenderLinkSource.createPageRenderLinkWithContext(pageName,
(Object[]) activationContextParams);

Still, I'd prefer to have Tapestry figure out the activation context rather 
than me.

On 07/02/2010, at 10:27 PM, Ulrich Stärk wrote:

 There are several ways, depending on what you are doing.
 
 If inside a ComponentRequestHandler's handlePageRender() method, you can ask 
 the PageRenderRequestParameters for getActivationContext(). If you are 
 handling a component event in handleComponentEvent(), just ask the 
 ComponentEventRequestParameters for getEventContext() or 
 getPageActivationContext() (depending on what you need).
 
 PageRenderRequestParameters and ComponentEventRequestParameters are also 
 available in a PageRenderRequestHandler or a ComponentEventRequestHandler.
 
 If you are not inside one of these handlers, try injecting the 
 ContextPathEncoder service and call its decodePath() method.
 
 HTH,
 
 Uli
 
 Geoff Callender schrieb:
 Hi Uli et al,
 Is there a neater way to tidier way to extract the activation context 
 parameters from the Request than the way I'm doing it below? It assumes I've 
 already extracted the pageName from the Request path.
  String path = request.getPath();
  String[] activationContextParams = path.substring(pageName.length() + 
 1).split();
  for (int i = 0; i  activationContextParams.length; i++) {
  if (activationContextParams[i].length()  0) {
  activationContextParams[i] = 
 activationContextParams[i].substring(1);
  }
  }
  Link pageAfterLoginLink = 
 pageRenderLinkSource.createPageRenderLinkWithContext(pageName,
  (Object[]) activationContextParams);
 Cheers,
 Geoff
 On 30/10/2009, at 5:53 AM, Ulrich Stärk wrote:
 That's weird. It's exactly how I'm doing it:
 
 PageCallbackContainer login = (PageCallbackContainer) 
 componentSource.getPage(Login.class);
 login.setCallback(new PageCallback(pageName, pageActivationContext, 
 linkSource));
 Link link = linkSource.createPageRenderLink(Login.class);
 response.sendRedirect(link);
 
 PageCallbackContainer is the interface implemented by the Login page class. 
 I'm calling it from inside a ComponentRequestFilter but that shouldn't 
 matter.
 
 Are you sure that Login really implements ILogin?
 
 Cheers,
 
 Uli
 
 Am 29.10.2009 15:41 schrieb Gunnar Eketrapp:
 Hum ... your advice seemed quite straighforward 
 By some reason I can't cast to the interface either ...
 Weirdo ...
 I have rebuild the project and restarted the APP since i thought that the
 old Login.class could spoke me ...
 java.lang.ClassCastException com.tellpoker.pages.Login cannot be cast to
 com.tellpoker.pages.ILogin
 Stack trace
  - 
 com.tellpoker.services.ProtectedPageGateKeeper.checkAccess(ProtectedPageGateKeeper.java:147)
  - 
 com.tellpoker.services.ProtectedPageGateKeeper.dispatch(ProtectedPageGateKeeper.java:64)
  - $Dispatcher_124a0b9d291.dispatch($Dispatcher_124a0b9d291.java)
  - $Dispatcher_124a0b9d286.dispatch($Dispatcher_124a0b9d286.java)
  - 
 org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)
  - com.tellpoker.services.AppModule$1.service(AppModule.java:144)
  - $RequestFilter_124a0b9d285.service($RequestFilter_124a0b9d285.java)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
 org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
 org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
 org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
 org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
  - 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)
  - 
 org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
  - 
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
  - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
  - $RequestHandler_124a0b9d27c.service($RequestHandler_124a0b9d27c.java)
  - 
 

Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Gunnar Eketrapp
Hi!

I just switched from my own brewed secured page implementation that was
based on checking access rights in onActivate()
to the smarter more transparent solution outlined in Jumpstart app.

I.e. ProtectedPage annotation + ProtecetdPageGateKeeper dispatcher.

It works like a charm except for the fact that I have trouble informing the
Login page about the failed page so that it can continue on to it
after a successful login. My dumb solution managed this 

The problem I am having is that I dont know how to get hold of the Login
page from within the ProtectedPageGateKeeper dispatcher.

// Setup Login page to redirect to the secured page after
the login
Login login = (Login) componentSource.getPage(Login.class);
login.setRedirectTo(page);
This fails with ...

  [ERROR] TapestryModule.RequestExceptionHandler Processing
of request failed with uncaught exception:
  com.tellpoker.pages.Login cannot be cast to
com.tellpoker.pages.Login
  java.lang.ClassCastException: com.tellpoker.pages.Login
cannot be cast to com.tellpoker.pages.Login

I have also tried @InjectPage but got null instead of a page.

Thanks in advance,
Gunnar Eketrapp


Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Ulrich Stärk
Have your page implement an interface that provides methods for setting the desired information and 
cast the result from componentSource.getPage() to that interface.
The reason behind this is that the thing returned from componentSource is a bytecode-enhanced 
version of your Login page and thus cannot be cast to your Login class type directly.


Uli

Am 29.10.2009 15:09 schrieb Gunnar Eketrapp:

Hi!

I just switched from my own brewed secured page implementation that was
based on checking access rights in onActivate()
to the smarter more transparent solution outlined in Jumpstart app.

I.e. ProtectedPage annotation + ProtecetdPageGateKeeper dispatcher.

It works like a charm except for the fact that I have trouble informing the
Login page about the failed page so that it can continue on to it
after a successful login. My dumb solution managed this 

The problem I am having is that I dont know how to get hold of the Login
page from within the ProtectedPageGateKeeper dispatcher.

// Setup Login page to redirect to the secured page after
the login
Login login = (Login) componentSource.getPage(Login.class);
login.setRedirectTo(page);
This fails with ...

  [ERROR] TapestryModule.RequestExceptionHandler Processing
of request failed with uncaught exception:
  com.tellpoker.pages.Login cannot be cast to
com.tellpoker.pages.Login
  java.lang.ClassCastException: com.tellpoker.pages.Login
cannot be cast to com.tellpoker.pages.Login

I have also tried @InjectPage but got null instead of a page.

Thanks in advance,
Gunnar Eketrapp



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



Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Gunnar Eketrapp
Thanks a lot !!!

2009/10/29 Ulrich Stärk u...@spielviel.de

 Have your page implement an interface that provides methods for setting the
 desired information and cast the result from componentSource.getPage() to
 that interface.
 The reason behind this is that the thing returned from componentSource is a
 bytecode-enhanced version of your Login page and thus cannot be cast to your
 Login class type directly.

 Uli

 Am 29.10.2009 15:09 schrieb Gunnar Eketrapp:

  Hi!

 I just switched from my own brewed secured page implementation that was
 based on checking access rights in onActivate()
 to the smarter more transparent solution outlined in Jumpstart app.

 I.e. ProtectedPage annotation + ProtecetdPageGateKeeper dispatcher.

 It works like a charm except for the fact that I have trouble informing
 the
 Login page about the failed page so that it can continue on to it
 after a successful login. My dumb solution managed this 

 The problem I am having is that I dont know how to get hold of the Login
 page from within the ProtectedPageGateKeeper dispatcher.

// Setup Login page to redirect to the secured page after
 the login
Login login = (Login) componentSource.getPage(Login.class);
login.setRedirectTo(page);
 This fails with ...

  [ERROR] TapestryModule.RequestExceptionHandler Processing
 of request failed with uncaught exception:
  com.tellpoker.pages.Login cannot be cast to
 com.tellpoker.pages.Login
  java.lang.ClassCastException: com.tellpoker.pages.Login
 cannot be cast to com.tellpoker.pages.Login

 I have also tried @InjectPage but got null instead of a page.

 Thanks in advance,
 Gunnar Eketrapp


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




-- 
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo


Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Gunnar Eketrapp
Hum ... your advice seemed quite straighforward 

By some reason I can't cast to the interface either ...

Weirdo ...

I have rebuild the project and restarted the APP since i thought that the
old Login.class could spoke me ...

java.lang.ClassCastException com.tellpoker.pages.Login cannot be cast to
com.tellpoker.pages.ILogin

Stack trace

   - 
com.tellpoker.services.ProtectedPageGateKeeper.checkAccess(ProtectedPageGateKeeper.java:147)

   - 
com.tellpoker.services.ProtectedPageGateKeeper.dispatch(ProtectedPageGateKeeper.java:64)

   - $Dispatcher_124a0b9d291.dispatch($Dispatcher_124a0b9d291.java)
   - $Dispatcher_124a0b9d286.dispatch($Dispatcher_124a0b9d286.java)
   - 
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)

   - com.tellpoker.services.AppModule$1.service(AppModule.java:144)
   - $RequestFilter_124a0b9d285.service($RequestFilter_124a0b9d285.java)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)

   - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)

   - 
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)

   - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - $RequestHandler_124a0b9d27c.service($RequestHandler_124a0b9d27c.java)
   - 
org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197)

   - org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)

   - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   - 
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)

   - 
$HttpServletRequestFilter_124a0b9d27b.service($HttpServletRequestFilter_124a0b9d27b.java)

   - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   - 
org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:726)

   - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   - 
$HttpServletRequestHandler_124a0b9d279.service($HttpServletRequestHandler_124a0b9d279.java)

   - org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:127)

2009/10/29 Gunnar Eketrapp gunnar.eketr...@gmail.com

 Thanks a lot !!!

 2009/10/29 Ulrich Stärk u...@spielviel.de

 Have your page implement an interface that provides methods for setting the
 desired information and cast the result from componentSource.getPage() to
 that interface.
 The reason behind this is that the thing returned from componentSource is
 a bytecode-enhanced version of your Login page and thus cannot be cast to
 your Login class type directly.

 Uli

 Am 29.10.2009 15:09 schrieb Gunnar Eketrapp:

  Hi!

 I just switched from my own brewed secured page implementation that was
 based on checking access rights in onActivate()
 to the smarter more transparent solution outlined in Jumpstart app.

 I.e. ProtectedPage annotation + ProtecetdPageGateKeeper dispatcher.

 It works like a charm except for the fact that I have trouble informing
 the
 Login page about the failed page so that it can continue on to it
 after a successful login. My dumb solution managed this 

 The problem I am having is that I dont know how to get hold of the Login
 page from within the ProtectedPageGateKeeper dispatcher.

// Setup Login page to redirect to the secured page after
 the login
Login login = (Login)
 componentSource.getPage(Login.class);
login.setRedirectTo(page);
 This fails with ...

  [ERROR] TapestryModule.RequestExceptionHandler
 Processing
 of request failed with uncaught exception:
  com.tellpoker.pages.Login cannot be cast to
 com.tellpoker.pages.Login
  java.lang.ClassCastException: com.tellpoker.pages.Login
 cannot be cast to com.tellpoker.pages.Login

 I have also tried @InjectPage but got null instead of a page.

 Thanks in advance,
 Gunnar 

Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Ulrich Stärk

That's weird. It's exactly how I'm doing it:

PageCallbackContainer login = (PageCallbackContainer) 
componentSource.getPage(Login.class);
login.setCallback(new PageCallback(pageName, pageActivationContext, 
linkSource));
Link link = linkSource.createPageRenderLink(Login.class);
response.sendRedirect(link);

PageCallbackContainer is the interface implemented by the Login page class. I'm calling it from 
inside a ComponentRequestFilter but that shouldn't matter.


Are you sure that Login really implements ILogin?

Cheers,

Uli

Am 29.10.2009 15:41 schrieb Gunnar Eketrapp:

Hum ... your advice seemed quite straighforward 

By some reason I can't cast to the interface either ...

Weirdo ...

I have rebuild the project and restarted the APP since i thought that the
old Login.class could spoke me ...

java.lang.ClassCastException com.tellpoker.pages.Login cannot be cast to
com.tellpoker.pages.ILogin

Stack trace

   - 
com.tellpoker.services.ProtectedPageGateKeeper.checkAccess(ProtectedPageGateKeeper.java:147)

   - 
com.tellpoker.services.ProtectedPageGateKeeper.dispatch(ProtectedPageGateKeeper.java:64)

   - $Dispatcher_124a0b9d291.dispatch($Dispatcher_124a0b9d291.java)
   - $Dispatcher_124a0b9d286.dispatch($Dispatcher_124a0b9d286.java)
   - 
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)

   - com.tellpoker.services.AppModule$1.service(AppModule.java:144)
   - $RequestFilter_124a0b9d285.service($RequestFilter_124a0b9d285.java)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)

   - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)

   - 
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)

   - 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - $RequestHandler_124a0b9d27c.service($RequestHandler_124a0b9d27c.java)
   - 
org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197)

   - org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)

   - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   - 
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)

   - 
$HttpServletRequestFilter_124a0b9d27b.service($HttpServletRequestFilter_124a0b9d27b.java)

   - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   - 
org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:726)

   - 
$HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   - 
$HttpServletRequestHandler_124a0b9d279.service($HttpServletRequestHandler_124a0b9d279.java)

   - org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:127)

2009/10/29 Gunnar Eketrapp gunnar.eketr...@gmail.com


Thanks a lot !!!

2009/10/29 Ulrich Stärk u...@spielviel.de

Have your page implement an interface that provides methods for setting the

desired information and cast the result from componentSource.getPage() to
that interface.
The reason behind this is that the thing returned from componentSource is
a bytecode-enhanced version of your Login page and thus cannot be cast to
your Login class type directly.

Uli

Am 29.10.2009 15:09 schrieb Gunnar Eketrapp:

 Hi!

I just switched from my own brewed secured page implementation that was
based on checking access rights in onActivate()
to the smarter more transparent solution outlined in Jumpstart app.

I.e. ProtectedPage annotation + ProtecetdPageGateKeeper dispatcher.

It works like a charm except for the fact that I have trouble informing
the
Login page about the failed page so that it can continue on to it
after a successful login. My dumb solution managed this 

The problem I am having is that I dont know how to get hold of the Login
page from within the ProtectedPageGateKeeper dispatcher.

   // Setup Login page to redirect to the secured page after
the login
   

Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Gunnar Eketrapp
Hi!

Yeaa 100% sure !

// Setup Login page to redirect to the secured page after
the login
Object obj = componentSource.getPage(Login.class);
ILogin login = (ILogin) obj;
login.setRedirectTo(page);

I am using T5.1.0.5 by the way.

/Gunnar

2009/10/29 Ulrich Stärk u...@spielviel.de

 That's weird. It's exactly how I'm doing it:

 PageCallbackContainer login = (PageCallbackContainer)
 componentSource.getPage(Login.class);
 login.setCallback(new PageCallback(pageName, pageActivationContext,
 linkSource));
 Link link = linkSource.createPageRenderLink(Login.class);
 response.sendRedirect(link);

 PageCallbackContainer is the interface implemented by the Login page class.
 I'm calling it from inside a ComponentRequestFilter but that shouldn't
 matter.

 Are you sure that Login really implements ILogin?

 Cheers,

 Uli

 Am 29.10.2009 15:41 schrieb Gunnar Eketrapp:

  Hum ... your advice seemed quite straighforward 

 By some reason I can't cast to the interface either ...

 Weirdo ...

 I have rebuild the project and restarted the APP since i thought that the
 old Login.class could spoke me ...

 java.lang.ClassCastException com.tellpoker.pages.Login cannot be cast to
 com.tellpoker.pages.ILogin

 Stack trace

   -
 com.tellpoker.services.ProtectedPageGateKeeper.checkAccess(ProtectedPageGateKeeper.java:147)

   -
 com.tellpoker.services.ProtectedPageGateKeeper.dispatch(ProtectedPageGateKeeper.java:64)

   - $Dispatcher_124a0b9d291.dispatch($Dispatcher_124a0b9d291.java)
   - $Dispatcher_124a0b9d286.dispatch($Dispatcher_124a0b9d286.java)
   -
 org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)

   - com.tellpoker.services.AppModule$1.service(AppModule.java:144)
   - $RequestFilter_124a0b9d285.service($RequestFilter_124a0b9d285.java)
   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   -
 org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   -
 org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   -
 org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   -
 org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   -
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)

   -
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)

   -
 org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)

   -
 org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)

   - $RequestHandler_124a0b9d287.service($RequestHandler_124a0b9d287.java)
   - $RequestHandler_124a0b9d27c.service($RequestHandler_124a0b9d27c.java)
   -
 org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197)

   -
 org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)

   -
 $HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   -
 org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)

   -
 $HttpServletRequestFilter_124a0b9d27b.service($HttpServletRequestFilter_124a0b9d27b.java)

   -
 $HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   -
 org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:726)

   -
 $HttpServletRequestHandler_124a0b9d27e.service($HttpServletRequestHandler_124a0b9d27e.java)

   -
 $HttpServletRequestHandler_124a0b9d279.service($HttpServletRequestHandler_124a0b9d279.java)

   - org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:127)

 2009/10/29 Gunnar Eketrapp gunnar.eketr...@gmail.com

  Thanks a lot !!!

 2009/10/29 Ulrich Stärk u...@spielviel.de

 Have your page implement an interface that provides methods for setting
 the

 desired information and cast the result from componentSource.getPage()
 to
 that interface.
 The reason behind this is that the thing returned from componentSource
 is
 a bytecode-enhanced version of your Login page and thus cannot be cast
 to
 your Login class type directly.

 Uli

 Am 29.10.2009 15:09 schrieb Gunnar Eketrapp:

  Hi!

 I just switched from my own brewed secured page implementation that was
 based on checking access rights in onActivate()
 to the smarter more transparent solution outlined in Jumpstart app.

 I.e. ProtectedPage annotation + ProtecetdPageGateKeeper dispatcher.

 It works like a charm except for the 

Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Thiago H. de Paula Figueiredo
Em Thu, 29 Oct 2009 18:23:37 -0200, Gunnar Eketrapp  
gunnar.eketr...@gmail.com escreveu:



Hi!


Hi!


Yeaa 100% sure !


So where is ILogin located? It shouldn't be in the pages, components,  
mixins nor base packages, as it would be enhanced by Tapestry.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.

http://www.arsmachina.com.br

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



Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Gunnar Eketrapp
Aha! One moment!

2009/10/29 Thiago H. de Paula Figueiredo thiag...@gmail.com

 Em Thu, 29 Oct 2009 18:23:37 -0200, Gunnar Eketrapp 
 gunnar.eketr...@gmail.com escreveu:

  Hi!


 Hi!

  Yeaa 100% sure !


 So where is ILogin located? It shouldn't be in the pages, components,
 mixins nor base packages, as it would be enhanced by Tapestry.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, software architect and developer, Ars Machina Tecnologia da
 Informação Ltda.
 http://www.arsmachina.com.br


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




-- 
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo


Re: Login page + post login page .... OR Getting a page from a dispatcher

2009-10-29 Thread Gunnar Eketrapp
Super thanks now it works!

2009/10/29 Gunnar Eketrapp gunnar.eketr...@gmail.com

 Aha! One moment!

 2009/10/29 Thiago H. de Paula Figueiredo thiag...@gmail.com

 Em Thu, 29 Oct 2009 18:23:37 -0200, Gunnar Eketrapp 
 gunnar.eketr...@gmail.com escreveu:

  Hi!


 Hi!

  Yeaa 100% sure !


 So where is ILogin located? It shouldn't be in the pages, components,
 mixins nor base packages, as it would be enhanced by Tapestry.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, software architect and developer, Ars Machina Tecnologia da
 Informação Ltda.
 http://www.arsmachina.com.br


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




 --
 [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
 Allévägen 2A, 132 42 Saltsjö-Boo




-- 
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo