struts2struts2-rest-plugin

POST request to Struts2 with REST plugin not receiving response


I have a struts2 application which uses the struts2-rest-plugin v.2.2.3.

Everything is working great when it comes to the routing of the requests to the actions and its methods and I'm also using ModelDriven to specify the object to serialise when using extensions like JSON and XML.

The problem I'm having is that when I send a POST or PUT request to the struts layer I just get an empty response.

I am sending a POST request to the action like so: http://localhost:8080/alert-settings!update.json. I have a breakpoint in that method and it gets called and the code runs and completes. I have a feeling the issue might be that I am trying to use the ModelDriven interface to send me back the response and for some reason the rest-plugin doesn't like this but I don't know why it would behave like that.

Is there a known issue with receiving responses from POST requests while using the rest plugin? I have looked everywhere and can't find anything about it really.

Any help appreciated and I can provide any more details on request.


Solution

  • I encountered the same issue. Have you tried to set in the struts.xml file:

    struts.rest.content.restrictToGET = false
    

    See the last setting on the rest plugin docs