Hi,

I have an AuthenticationFilter Class with the following code snippet:

    private boolean dispatchedToLoginPage(String pageName) throws
IOException {

        Component page = componentSource.getPage(pageName);
        
        if (loginPage.equalsIgnoreCase(pageName)) {
                
                URL lastPage = urlHelperService.getUrl(((Login)
page).getLastPage());

The page component is my Login page and I want to access the getLastPage
method of this class but I get the following exception:

25.05.2012 11:24:02 (DefaultRequestExceptionHandler.java          :  63) 
ERROR  - Processing of request failed with uncaught exception:
com.example.pages.Login cannot be cast to com.example.pages.Login
java.lang.ClassCastException: com.example.pages.Login cannot be cast to
com.example.pages.Login
        at
com.example.security.AuthenticationFilter.dispatchedToLoginPage(AuthenticationFilter.java:87)
        at
com.example.security.AuthenticationFilter.handleComponentEvent(AuthenticationFilter.java:55)
        at $ComponentRequestFilter_a6e3835436d4.handleComponentEvent(Unknown
Source)
        at $ComponentRequestHandler_a6e3835436d7.handleComponentEvent(Unknown
Source)
        at
org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
        at $ComponentRequestHandler_a6e3835436d7.handleComponentEvent(Unknown
Source)
        at $ComponentRequestHandler_a6e3835436a1.handleComponentEvent(Unknown
Source)
        at
org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
        at $Dispatcher_a6e3835436a4.dispatch(Unknown Source)
        at $Dispatcher_a6e38354369e.dispatch(Unknown Source)
        at
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
        at
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
        at $RequestHandler_a6e38354369f.service(Unknown Source)
        at
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
        at $RequestHandler_a6e38354369f.service(Unknown Source)
        at
org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
        at $RequestHandler_a6e38354369f.service(Unknown Source)
        at
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
        at $RequestHandler_a6e38354369f.service(Unknown Source)
        at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
        at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
        at
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
        at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
        at $RequestHandler_a6e38354369f.service(Unknown Source)
        at $RequestHandler_a6e383543692.service(Unknown Source)
        at
org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
        at
org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
        at $HttpServletRequestHandler_a6e383543694.service(Unknown Source)
        at
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
        at $HttpServletRequestFilter_a6e383543690.service(Unknown Source)
        at $HttpServletRequestHandler_a6e383543694.service(Unknown Source)
        at
org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
        at $HttpServletRequestHandler_a6e383543694.service(Unknown Source)
        at $HttpServletRequestHandler_a6e38354368f.service(Unknown Source)
        at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)


What is going on? How can I access this method?

Thanks,
sub

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Component-cannot-be-cast-to-Page-tp5713408.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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

Reply via email to