http.request listener
I need my Play! application to accept http POST from other server. Is there some simple way开发者_JAVA百科 how to manage external http post, get data and sent response? Some easy http request listener? Thanks
You could say nearly ALL http requests come from a remote source, so this is how Play and all HTTP based containers works by default!
However, to offer some advice, as you are sharing data between servers, and not a client-browser, I would check out renderXml
and renderJSON
in your controllers to return data in a way that your server will expect (as it is unlikely to be expecting HTML content??).
I agree with Codemwnci - besides those tips you can take a look in the 'routes' file and mark your method to accept only POST:
POST /edit controllerName.methodName
Thanks for the Answers, once I have the routes, it is really easy to write controller:
public static void accept(){
InputStream inputStream = request.body;
...
String response = "cmd=asynch-no-trace";
renderText(response);
}
精彩评论