-
May 18th, 2012, 07:19 AM
#1
Concurrent post and get Spring MVC
I have to send some data in the server and i manage to do this succesfully.Now when i send this data the server sends me a reply.The reply contains a new field (which i need to extract it) + the data i send.
@RequestMapping(value = "/send", method = RequestMethod.POST)
public String setForm(@ModelAttribute("Attribute") AClass aclass,Model model){
HttpEntity<AClass> entity = new HttpEntity<AClass>(aclass,headers);
try {
ResponseEntity<AClass> result = template.exchange(URL,
HttpMethod.POST, entity, AClass.class);
model.addAttribute("IdUser", result.getBody());
} catch (Exception e) {
}
return "aview"
}
In the above code the IdUser contains the data i send.But i want to get the server response data instead only of the data i send. Is it possible to retrieve the automatic server response?I'm using the JAXB annotations for binding the request/response.
The model is something like this:
@XmlRootElement(name="send")
public class AClass{
@XmlElement
private String password;
@XmlElement
private String username;
get/set
}
So the xml i send has this form:
<send>
<password> </password>
<username> </username>
</send>
The form of the XMl the server sends to me after a successful post has this form:
<send>
<id> </id>
<password> </password>
<username> </username>
</send>
The password and the username is the same as those i send. The new element i need to retrieve is the id.I don't know what should i do.Please provide opinions
Last edited by alexios.7; May 21st, 2012 at 04:04 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules