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.