I am trying to use the convention and rest plugins to create an action that
supports both a RESTful API and a Non-RESTful API but it appears on the surface
this isn't possible. The only way I have been able to get this to work in the
same web application was to do the following:
// Simple Non-RESTful Action
public class SimpleAction extends ActionSupport implements ModelDriven<MyBean> {
@Override
@Action(value = "/simple", results = { @Result(name = "success", location =
"/jsp/simple.jsp") })
public String execute() {
return SUCCESS;
}
}
@Namespace("/rest")
public class ComplexAction extends RestfulActionSupport implements
ModelDriven<MyBean> {
}
struts.xml
<constant name="struts.convention.action.suffix" value="Action" />
<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="struts2" />
<constant name="struts.action.extension" value="xhtml,,xml,json,action,do" />
<constant name="struts.mapper.class"
value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper" />
<constant name="struts.mapper.prefixMapping" value="/rest:rest,:struts" />
<constant name="struts.rest.defaultExtension" value="json" />
What could I missing to where I could have both RESTful and non-RESTful action
code reside in the same action class with varying annotations?
Thanks,
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]