REST and non-RESTful URL's Together doesn't work

后端 未结 2 1705
甜味超标
甜味超标 2021-02-11 00:42

All my attempts to get a working example of both, pure restful configuration together with at least one non-restful URL failed.

I have this page as a guide: https://cwik

相关标签:
2条回答
  • 2021-02-11 00:55

    I am also had the same error, i fix it by adding

    <package name="api" namespace="/api" extends="rest-default">
        <action name="users/*" class="com.aurum.struts.rest.UserController">
            <param name="id">{1}</param>
        </action>
    </package>
    

    complete example for REST and Non-REST action together is here https://github.com/sivailango/struts2-rest-nonrest

    0 讨论(0)
  • 2021-02-11 01:05

    Prefix based action mapper delegates finding mapping to the corresponding mapper defined by the

    <constant name="struts.mapper.prefixMapping" value="/rest:rest,:struts"/>
    

    This means all URLs that have /rest in the URL before the last slash / are mapped to the rest mapper, others to the default mapper. If you have a receipt controller, then you should use the value "/receipt:rest,:struts" .

    References:

    • REST Plugin
    • RestfulActionMapper
    • PrefixBasedActionMapper
    0 讨论(0)
提交回复
热议问题