Quantcast

URL Rewriting: redirect and parameters

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

URL Rewriting: redirect and parameters

Peter Stadler
Dear all,

within my controller.xql I want to pass parameters along with my redirect, doing something like

<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
        <redirect url="newURL">
            <add-parameter name="foo" value="bar"/>
        </redirect>
</dispatch>

Well, it doesn't work this way -- it does work though when I pass the parameters within the url attribute. But my understanding of http://demo.exist-db.org/exist/urlrewrite.xml#d3532e783 is that it should work with the add-parameter element since "redirect" is one of the two "action elements" that it applies to.

What am I doing/reading wrong?

Many thanks
Peter


--
Peter Stadler
Carl-Maria-von-Weber-Gesamtausgabe
Arbeitsstelle Detmold
Gartenstr. 20
D-32756 Detmold
Tel. +49 5231 975-665
Fax: +49 5231 975-668
stadler at weber-gesamtausgabe.de
www.weber-gesamtausgabe.de






------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URL Rewriting: redirect and parameters

Peter Stadler
PS: My site based on: 1.4.1-rev15155-20110815

Am 19.10.2011 um 13:56 schrieb Peter Stadler:

> Dear all,
>
> within my controller.xql I want to pass parameters along with my redirect, doing something like
>
> <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
>        <redirect url="newURL">
>            <add-parameter name="foo" value="bar"/>
>        </redirect>
> </dispatch>
>
> Well, it doesn't work this way -- it does work though when I pass the parameters within the url attribute. But my understanding of http://demo.exist-db.org/exist/urlrewrite.xml#d3532e783 is that it should work with the add-parameter element since "redirect" is one of the two "action elements" that it applies to.
>
> What am I doing/reading wrong?
>
> Many thanks
> Peter
>

--
Peter Stadler
Carl-Maria-von-Weber-Gesamtausgabe
Arbeitsstelle Detmold
Gartenstr. 20
D-32756 Detmold
Tel. +49 5231 975-665
Fax: +49 5231 975-668
stadler at weber-gesamtausgabe.de
www.weber-gesamtausgabe.de






------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URL Rewriting: redirect and parameters

Joe Wicentowski
In reply to this post by Peter Stadler
Hi Peter,

> within my controller.xql I want to pass parameters along with my redirect, doing something like
>
> <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
>        <redirect url="newURL">
>            <add-parameter name="foo" value="bar"/>
>        </redirect>
> </dispatch>

This looks correct to me.

> Well, it doesn't work this way -- it does work though when I pass the parameters within the url attribute. But my understanding of http://demo.exist-db.org/exist/urlrewrite.xml#d3532e783 is that it should work with the add-parameter element since "redirect" is one of the two "action elements" that it applies to.

When you say "doesn't work", what do you mean?  I think we need to
understand how you are accessing the parameter from within newURL.

What version of eXist?

Joe

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URL Rewriting: redirect and parameters

Peter Stadler

Am 19.10.2011 um 14:06 schrieb Joe Wicentowski:

> Hi Peter,
>
>> within my controller.xql I want to pass parameters along with my redirect, doing something like
>>
>> <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
>>        <redirect url="newURL">
>>            <add-parameter name="foo" value="bar"/>
>>        </redirect>
>> </dispatch>
>
> This looks correct to me.
>
>> Well, it doesn't work this way -- it does work though when I pass the parameters within the url attribute. But my understanding of http://demo.exist-db.org/exist/urlrewrite.xml#d3532e783 is that it should work with the add-parameter element since "redirect" is one of the two "action elements" that it applies to.
>
> When you say "doesn't work", what do you mean?  I think we need to
> understand how you are accessing the parameter from within newURL.

My understanding is that the redirect is "visible" to the client, initiating a new request. Hence the parameter should be appended to the URL and visible e.g. in the browser address line. But when I request "oldURL" it gets rewritten to "newURL" -- not "newURL?foo=bar".

Actually what I'm trying to do is redirect to another location while passing all parameters along.

Many thanks
Peter

--
Peter Stadler
Carl-Maria-von-Weber-Gesamtausgabe
Arbeitsstelle Detmold
Gartenstr. 20
D-32756 Detmold
Tel. +49 5231 975-665
Fax: +49 5231 975-668
stadler at weber-gesamtausgabe.de
www.weber-gesamtausgabe.de






------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URL Rewriting: redirect and parameters

Joe Wicentowski
Hi Peter,

> My understanding is that the redirect is "visible" to the client, initiating a new request. Hence the parameter should be appended to the URL and visible e.g. in the browser address line. But when I request "oldURL" it gets rewritten to "newURL" -- not "newURL?foo=bar".
>
> Actually what I'm trying to do is redirect to another location while passing all parameters along.

No, added parameters are not visible in the browser address line.
newURL can access added parameters by means of
request:get-parameter().

If you want parameters to be appended to the URL, you will need to
construct the URL manually.

Cheers,
Joe

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URL Rewriting: redirect and parameters

Peter Stadler
Hi Joe,

sorry for bothering you and the list, but I admit I don't get it.
1. theoretically: How is the server supposed to get the parameters if the client doesn't send them with the url? (since redirect sends a 302 ergo forces a new request?)
2. practically:  try a simple controller.xql:

if ($exist:path eq '/oldurl') then
    <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
        <redirect url="myquery.xql">
            <add-param name="foo" value="bar"/>
        </redirect>
    </dispatch>
else()

and a simple query: request:get-parameter('foo','error')

As you wrote I'd expect myquery.xql to access the added parameter by request:get-parameter(). But it doesn't receive the parameter and instead returns the default "error".

All the best
Peter


Am 19.10.2011 um 14:22 schrieb Joe Wicentowski:

> No, added parameters are not visible in the browser address line.
> newURL can access added parameters by means of
> request:get-parameter().

--
Peter Stadler
Carl-Maria-von-Weber-Gesamtausgabe
Arbeitsstelle Detmold
Gartenstr. 20
D-32756 Detmold
Tel. +49 5231 975-665
Fax: +49 5231 975-668
stadler at weber-gesamtausgabe.de
www.weber-gesamtausgabe.de






------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Ciosco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...