Upgrading from 3.0.3 to 4.0.1 in AppFuse

View: New views
9 Messages — Rating Filter:   Alert me  

Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Matt Raible-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I spent the last couple of days upgrading AppFuse from Tapestry 3.0.3
to Tapestry 4.0.1.  I ran into quite a few issues, many of which were
solved by this mailing list.  Thanks for being so responsive and
helping me out - the Tapestry mailing list is definitely one of the
best I've ever worked with.

I do have a few issues that I couldn't solve and I'm hoping you can help:

1. When a user's session expires, a page is displayed to the user. I'm
using Acegi Security and I'd prefer the behavior that I get from other
web frameworks - which basically prompt the user to login again.  What
I've done to workaround this issue is to use URL Rewrite Filter to
redirect restart.svc to / - which will prompt users to login again.

2. I've noticed that users can access the mainMenu (home) of my app by
using /app.  Does there need to be a servlet mapping for /app?  I've
tried using Acegi and URL Rewrite Filter to protect /app, but nothing
seems to work.  Of course, it was 3 a.m. when I was trying to do this.
;-)

3. I found I needed to inject HttpServletRequest and
HttpServletResponse when I wanted to grab cookies and send redirects.
Is there a better way to do this?  WebRequest and WebResponse don't
seem to support cookies or redirects (for example:
getResponse().sendRedirect(getRequest().getContextPath());).

4. Friendly URLs: I like how I don't have to hack the code to get
Friendly URLs.  However, I found that having to map *.html, *.sdirect,
*.direct and *.svc to be somewhat of a pain - especially when
integrating with Acegi.  Since Acegi is URL-based, if I want to really
lock down security, I have to have duplicate definitions for many of
the different extensions (correct me if I'm wrong). Also, when it
comes to filters, it can be quite cumbersome to register 5 mappings
per filter.  I have 7 filters and I don't want to need 35 mappings.
Of course, I don't need to map them all for all the extensions, but
Tapestry's Friendly URL support is much less friendly than the other
frameworks that use only one extension.

5. Is it possible to redirect back to the same page?  Basically, I
want to use Tapestry-Flash, call setMessage() on the page I'm working
in, and then somehow redirect to it so the redirect-after-post pattern
is in place.

Thanks for all your help thus far,

Matt
http://appfuse.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Diogenes Alberto Moreira :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matt for redirect you can use this-

this.getRequestCycle().sendRedirect("aURL");

in any listener method of page.

and redirect to the same page un can use

this.getRequestCycle().sendRedirect(this.getRequestCycle().getAbsoluteURL("/app?page="
+ this.getPageName() + "&service=page"));


saludos,

2006/3/31, Matt Raible <mraible@...>:

> I spent the last couple of days upgrading AppFuse from Tapestry 3.0.3
> to Tapestry 4.0.1.  I ran into quite a few issues, many of which were
> solved by this mailing list.  Thanks for being so responsive and
> helping me out - the Tapestry mailing list is definitely one of the
> best I've ever worked with.
>
> I do have a few issues that I couldn't solve and I'm hoping you can help:
>
> 1. When a user's session expires, a page is displayed to the user. I'm
> using Acegi Security and I'd prefer the behavior that I get from other
> web frameworks - which basically prompt the user to login again.  What
> I've done to workaround this issue is to use URL Rewrite Filter to
> redirect restart.svc to / - which will prompt users to login again.
>
> 2. I've noticed that users can access the mainMenu (home) of my app by
> using /app.  Does there need to be a servlet mapping for /app?  I've
> tried using Acegi and URL Rewrite Filter to protect /app, but nothing
> seems to work.  Of course, it was 3 a.m. when I was trying to do this.
> ;-)
>
> 3. I found I needed to inject HttpServletRequest and
> HttpServletResponse when I wanted to grab cookies and send redirects.
> Is there a better way to do this?  WebRequest and WebResponse don't
> seem to support cookies or redirects (for example:
> getResponse().sendRedirect(getRequest().getContextPath());).
>
> 4. Friendly URLs: I like how I don't have to hack the code to get
> Friendly URLs.  However, I found that having to map *.html, *.sdirect,
> *.direct and *.svc to be somewhat of a pain - especially when
> integrating with Acegi.  Since Acegi is URL-based, if I want to really
> lock down security, I have to have duplicate definitions for many of
> the different extensions (correct me if I'm wrong). Also, when it
> comes to filters, it can be quite cumbersome to register 5 mappings
> per filter.  I have 7 filters and I don't want to need 35 mappings.
> Of course, I don't need to map them all for all the extensions, but
> Tapestry's Friendly URL support is much less friendly than the other
> frameworks that use only one extension.
>
> 5. Is it possible to redirect back to the same page?  Basically, I
> want to use Tapestry-Flash, call setMessage() on the page I'm working
> in, and then somehow redirect to it so the redirect-after-post pattern
> is in place.
>
> Thanks for all your help thus far,
>
> Matt
> http://appfuse.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@...
> For additional commands, e-mail: tapestry-user-help@...
>
>


--
Diogenes A Moreira
Project Manager

PLEASE NOTE
This message, along with any attachments, may be confidential or
legally privileged.  It is intended only for the named person(s), who
is/are the only authorized recipients. If this message has reached you
in error, kindly destroy it without review and notify the sender
immediately. Thank you for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Andreas Andreou-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

1) Why not have a custom StaleSession.html page?
Its pageBeginRender could redirect to the login form, couldn't it?

2) Remove the servlet mapping

3) For cookies, see org.apache.tapestry.services.CookieSource and inject it
using service:tapestry.request.CookieSource
For redirects, see 5)

4) ...

5) Review http://jakarta.apache.org/tapestry/UsersGuide/listenermethods.html :)
.. and return an ILink instance from your listener
 

From Matt Raible <mraible@...>:

> I spent the last couple of days upgrading AppFuse from Tapestry 3.0.3
> to Tapestry 4.0.1.  I ran into quite a few issues, many of which were
> solved by this mailing list.  Thanks for being so responsive and
> helping me out - the Tapestry mailing list is definitely one of the
> best I've ever worked with.
>
> I do have a few issues that I couldn't solve and I'm hoping you can help:
>
> 1. When a user's session expires, a page is displayed to the user. I'm
> using Acegi Security and I'd prefer the behavior that I get from other
> web frameworks - which basically prompt the user to login again.  What
> I've done to workaround this issue is to use URL Rewrite Filter to
> redirect restart.svc to / - which will prompt users to login again.
>
> 2. I've noticed that users can access the mainMenu (home) of my app by
> using /app.  Does there need to be a servlet mapping for /app?  I've
> tried using Acegi and URL Rewrite Filter to protect /app, but nothing
> seems to work.  Of course, it was 3 a.m. when I was trying to do this.
> ;-)
>
> 3. I found I needed to inject HttpServletRequest and
> HttpServletResponse when I wanted to grab cookies and send redirects.
> Is there a better way to do this?  WebRequest and WebResponse don't
> seem to support cookies or redirects (for example:
> getResponse().sendRedirect(getRequest().getContextPath());).
>
> 4. Friendly URLs: I like how I don't have to hack the code to get
> Friendly URLs.  However, I found that having to map *.html, *.sdirect,
> *.direct and *.svc to be somewhat of a pain - especially when
> integrating with Acegi.  Since Acegi is URL-based, if I want to really
> lock down security, I have to have duplicate definitions for many of
> the different extensions (correct me if I'm wrong). Also, when it
> comes to filters, it can be quite cumbersome to register 5 mappings
> per filter.  I have 7 filters and I don't want to need 35 mappings.
> Of course, I don't need to map them all for all the extensions, but
> Tapestry's Friendly URL support is much less friendly than the other
> frameworks that use only one extension.
>
> 5. Is it possible to redirect back to the same page?  Basically, I
> want to use Tapestry-Flash, call setMessage() on the page I'm working
> in, and then somehow redirect to it so the redirect-after-post pattern
> is in place.
>
> Thanks for all your help thus far,
>
> Matt
> http://appfuse.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@...
> For additional commands, e-mail: tapestry-user-help@...
>
>
>


--



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Matt Raible-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 3/31/06, andyhot@... <andyhot@...> wrote:
> 1) Why not have a custom StaleSession.html page?
> Its pageBeginRender could redirect to the login form, couldn't it?

Yes it could.  I'm assuming the code needed to override this page is
similar to overriding the error page in hivemodule.xml?

    <contribution configuration-id="tapestry.InfrastructureOverrides">
        <property name="exceptionPageName" value="error"/>
        <property name="staleSessionPageName" value="staleSession"/> (??)
    </contribution>

>
> 2) Remove the servlet mapping

OK, thanks.

>
> 3) For cookies, see org.apache.tapestry.services.CookieSource and inject it
> using service:tapestry.request.CookieSource
> For redirects, see 5)
>
> 4) ...
>
> 5) Review http://jakarta.apache.org/tapestry/UsersGuide/listenermethods.html :)
> .. and return an ILink instance from your listener

Yeah, I'm using that in other areas. Will Tapestry doesn't seem to
retain any properties I set on the page when using this? Also, in some
instances, I'm redirecting to the root of my application rather than a
specific Tapestry page, but I guess
getRequestCycle().sendRedirect(contextPath) will work for that.

Thanks,

Matt


>
>
> From Matt Raible <mraible@...>:
>
> > I spent the last couple of days upgrading AppFuse from Tapestry 3.0.3
> > to Tapestry 4.0.1.  I ran into quite a few issues, many of which were
> > solved by this mailing list.  Thanks for being so responsive and
> > helping me out - the Tapestry mailing list is definitely one of the
> > best I've ever worked with.
> >
> > I do have a few issues that I couldn't solve and I'm hoping you can help:
> >
> > 1. When a user's session expires, a page is displayed to the user. I'm
> > using Acegi Security and I'd prefer the behavior that I get from other
> > web frameworks - which basically prompt the user to login again.  What
> > I've done to workaround this issue is to use URL Rewrite Filter to
> > redirect restart.svc to / - which will prompt users to login again.
> >
> > 2. I've noticed that users can access the mainMenu (home) of my app by
> > using /app.  Does there need to be a servlet mapping for /app?  I've
> > tried using Acegi and URL Rewrite Filter to protect /app, but nothing
> > seems to work.  Of course, it was 3 a.m. when I was trying to do this.
> > ;-)
> >
> > 3. I found I needed to inject HttpServletRequest and
> > HttpServletResponse when I wanted to grab cookies and send redirects.
> > Is there a better way to do this?  WebRequest and WebResponse don't
> > seem to support cookies or redirects (for example:
> > getResponse().sendRedirect(getRequest().getContextPath());).
> >
> > 4. Friendly URLs: I like how I don't have to hack the code to get
> > Friendly URLs.  However, I found that having to map *.html, *.sdirect,
> > *.direct and *.svc to be somewhat of a pain - especially when
> > integrating with Acegi.  Since Acegi is URL-based, if I want to really
> > lock down security, I have to have duplicate definitions for many of
> > the different extensions (correct me if I'm wrong). Also, when it
> > comes to filters, it can be quite cumbersome to register 5 mappings
> > per filter.  I have 7 filters and I don't want to need 35 mappings.
> > Of course, I don't need to map them all for all the extensions, but
> > Tapestry's Friendly URL support is much less friendly than the other
> > frameworks that use only one extension.
> >
> > 5. Is it possible to redirect back to the same page?  Basically, I
> > want to use Tapestry-Flash, call setMessage() on the page I'm working
> > in, and then somehow redirect to it so the redirect-after-post pattern
> > is in place.
> >
> > Thanks for all your help thus far,
> >
> > Matt
> > http://appfuse.dev.java.net
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@...
> > For additional commands, e-mail: tapestry-user-help@...
> >
> >
> >
>
>
> --
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@...
> For additional commands, e-mail: tapestry-user-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Andreas Andreou-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From  Matt Raible <mraible@...>:

> On 3/31/06, andyhot@... <andyhot@...> wrote:
> > 1) Why not have a custom StaleSession.html page?
> > Its pageBeginRender could redirect to the login form, couldn't it?
>
> Yes it could.  I'm assuming the code needed to override this page is
> similar to overriding the error page in hivemodule.xml?
>
>     <contribution configuration-id="tapestry.InfrastructureOverrides">
>         <property name="exceptionPageName" value="error"/>
>         <property name="staleSessionPageName" value="staleSession"/> (??)
>     </contribution>

Yea - see
http://jakarta.apache.org/tapestry/tapestry/hivedocs/config/tapestry.Infrastructure.html
But why override the name?
Simply create a StaleSession.html and StaleSession.page file in WEB-INF

>
> >
> > 5) Review
> http://jakarta.apache.org/tapestry/UsersGuide/listenermethods.html :)
> > .. and return an ILink instance from your listener
>
> Yeah, I'm using that in other areas. Will Tapestry doesn't seem to
> retain any properties I set on the page when using this?

That's the idea - it forces a client redirect .. only persisted properties will
remain (either session, or client or flash persisted).

> Also, in some
> instances, I'm redirecting to the root of my application rather than a
> specific Tapestry page, but I guess
> getRequestCycle().sendRedirect(contextPath) will work for that.

It should work, but why not activate the Home service? Inject it and
return _homeService.getLink(...)

With all those refactorings in place, request cycle almost
disappears from user classes = no need to mock it + even easier tests.

>
> Thanks,
>
> Matt
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Leonardo Quijano Vincenzi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

andyhot@... wrote:
> 1) Why not have a custom StaleSession.html page?
> Its pageBeginRender could redirect to the login form, couldn't it?
>  
But it doesn't seem to work:

http://issues.apache.org/jira/browse/TAPESTRY-671

--
Ing. Leonardo Quijano Vincenzi
DTQ Software



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Andreas Andreou-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, Leonardo is so correct here...
One cannot throw exceptions (even redirectexception)
in the exception page.

So, perhaps use directly :
<property name="staleSessionPageName" value="LoginPage"/>

From Leonardo Quijano Vincenzi <leonardo@...>:

> andyhot@... wrote:
> > 1) Why not have a custom StaleSession.html page?
> > Its pageBeginRender could redirect to the login form, couldn't it?
> >  
> But it doesn't seem to work:
>
> http://issues.apache.org/jira/browse/TAPESTRY-671
>
> --
> Ing. Leonardo Quijano Vincenzi
> DTQ Software
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@...
> For additional commands, e-mail: tapestry-user-help@...
>
>


--



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Leonardo Quijano Vincenzi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I really don't understand why a RedirectException is not allowed. We all
know RedirectException is not really an exception (in the sense of an
error condition), so why shouldn't it be allowed?
This is problematic when creating a PageNotFound error page. Is there a
property like "staleSessionPageName" for that one?

--
Ing. Leonardo Quijano Vincenzi
DTQ Software


andyhot@... wrote:
> Yes, Leonardo is so correct here...
> One cannot throw exceptions (even redirectexception)
> in the exception page.
>
> So, perhaps use directly :
> <property name="staleSessionPageName" value="LoginPage"/>
>  



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...


Re: Upgrading from 3.0.3 to 4.0.1 in AppFuse

by Martin Strand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I haven't tried it myself, but perhaps you could use a custom  
ExceptionPresenter?
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/error/ExceptionPresenter.html
http://jakarta.apache.org/tapestry/tapestry/hivedocs/service/tapestry.error.ExceptionPresenter.html

On Sat, 01 Apr 2006 16:36:50 +0200, Leonardo Quijano Vincenzi  
<leonardo@...> wrote:

> I really don't understand why a RedirectException is not allowed. We all  
> know RedirectException is not really an exception (in the sense of an  
> error condition), so why shouldn't it be allowed?
> This is problematic when creating a PageNotFound error page. Is there a  
> property like "staleSessionPageName" for that one?
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@...
For additional commands, e-mail: tapestry-user-help@...