You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by eric <er...@free.fr> on 2010/06/08 01:36:07 UTC

Redirection after checking browser url

Hi,

(I havn't had a response from the dev mailing list)

To avoid error or multiple urls for one page (SEO) or no content
I check the browser url with the original page url
If the bowser url is wrong, i want to redirect the visitor to the right
url
I don't want to use an HTML refresh.

If a call "response.sendRedirect('newUrl')" in groovy or ftl file
I have the error "IllegalStateException"

Do you have an idea ?
There is an other solution ?

Thanks

Eric

Re: Redirection after checking browser url

Posted by Adrian Crum <ad...@hlmksw.com>.
That exception is thrown when the response has been committed. You can't 
do a redirect after you start sending content.

-Adrian

On 6/7/2010 4:36 PM, eric wrote:
> Hi,
>
> (I havn't had a response from the dev mailing list)
>
> To avoid error or multiple urls for one page (SEO) or no content
> I check the browser url with the original page url
> If the bowser url is wrong, i want to redirect the visitor to the right
> url
> I don't want to use an HTML refresh.
>
> If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> I have the error "IllegalStateException"
>
> Do you have an idea ?
> There is an other solution ?
>
> Thanks
>
> Eric
>

Re: Redirection after checking browser url

Posted by eric <er...@free.fr>.
response.sendRedirect(newUrl)

it works fine, on condition to put this call into a groovy file before
all freemarker files

Eric

On Tue, 2010-06-08 at 11:44 +0200, Jacques Le Roux wrote:

> http://tuckey.org/urlrewrite/ ?
> 
> Jacques
> 
> From: "eric" <er...@free.fr>
> > Thanks Adrian & BJ,
> > 
> > I use RewriteRule from Apache for basic rules
> > For a 2nd level, I want to check not the url structure but :
> > _ vocabulary words present into url (to redirect to the canonical url)
> > _ content page (no product ... to redirect to parent page with content)
> > 
> > For many thousands url, I can't use RewriteRule from Apache, it's too
> > complicated for me.
> > Now I use  <meta http-equiv="refresh"  content="0;canonicalUrl">
> > but this solution loads the content of a wrong url
> > 
> > So I need an intermediate solution beetween RewriteRule and HTML refresh
> > This solution has to be called from OFBiz
> > 
> > Eric
> > 
> > 
> > On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
> >> if you using AJP then I suggest rewrite in apache
> >> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
> >> you can use regex
> >> 
> >> =========================
> >> BJ Freeman
> >> http://bjfreeman.elance.com
> >> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> >> Specialtymarket.com  <http://www.specialtymarket.com/>
> >> 
> >> Systems Integrator-- Glad to Assist
> >> 
> >> Chat  Y! messenger: bjfr33man
> >> Linkedin 
> >> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
> >> 
> >> 
> >> eric sent the following on 6/7/2010 4:36 PM:
> >> > Hi,
> >> >
> >> > (I havn't had a response from the dev mailing list)
> >> >
> >> > To avoid error or multiple urls for one page (SEO) or no content
> >> > I check the browser url with the original page url
> >> > If the bowser url is wrong, i want to redirect the visitor to the right
> >> > url
> >> > I don't want to use an HTML refresh.
> >> >
> >> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> >> > I have the error "IllegalStateException"
> >> >
> >> > Do you have an idea ?
> >> > There is an other solution ?
> >> >
> >> > Thanks
> >> >
> >> > Eric
> >> >
> >> 
> >
> 

Re: Redirection after checking browser url

Posted by BJ Freeman <bj...@free-man.net>.
thank been looking it over

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Jacques Le Roux sent the following on 6/8/2010 2:44 AM:
> http://tuckey.org/urlrewrite/ ?
>
> Jacques
>
> From: "eric" <er...@free.fr>
>> Thanks Adrian & BJ,
>>
>> I use RewriteRule from Apache for basic rules
>> For a 2nd level, I want to check not the url structure but :
>> _ vocabulary words present into url (to redirect to the canonical url)
>> _ content page (no product ... to redirect to parent page with content)
>>
>> For many thousands url, I can't use RewriteRule from Apache, it's too
>> complicated for me.
>> Now I use <meta http-equiv="refresh" content="0;canonicalUrl">
>> but this solution loads the content of a wrong url
>>
>> So I need an intermediate solution beetween RewriteRule and HTML refresh
>> This solution has to be called from OFBiz
>>
>> Eric
>>
>>
>> On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
>>> if you using AJP then I suggest rewrite in apache
>>> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
>>> you can use regex
>>>
>>> =========================
>>> BJ Freeman
>>> http://bjfreeman.elance.com
>>> Strategic Power Office with Supplier Automation
>>> <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>>> Specialtymarket.com <http://www.specialtymarket.com/>
>>>
>>> Systems Integrator-- Glad to Assist
>>>
>>> Chat Y! messenger: bjfr33man
>>> Linkedin
>>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>>>
>>>
>>>
>>> eric sent the following on 6/7/2010 4:36 PM:
>>> > Hi,
>>> >
>>> > (I havn't had a response from the dev mailing list)
>>> >
>>> > To avoid error or multiple urls for one page (SEO) or no content
>>> > I check the browser url with the original page url
>>> > If the bowser url is wrong, i want to redirect the visitor to the
>>> right
>>> > url
>>> > I don't want to use an HTML refresh.
>>> >
>>> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
>>> > I have the error "IllegalStateException"
>>> >
>>> > Do you have an idea ?
>>> > There is an other solution ?
>>> >
>>> > Thanks
>>> >
>>> > Eric
>>> >
>>>
>>
>
>


Re: Redirection after checking browser url

Posted by Jacques Le Roux <ja...@les7arts.com>.
http://tuckey.org/urlrewrite/ ?

Jacques

From: "eric" <er...@free.fr>
> Thanks Adrian & BJ,
> 
> I use RewriteRule from Apache for basic rules
> For a 2nd level, I want to check not the url structure but :
> _ vocabulary words present into url (to redirect to the canonical url)
> _ content page (no product ... to redirect to parent page with content)
> 
> For many thousands url, I can't use RewriteRule from Apache, it's too
> complicated for me.
> Now I use  <meta http-equiv="refresh"  content="0;canonicalUrl">
> but this solution loads the content of a wrong url
> 
> So I need an intermediate solution beetween RewriteRule and HTML refresh
> This solution has to be called from OFBiz
> 
> Eric
> 
> 
> On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
>> if you using AJP then I suggest rewrite in apache
>> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
>> you can use regex
>> 
>> =========================
>> BJ Freeman
>> http://bjfreeman.elance.com
>> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>> Specialtymarket.com  <http://www.specialtymarket.com/>
>> 
>> Systems Integrator-- Glad to Assist
>> 
>> Chat  Y! messenger: bjfr33man
>> Linkedin 
>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>> 
>> 
>> eric sent the following on 6/7/2010 4:36 PM:
>> > Hi,
>> >
>> > (I havn't had a response from the dev mailing list)
>> >
>> > To avoid error or multiple urls for one page (SEO) or no content
>> > I check the browser url with the original page url
>> > If the bowser url is wrong, i want to redirect the visitor to the right
>> > url
>> > I don't want to use an HTML refresh.
>> >
>> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
>> > I have the error "IllegalStateException"
>> >
>> > Do you have an idea ?
>> > There is an other solution ?
>> >
>> > Thanks
>> >
>> > Eric
>> >
>> 
>


Re: Redirection after checking browser url

Posted by eric <er...@free.fr>.
Thanks Adrian & BJ,

I use RewriteRule from Apache for basic rules
For a 2nd level, I want to check not the url structure but :
_ vocabulary words present into url (to redirect to the canonical url)
_ content page (no product ... to redirect to parent page with content)

For many thousands url, I can't use RewriteRule from Apache, it's too
complicated for me.
Now I use  <meta http-equiv="refresh"  content="0;canonicalUrl">
but this solution loads the content of a wrong url

So I need an intermediate solution beetween RewriteRule and HTML refresh
This solution has to be called from OFBiz

Eric


On Mon, 2010-06-07 at 17:20 -0700, BJ Freeman wrote:
> if you using AJP then I suggest rewrite in apache
> http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
> you can use regex
> 
> =========================
> BJ Freeman
> http://bjfreeman.elance.com
> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
> 
> Systems Integrator-- Glad to Assist
> 
> Chat  Y! messenger: bjfr33man
> Linkedin 
> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
> 
> 
> eric sent the following on 6/7/2010 4:36 PM:
> > Hi,
> >
> > (I havn't had a response from the dev mailing list)
> >
> > To avoid error or multiple urls for one page (SEO) or no content
> > I check the browser url with the original page url
> > If the bowser url is wrong, i want to redirect the visitor to the right
> > url
> > I don't want to use an HTML refresh.
> >
> > If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> > I have the error "IllegalStateException"
> >
> > Do you have an idea ?
> > There is an other solution ?
> >
> > Thanks
> >
> > Eric
> >
> 


Re: Redirection after checking browser url

Posted by BJ Freeman <bj...@free-man.net>.
if you using AJP then I suggest rewrite in apache
http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
you can use regex

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


eric sent the following on 6/7/2010 4:36 PM:
> Hi,
>
> (I havn't had a response from the dev mailing list)
>
> To avoid error or multiple urls for one page (SEO) or no content
> I check the browser url with the original page url
> If the bowser url is wrong, i want to redirect the visitor to the right
> url
> I don't want to use an HTML refresh.
>
> If a call "response.sendRedirect('newUrl')" in groovy or ftl file
> I have the error "IllegalStateException"
>
> Do you have an idea ?
> There is an other solution ?
>
> Thanks
>
> Eric
>