Yes, try convention first and then get on REST. You need to include
the config browser plugin, for that url to be available. I don't know
much of REST myself, but with your config settings, Convention should
be mapping

http://localhost:8080/lotmap/subdivision

to the mentioned class. Look at the logs in debug mode, Convention
will say to what namespace and action name is mapped to every class.

musachy

On Fri, Mar 6, 2009 at 4:32 PM, wkbutler <kent.but...@gmail.com> wrote:
>
> Thanks Musachy, that page
> (http://struts.apache.org/2.1.6/docs/convention-plugin.html) was very useful
> and now I think I understand the "locators" property much better.
>
> So here's my class:  com.tousa.ws.rest.SubdivisionController
>
> and I think I told Convention to use suffix "Controller" via the property:
>
>    <constant name="struts.convention.action.suffix" value="Controller"/>
>
> so according my locators:
>
>    <constant name="struts.convention.package.locators" value="rest"/>
>
> you are correct, the namespace should be[].  Unfortunately, that is what
> those URLs already represented. It's a bit confusing because the app is also
> named "rest".  Doh.  I renamed the app to 'lotmap' to prove this to myself,
> and, well, I get the same errors, regardless of my URL permutations:
>
>    http://localhost:8080/subdivision.xml
>    http://localhost:8080/lotmap/subdivision.xml   <-- this should be the
> correct URL, IMHO
>    http://localhost:8080/lotmap/rest/subdivision.xml
>
> I did not mention this, but I am deploying into Jetty, and by default the
> app deploys under a context named for the app.  Hence the 'lotmap' required
> in the URL.
>
> I am afraid I am doing something even more silly than that.  The Convention
> documentation mentions using the config-browser-plugin to see all supported
> actions, at URL
>     http://localhost:8080/YOUR_CONTEXT_HERE/config-browser/index.action
>
> but unfortunately I got an error when running that
> (java.lang.NoSuchMethodException:
> com.opensymphony.xwork2.ActionSupport.index()).
>
> I think I will back out the struts2-rest-plugin and just try to get
> Convention working. Currently it is failing when I try to load
>   WEB-INF/content/subdivision-success.jsp
> via URL
>    http://localhost:8080/lotmap/subdivision.jsp
>
> however my Controller is set up for the rest-plugin, so both the show() and
> index() methods return HttpHeaders, not a simple String response. I don't
> recall the semantics there but that may be interfering with the normal
> Convention result mapping.
>
> Thanks again -
> Kent
>
>
>
> Musachy Barroso wrote:
>>
>> Ah the little things that drive us crazy :). Your class is
>> "com.tousa.ws.rest.SubdivisionController" and the locator is "rest"
>> which means the the action won't have a namespace, so the url will be
>> /subdivision instead of /rest/subdivision, because the namespace is
>> what follows the locator, for example:
>>
>> com.example.rest.orders.ViewController
>>
>> will map to:
>>
>> /orders/view
>>
>> see the troubleshooting section in the convention plugin.
>>
>> musachy
>>
>> On Fri, Mar 6, 2009 at 3:20 PM, wkbutler <kent.but...@gmail.com> wrote:
>>>
>>> Hi -
>>> I am attempting to use the struts-rest-plugin, v2.1.6.  I am using
>>> struts2-rest-showcase-2.1.6 as a guide. The showcase app works fine for
>>> me,
>>> and I have modeled my struts.xml, web.xml, and pom.xml after its example.
>>>
>>> Still, my app always returns a 404 error for any RESTful URL request.
>>>  Here
>>> are my 2 example URLs that I would expect to work at this point:
>>>
>>> http://localhost:8080/rest/subdivision.xml
>>> http://localhost:8080/rest/subdivision/F11.xml
>>>
>>> I have cranked up debug, and even though the Restful Mapper & Interceptor
>>> appear to be properly registered at startup:
>>>
>>> [code]
>>> DEBUG [main] XmlConfigurationProvider.debug(57) | Loaded [BUILDER]
>>> {PackageConfig Name:convention-default namespace: parents:[{PackageConfig
>>> Name:struts-default namespace: parents:[]}]}
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Setting action
>>> default parent package to [rest-default]
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Loading action
>>> configurations
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Actions being
>>> loaded using package locators [rest]
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Excluding
>>> actions
>>> from packages [org.apache.struts.*, org.apache.struts2.*,
>>> org.springframework.web.struts.*, org.springframework.web.struts2.*,
>>> org.hibernate.*]
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.debug(57) | Processing class
>>> [com.tousa.ws.rest.SubdivisionController] in package [com.tousa.ws.rest]
>>>
>>> DEBUG [main] SEOActionNameBuilder.trace(69) | Changed action name from
>>> [SubdivisionController] to [subdivision]
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Got actionName
>>> for
>>> class [class com.tousa.ws.rest.SubdivisionController] of [subdivision]
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Created package
>>> config named [com.tousa.ws.rest#rest-default#] with a namespace []
>>>
>>> DEBUG [main] PackageBasedActionConfigBuilder.debug(57) | Creating action
>>> config for class [class com.tousa.ws.rest.SubdivisionController], name
>>> [subdivision] and package name [com.tousa.ws.rest#rest-default#] in
>>> namespace []
>>>
>>> DEBUG [main] DefaultResultMapBuilder.trace(69) | Using final calculated
>>> namespace []
>>>
>>> DEBUG [main] DefaultResultMapBuilder.trace(69) | Searching for results in
>>> the Servlet container at [/WEB-INF/content/] with result prefix of
>>> [/WEB-INF/content/subdivision]
>>>
>>> DEBUG [main] DefaultResultMapBuilder.trace(69) | Searching for results in
>>> the class path at [WEB-INF/content/] with a result prefix of
>>> [/WEB-INF/content/subdivision] and action name [subdivision]
>>> [/code]
>>>
>>> on any of the above requests, this is the only logged output (to go along
>>> with the 404 response):
>>> [code]
>>> DEBUG [btpool0-2] ConfigurationManager.debug(57) | Checking
>>> ConfigurationProviders for reload.
>>>
>>> DEBUG [btpool0-2] InstantiatingNullHandler.debug(57) | Entering
>>> nullPropertyValue
>>> [target=[com.opensymphony.xwork2.defaulttextprovi...@3e48f2],
>>> property=struts]
>>>
>>> WARN [btpool0-2] OgnlValueStack.warn(45) | Could not find property
>>> [struts.actionMapping]
>>> [/code]
>>>
>>> which seems totally irrelevant.
>>>
>>> I am spinning my wheels now and have tried numerous things, but I cannot
>>> understand why the supposed action configured at startup does not pick up
>>> my
>>> URLs.
>>>
>>> Here are my general configs - I have pared down the configuration to a
>>> bare
>>> minimum, to match the Showcase app, to no avail (yet):
>>>
>>> struts.xml
>>> [code]
>>>    <constant name="struts.convention.action.suffix" value="Controller"/>
>>>    <constant name="struts.convention.action.mapAllMatches" value="true"/>
>>>    <constant name="struts.convention.default.parent.package"
>>> value="rest-default"/>
>>>    <constant name="struts.convention.package.locators" value="rest"/>
>>> [/code]
>>>
>>> web.xml
>>> [code]
>>>        <context-param>
>>>        <param-name>contextConfigLocation</param-name>
>>>        <param-value>classpath*:applicationContext*.xml</param-value>
>>>    </context-param>
>>>
>>>        <!-- Filters -->
>>>    <filter>
>>>        <filter-name>struts2</filter-name>
>>>
>>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>>>    </filter>
>>>    <filter-mapping>
>>>        <filter-name>struts2</filter-name>
>>>        <url-pattern>/*</url-pattern>
>>>    </filter-mapping>
>>>
>>>    <!-- Listeners -->
>>>    <listener>
>>>
>>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>>    </listener>
>>>
>>> [/code]
>>>
>>> pom.xml
>>> [code]
>>>      <dependencies>
>>>
>>>        <!--  Struts 2 -->
>>>        <dependency>
>>>            <groupId>org.apache.struts</groupId>
>>>            <artifactId>struts2-core</artifactId>
>>>            <version>2.1.6</version>
>>>        </dependency>
>>>        <dependency>
>>>                <groupId>org.apache.struts</groupId>
>>>                <artifactId>struts2-convention-plugin</artifactId>
>>>                <version>2.1.6</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.apache.struts</groupId>
>>>            <artifactId>struts2-spring-plugin</artifactId>
>>>            <version>2.1.6</version>
>>>        </dependency>
>>>        <dependency>
>>>        <groupId>org.apache.struts</groupId>
>>>        <artifactId>struts2-rest-plugin</artifactId>
>>>        <version>2.1.6</version>
>>>      </dependency>
>>>
>>>        <dependency>
>>>            <groupId>org.hibernate</groupId>
>>>            <artifactId>hibernate</artifactId>
>>>            <version>3.2.1.ga</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.hibernate</groupId>
>>>            <artifactId>hibernate-annotations</artifactId>
>>>            <version>3.2.1.ga</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.hibernate</groupId>
>>>            <artifactId>hibernate-entitymanager</artifactId>
>>>            <version>3.2.1.ga</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>javax.persistence</groupId>
>>>            <artifactId>persistence-api</artifactId>
>>>            <version>1.0</version>
>>>        </dependency>
>>>        <dependency>
>>>        <groupId>log4j</groupId>
>>>        <artifactId>log4j</artifactId>
>>>        <version>1.2.13</version>
>>>      </dependency>
>>>
>>>  </dependencies>
>>>
>>> [/code]
>>>
>>>
>>> Any suggestions?  I guess I will be going through source code now - the
>>> showcase example makes it seem so simple, and I cannot see what little
>>> switch I have missing or need to remove.  Thanks for ideas.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Struts-mapping-failing-when-using-struts2-convention-plugin-tp22379807p22379807.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Struts-mapping-failing-when-using-struts2-convention-plugin-tp22379807p22380845.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to