[opencms-dev] Modifying a 302 Response?

a.westermann at alkacon.com a.westermann at alkacon.com
Thu Jul 16 09:32:16 CEST 2009


Hi John,

thanks for the clarification. In that case I'd go another route. It is 
no good idea to change the resource loader of the external link resource 
type (BTW: you could write your own and use it in your configuration).

I'd create a new resource type for external links with a field for that 
link. Then I have the jsp that is assigned to it's template-elements 
property and could execute whatever code I'd like whenever resources of 
that type are requested (e.g. do a dynamic redirect).

Kind Regards,
Achim.

-------------------
Achim Westermann

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org


John Burbridge wrote:
> Thanks for the suggestion, Achim. 
> 
> What I would like to do (more precisely) is capture the referrer of the request and pass that along to the destination in the query string.
> 
> Ie: starting at mydomain.org/mypage I click on a link to foo.org/bar, which is an external link. 
> 
> Request: foo.org/bar
> Response: 302 --> foo.org/baz?ref=mydomain.org/mypage
> 
> What I'm trying to do is find the location where the 302 response is generated in OpenCms so I can modify it and append the original referrer to the query string of the destination.
> 
> My understanding is that I would have to modify OpenCms itself, right? org.opencms.util.CmsRequestUtil would be useful if I were writing my own code, but in this case I'm trying to modify a standard OpenCms feature...
> 
> Does that sound about right? Any suggestions?
> 
> Many thanks,
> JB
> 
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of a.westermann at alkacon.com
> Sent: Wednesday, July 15, 2009 2:23 AM
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] Modifying a 302 Response?
> 
> Hi John,
> 
> with external links you should be able to "Edit Link" in the context 
> menu and just enter:
> 
> http://www.alkacon.com/en/index.html?foo=bar
> 
> to have a redirect to that target.
> 
> If you want to do a redirect in your own code you should look at the 
> redirect methods in org.opencms.util.CmsRequestUtil.
> 
> 
> 
> 
> Kind Regards,
> Achim.
> 
> -------------------
> Achim Westermann
> 
> Alkacon Software GmbH  - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org
> 
> John Burbridge wrote:
>> Oh right, in OpenCms that would be when a user creates a new "External Link".
>>
>> This creates a new structure that contains the 302 / target link.
>>
>>
>> -----Original Message-----
>> From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
>> Sent: Tuesday, July 14, 2009 9:58 AM
>> To: 'The OpenCms mailing list'
>> Subject: Re: [opencms-dev] Modifying a 302 Response?
>>
>> John -
>>
>> When is the 302 redirect issued
>>
>> Jon
>>
>>> -----Original Message-----
>>> From: opencms-dev-bounces at opencms.org 
>>> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of John Burbridge
>>> Sent: 14 July 2009 17:40
>>> To: The OpenCms mailing list
>>> Subject: [opencms-dev] Modifying a 302 Response?
>>>
>>> Hello OpenCms fellows,
>>>
>>> I'm a bit stuck looking for more information and was hoping 
>>> someone on the list might have run into something like this before:
>>>
>>> I would like to modify the 302 redirect pointers that OpenCms 
>>> generates to append some information on the query string of 
>>> the target url.
>>>
>>> Ie, if the redirect is /foo --> /bar, I would like to add 
>>> some details to /bar?my-stuff=here.
>>>
>>> I looked through the javadocs and spent a good amount of time 
>>> googling around but couldn't find where exactly the 302 
>>> redirect is generated.
>>>
>>> Any pointers?
>>>
>>> Thanks,
>>> JB
>>>
>>>
>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list To 
>>> change your list options, or to unsubscribe from the list, 
>>> please visit http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list