I have written a simple code to integrate rest with Struts 2.3.24
I have my Struts XML:
<!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.mapper.class" value="rest" />
<!-- Overwrite Convention -->
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
<constant name="struts.convention.default.parent.package" value="com.pag.rest.service"/>
<constant name="struts.convention.package.locators" value="service"/>
</struts>
And my controller class is:
package com.pag.rest.service;
public class RequestController {
// GET
public String index() {
return "SUCCESS";
}
// GET
public String show() {
return "SUCCESS";
}
// POST
public String create() {
return "Create - SUCCESS";
}
// PUT
public String update() {
return "SUCCESS";
}
// DELETE
public String destroy() {
return "SUCCESS";
}
}
Whenever I try to access the service, it says not found with action not mapped exception.
Please let me know what else I need to do in order to get the code working.