You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dick_hu <di...@gmail.com> on 2011/07/09 02:58:17 UTC

A rewriting problem

I want to rewriting my page,code like this: 
public class AutoLoginLinkTransformer implements PageRenderLinkTransformer { 

        @Inject 
        private RequestGlobals requestGlobals; 

        @Inject 
        private MainLoginService loginService; 

        @Inject 
        private TypeCoercer typeCoercer; 

        private String usrid; 

        public PageRenderRequestParameters decodePageRenderRequest(Request
request) { 
                if (filter(request)) { 
                        return new
PageRenderRequestParameters(Space.class.getSimpleName(), 
                                        new ArrayEventContext(typeCoercer,
new Object[] { usrid }), 
                                        false); 
                } 
                return null; 
        } 

        public Link transformPageRenderLink(Link defaultLink, 
                        PageRenderRequestParameters parameters) { 
                return defaultLink; 
        } 

I want to the page rewriting to page "Space" and it sucess to the space,but
the browser's url is not change, 
how can I solve this problem? Or is there any interface replace the
"PageRenderLinkTransformer". 
My target is to add a filter,if it can not pass the filter's validate, then
page skip to another page.Is there any another way?  If can share the code
is best. 
Any one can help me, thanks a lot. 

--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-rewriting-problem-tp4567132p4567132.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: A rewriting problem

Posted by dick_hu <di...@gmail.com>.
Taha Hafeez wrote:
> 
> Typically it is HttpServletRequestFilter or ComponentRequestFilter or
> ComponentEventRequestFilter. The decision you have to make is how much
> information do you need from tapestry to perform filtering. The lesser you
> need, the early you can exit from the request processing pipeline.
> 
> regards
> Taha
> 

Thiago H. de Paula  wrote:
> 
> http://tapestry.apache.org/request-processing.html, reachable from the   
> documentation page under the "Request Processing" link. ;) 
> 
> regards
> Thiago H. de Paula 
> 
Always can get the best answer,Thanks a lot :)


--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-rewriting-problem-tp4567132p4568819.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: A rewriting problem

Posted by Taha Hafeez <ta...@gmail.com>.
If I understand correctly you want the URL in browser to change.
PageRenderLinkTransformer.decodePageRenderRequest() is used for cases where
you want to override the way tapestry decodes a URL. It might be because you
want to use a different URL pattern or you have a generic url that you want
to map to a tapestry page. So this is a decoding of URL NOT a
redirection(which results in a URL change in browser)

What you need is a filter at some level of Request Processing
http://tapestry.apache.org/request-processing.html

Typically it is HttpServletRequestFilter or ComponentRequestFilter or
ComponentEventRequestFilter. The decision you have to make is how much
information do you need from tapestry to perform filtering. The lesser you
need, the early you can exit from the request processing pipeline.

regards
Taha

On Sat, Jul 9, 2011 at 6:28 AM, dick_hu <di...@gmail.com> wrote:

> I want to rewriting my page,code like this:
> public class AutoLoginLinkTransformer implements PageRenderLinkTransformer
> {
>
>        @Inject
>        private RequestGlobals requestGlobals;
>
>        @Inject
>        private MainLoginService loginService;
>
>        @Inject
>        private TypeCoercer typeCoercer;
>
>        private String usrid;
>
>        public PageRenderRequestParameters decodePageRenderRequest(Request
> request) {
>                if (filter(request)) {
>                        return new
> PageRenderRequestParameters(Space.class.getSimpleName(),
>                                        new ArrayEventContext(typeCoercer,
> new Object[] { usrid }),
>                                        false);
>                }
>                return null;
>        }
>
>        public Link transformPageRenderLink(Link defaultLink,
>                        PageRenderRequestParameters parameters) {
>                return defaultLink;
>        }
>
> I want to the page rewriting to page "Space" and it sucess to the space,but
> the browser's url is not change,
> how can I solve this problem? Or is there any interface replace the
> "PageRenderLinkTransformer".
> My target is to add a filter,if it can not pass the filter's validate, then
> page skip to another page.Is there any another way?  If can share the code
> is best.
> Any one can help me, thanks a lot.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/A-rewriting-problem-tp4567132p4567132.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: A rewriting problem

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Hi!

On Fri, 08 Jul 2011 21:58:17 -0300, dick_hu <di...@gmail.com> wrote:

> I want to rewriting my page,code like this:
> public class AutoLoginLinkTransformer implements I want to the page  
> rewriting to page "Space" and it sucess to the space,but the browser's  
> url is not change,

That's expected behavior. URL rewriting doesn't changes URLs in the  
browser, but how they are treated by the framework. Example: receiving  
/test.html but make Tapestry handle it as if /test was requested.

> how can I solve this problem? Or is there any interface replace the
> "PageRenderLinkTransformer".
> My target is to add a filter,if it can not pass the filter's validate,  
> then page skip to another page.Is there any another way?

Write a ComponentRequestFilter and use the service  
ComponentEventResultProcessor. Here's a similar example in the mailing  
list:  
http://tapestry.1045711.n5.nabble.com/Want-locale-to-be-part-of-every-uri-td4540314.html#a4540636

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

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