Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B56DF18166 for ; Tue, 21 Jul 2015 07:45:04 +0000 (UTC) Received: (qmail 50574 invoked by uid 500); 21 Jul 2015 07:44:53 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 50533 invoked by uid 500); 21 Jul 2015 07:44:53 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 50522 invoked by uid 99); 21 Jul 2015 07:44:53 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jul 2015 07:44:53 +0000 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id ED27D1A0347 for ; Tue, 21 Jul 2015 07:44:52 +0000 (UTC) Received: by wicmv11 with SMTP id mv11so33806410wic.0 for ; Tue, 21 Jul 2015 00:44:51 -0700 (PDT) X-Received: by 10.180.206.84 with SMTP id lm20mr27705176wic.48.1437464691304; Tue, 21 Jul 2015 00:44:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.41.98 with HTTP; Tue, 21 Jul 2015 00:44:31 -0700 (PDT) In-Reply-To: References: From: Lukasz Lenart Date: Tue, 21 Jul 2015 09:44:31 +0200 Message-ID: Subject: Re: 404 error with @Action("/") when upgrading Struts2 REST 2.1.8 to 2.3.7 To: Struts Users Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable It's broken/fixed by this issue https://issues.apache.org/jira/browse/WW-38= 57 Regards --=20 =C5=81ukasz + 48 606 323 122 http://www.lenart.org.pl/ 2015-07-21 3:05 GMT+02:00 Julio Aragao : > Hi all, > > I have a web app made using Struts 2 version 2.1.8, and its Convention an= d REST plugins. I needed to update it to the latest version (2.3.24) but on= e 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 t= o happen. I have created a simple app called =E2=80=9Cupgradetest" to isola= te 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(=E2=80=9C/=E2=80=9C) annotation, so that th= e 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 =3D new Messages(); > return show(); > } > > public String show() { > return "show"; > } > > public Messages getMessages() { > return messages; > } > } > > > > > Here is my struts.xml file: > > > "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" > "http://struts.apache.org/dtds/struts-2.3.dtd"> > > > > > > > > > > > > > > > > > > > > > > > Normally, by visiting the root url of my app (=E2=80=9C/=E2=80=9C) in Str= uts2 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 RestAct= ionMapper 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 believ= e this change was done for some reason so I was wondering: > > Is there a way to map the root url (=E2=80=9C/=E2=80=9C) to a specific ac= tion of mine without having to do a redirect or something like that (becaus= e of a SEO requirement I have)? Also, am I doing it the wrong way? > > Thanks in advance, > - Julio > > julio@quimbik.com > Skype: jcnaragao > Mobile Phone: US 415-684-8506 > > "A human being should be able to change a diaper, plan an invasion, butch= er 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, coo= perate, act alone, solve equations, analyze a new problem, pitch manure, pr= ogram a computer, cook a tasty meal, fight efficiently, die gallantly. Spec= ialization is for insects." > > =E2=80=94 Robert A. Heinlein > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org