You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Davor Miku <da...@gmail.com> on 2009/04/17 11:10:02 UTC
301 moved permanently
Hi guys!
I have this old struts site, rewritten in T5. Problem are links (with
Google). For example old links are :
www.example/content/populateContent.do?contentId=xxx
and new are:
www.example/content/xxx
What I want is to set 301 redirect for old links, redirecting to new one, in
same class (content/Index.java)
Index.java :
public void onActivate(String article) {
try{
int id = Integer.parseInt(article); // new urls
Content content = contentDAO.getContent(id);
} catch(Exception e){
article = article.substring(19); // remove
populateContent.do?contentId=
int id = Integer.parseInt(article);
/* Here should be something like this. You get the picture */
response.setStatus(301);
response.setHeader( "Location", "http://www.example.com/content/" + id);
}
}
How can I do this?
Every help is appreciated.
Re: 301 moved permanently
Posted by Davor Miku <da...@gmail.com>.
Ok, I have looked and and still no idea. Could you give me link to some
documentation.
On Fri, Apr 17, 2009 at 9:51 AM, Yancey Yeargan <ya...@unt.edu> wrote:
>
> Take a look at the "Timing" filter in the default maven archetype.
>
> Yancey
>
>
>
> On Apr 17, 2009, at 8:08 AM, Davor Miku wrote:
>
> Can you give me some example, please?
>>
>>
Re: 301 moved permanently
Posted by Yancey Yeargan <ya...@unt.edu>.
Take a look at the "Timing" filter in the default maven archetype.
Yancey
On Apr 17, 2009, at 8:08 AM, Davor Miku wrote:
> Can you give me some example, please?
>
Re: 301 moved permanently
Posted by Davor Miku <da...@gmail.com>.
Can you give me some example, please?
On Fri, Apr 17, 2009 at 8:32 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:
> I would do that with a request filter or a dispatcher. It would solve
> your problem in a single place.
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: 301 moved permanently
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
I would do that with a request filter or a dispatcher. It would solve
your problem in a single place.
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: 301 moved permanently
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey there,
I have a similar need on one of my sites. Here's how I solved it:
http://markmail.org/message/53xyz7hxzpxyrn5d
The code is more than a year old, but it should still work.
/Filip
On 2009-04-17 11:10, Davor Miku wrote:
> Hi guys!
>
> I have this old struts site, rewritten in T5. Problem are links (with
> Google). For example old links are :
>
> www.example/content/populateContent.do?contentId=xxx
>
> and new are:
>
> www.example/content/xxx
>
> What I want is to set 301 redirect for old links, redirecting to new one, in
> same class (content/Index.java)
>
> Index.java :
>
>
> public void onActivate(String article) {
>
> try{
> int id = Integer.parseInt(article); // new urls
> Content content = contentDAO.getContent(id);
>
> } catch(Exception e){
> article = article.substring(19); // remove
> populateContent.do?contentId=
> int id = Integer.parseInt(article);
>
> /* Here should be something like this. You get the picture */
>
> response.setStatus(301);
> response.setHeader( "Location", "http://www.example.com/content/" + id);
>
>
> }
>
> }
>
>
> How can I do this?
>
> Every help is appreciated.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQEcBAEBAgAGBQJJ75nOAAoJEEfiH7PpjaMn0LoH/RHe+0DCbxwHhSNflQm1DgyX
MlNtQLbFWOaTgoJOfJz1ykHELrJAfFyCuzg2e6NRGOkJpJIG5wVKpPQl8/zzJzCq
IbRMDbBFLjSObZG1fbYaUWx4hZIwDMLfXwwY7D+DDiTDafOnWOqnrz16x7ZJrHlC
MjGklJBc/KR/OLfRVqR4dnweBnJ7nD+sN8kszTtZg8SS6UJsd53MGbWHtOi1GTmS
PgL3VXOkb3YeqCrO7QBXxLLG0nA+dNfyXHA64OK2g6e2kM1PchGadr9FFsuvCQPO
1WH07VVmvxbbHh47lrFenbDXNz5NoVIaaA7S4NC/OC7n7vu04uvUESSKne7R8/c=
=eK2d
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org