Lukasz, Thanks for the answer. So, is there a way to map the root to an specific action, with convention and rest plugins, once RestActionMapper returning null is the desired effect?
Thanks! -Julio On Jul 21, 2015 4:44 AM, "Lukasz Lenart" <lukaszlen...@apache.org> wrote: > It's broken/fixed by this issue > https://issues.apache.org/jira/browse/WW-3857 > > > Regards > -- > Łukasz > + 48 606 323 122 http://www.lenart.org.pl/ > > 2015-07-21 3:05 GMT+02:00 Julio Aragao <ju...@quimbik.com>: > > Hi all, > > > > I have a web app made using Struts 2 version 2.1.8, and its Convention > and REST plugins. I needed to update it to the latest version (2.3.24) but > one feature I used to have stopped working. I tracked the versions after > 2.1.8, and found out that it was after version 2.3.7 that the problem > started to happen. I have created a simple app called “upgradetest" to > isolate the problem. Here is the error scenario: > > > > I have an Action called HomeController, in which I have a method index() > that is marked with the @Action(“/“) annotation, so that the root url of > the app maps to this method, like below: > > > > package upgradetest.web.struts; > > > > import org.apache.struts2.convention.annotation.Action; > > import org.apache.struts2.rest.RestActionSupport; > > import upgradetest.model.Messages; > > > > public class HomeController extends RestActionSupport { > > > > private Messages messages; > > > > public HomeController() { > > } > > > > @Action("/") > > public String index() { > > messages = new Messages(); > > return show(); > > } > > > > public String show() { > > return "show"; > > } > > > > public Messages getMessages() { > > return messages; > > } > > } > > > > > > > > > > Here is my struts.xml file: > > > > <?xml version="1.0" encoding="UTF-8"?> > > <!DOCTYPE struts PUBLIC > > "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" > > "http://struts.apache.org/dtds/struts-2.3.dtd"> > > > > <struts> > > <constant name="struts.devMode" value="true" /> > > > > <package name="upgradetest" extends="struts-default"> > > > > </package> > > > > <constant name="struts.objectFactory" value="spring" /> > > <constant name="struts.custom.i18n.resources" > value="global-resources" /> > > > > <constant name="struts.mapper.class" value="rest" /> > > > > <constant name="struts.convention.action.suffix" > value="Controller"/> > > <constant name="struts.convention.action.mapAllMatches" > value="true"/> > > <constant name="struts.convention.default.parent.package" > value="upgradetest"/> > > > > </struts> > > > > > > > > > > Normally, by visiting the root url of my app (“/“) in Struts2 2.1.8, the > index() method was called, and it then took the user to the desired result. > After the upgrade to 2.3.7, the web app is returning a 404 error. I have > investigated the source code and found out that the RestActionMapper of > Struts Rest Plugin is returning null in the getMapping method (in the last > line of code), something it did not in version 2.1.8. I believe this change > was done for some reason so I was wondering: > > > > Is there a way to map the root url (“/“) to a specific action of mine > without having to do a redirect or something like that (because of a SEO > requirement I have)? Also, am I doing it the wrong way? > > > > Thanks in advance, > > - Julio > > > > ju...@quimbik.com > > Skype: jcnaragao > > Mobile Phone: US 415-684-8506 > > > > "A human being should be able to change a diaper, plan an invasion, > butcher a hog, conn a ship, design a building, write a sonnet, balance > accounts, build a wall, set a bone, comfort the dying, take orders, give > orders, cooperate, act alone, solve equations, analyze a new problem, pitch > manure, program a computer, cook a tasty meal, fight efficiently, die > gallantly. Specialization is for insects." > > > > — Robert A. Heinlein > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >