-----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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to