#1382: AgaviHttpRedirectRoutingCallback
-------------------------+--------------------------------------------------
Reporter: david | Owner: david
Type: enhancement | Status: closed
Priority: normal | Milestone: 1.1
Component: routing | Version:
Severity: normal | Resolution: fixed
Keywords: | Has_patch: 0
-------------------------+--------------------------------------------------
Comment(by david):
Example for redirecting to another route using values as expected by
{{{AgaviWebRouting::gen()}}} (parameter "route" has the name, "arguments"
an arguments list, "options" is not used here):
{{{
#!xml
<route name="foo" pattern="^/lol/(id:.+)$" />
<route name=".product" pattern="^(/buy-cheap-{name:[\S\s]+}-at-agavi-dot-
org)?/(id:\d+)" action="Product">
<defaults>
<default for="name">/buy-cheap-{}-at-agavi-dot-
org</default>
</defaults>
<!-- but only if the URL is exactly the above, we run the "View"
action -->
<route name=".view" pattern="^$" action=".View">
<callback class="AgaviHttpRedirectRoutingCallback">
<ae:parameter name="route">foo</ae:parameter>
<ae:parameter name="arguments">
<ae:parameter name="id">$id</ae:parameter>
<ae:parameter name="foo">1</ae:parameter>
<ae:parameter name="bar">
<ae:parameter
name="0">test</ae:parameter>
<ae:parameter
name="1">$name</ae:parameter>
</ae:parameter>
</ae:parameter>
<ae:parameter name="code">307</ae:parameter>
</callback>
</route>
</route>
}}}
Static redirection can be done with parameter "uri". Expansion of incoming
arguments is performed on "uri" as well.
The "code" parameter to define the redirect code can be used in both
cases.
Everything is explained in the API docs for the class.
--
Ticket URL: <http://trac.agavi.org/ticket/1382#comment:2>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets