I am trying to handle POST request in GWT. I did that in server side, but, i feel its work will be fine if the POST request is handled in client side. I was able to complete GET request in client side by reading the query string. But in case of POST, a file is being sent. How can i able to get the file from POST request in GWT client.
Thanks.
handling post request in GWT client is not possible. refer :
https://groups.google.com/forum/#!topic/google-web-toolkit/LOWMIPYcd7A
Related
I am working on an iOS app and the server-side needs to receive POST from the client. The client-side is programmed in swift and HTTP requests are sent using the Alamofire library. The connection is clear and status code 200 is returned automatically by the server each time a POST request is sent. The content of the POST request is also correct. But how do I receive and parse the JSON object sent from the POST request by the client on the server-side? Certain actions on the server need the data from the POST requests.
The server side is written in Java, and I am using windows server 2019 on an Amazon EC2 server. Some clear directions would be great!
For java application, I suggest u First use spring initialization to create a maven and spring boot project , with spring mvc framework in it.
Second write a spring mvc controller with post method, which serve the request from IOS. This is am example:
#PostMapping("/xxx")
public XXX addXXX(#Valid #RequestBody XXXAddForm xxxAddForm) {
return xxxService.addXXX(xxxAddForm);
}
// this is the json object, which matches the format of your client side
public class XXXAddForm {
}
I'm using jax-rs library to create a client testing a Web Service by sending HTTP requests to it, for study purposes. Now a POST Request looks something like this:
Response res = target.
request().post(Entity.entity(jinput.toString(), MediaType.APPLICATION_JSON));
and GET Request something like this:
Response res = target.
request().accept(MediaType.APPLICATION_JSON).get(Response.class);
Where target is the targeted URI and jinput the JSON Input used to post a resource...
Now I wonder... is there a way I can send a GET Request accompanied with a JSON input? For the sake of testing how the Web Service reacts to it...
By using cURL to manually send HTTP requests I can do it... but is there a way I can do it using the jax-rs library?
Thanks in advance :)
P.S. I would like to test the same thing with a DELETE Request as well... if possible...
I met an issue extending usage of Apache Proxy server, now it does redirect every GET request to one server, now I need to change the logic to redirect request to the server and if it does respond with empty response body I need to send the same request to another server, would be really grateful to hear an opinion(examples are welcome) on which tools might be applicable for solving this issue? (Apache Proxy server and HAproxy do not provide such abilities or I could not find how to solve it using these tools).
I am using the Apache HTTPClient API to send HTTPRequests, and so far it's worked with standard requests. Now I want to send a GWT-RPC request and show the response, but I always receive the following error from the GWT-RPC server:
//EX[2,1,"com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533","This application is out of date, please click the refresh button on your browser. ( Malformed or old RPC message received - expecting version 5 )"],0,5]
Actually, I have to send the following data with the request:
5|0|5|http://172.16.103.244:38081/kunagi/scrum.ScrumGwtApplication/|6E611C647A0C98D5A31A2506E16D81D6|scrum.client.ScrumService|startConversation|I|1|2|3|4|1|5|-1|
but I don't know how.
When I retrieve the request code from FireBug, I find the above data as a source in the post area.
Take a look at the gwt-syncproxy project. It does exactly what you are looking for, faking RCP calls from Java code. If you don't want to rely your project on gwt-syncproxy, you could look at it's implementation and find out how the create valid requests.
I'm writing a server side app in Java using the HttpCore library.
I have an HttpRequest and I'm trying to get the postdata sent from a form. The problem is- when I use request.getEntity() it returns a null object, even though when I look through HTTPFox on what kind of request I'm sending the post data is clearly there.
What am I doing wrong?
There seems to be some confusion. You are sending requests from a browser to the server. The server is likely using the servlet API. There you handle requests using the doPost(..) method of an HttpServlet. You have an HttpServletRequest from which you can get the parameters - request.getParameter("paramName")
HttpCore on the other hand is used to make requests, not to handle requests. It is used as an http client (in the role of the browser).