-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rest-http POST method #108
Comments
Your changes works for me. Share, please, the StackTrace |
|
Looks like you changed something else, e.g. in the |
can you add some unit test like this and commit it thanks; @Secured("ROLE_REST_HTTP_USER")
public Message<EmployeeList> getEmployee(Message<?> inMessage){
EmployeeList employeeList = new EmployeeList();
Map<String, Object> responseHeaderMap = new HashMap<String, Object>();
try{
Employee expl=(Employee)inMessage.getPayload();
employeeList.getEmployee().add(expl);
MessageHeaders headers = inMessage.getHeaders();
String id = (String)headers.get("employeeId");
boolean isFound;
if (id.equals("1")){
employeeList.getEmployee().add(new Employee(1, "John", "Doe"));
isFound = true;
}else if (id.equals("2")){
employeeList.getEmployee().add(new Employee(2, "Jane", "Doe"));
isFound = true;
}else if (id.equals("0")){
employeeList.getEmployee().add(new Employee(1, "John", "Doe"));
employeeList.getEmployee().add(new Employee(2, "Jane", "Doe"));
isFound = true;
}else{
isFound = false;
}
if (isFound){
setReturnStatusAndMessage("0", "Success", employeeList, responseHeaderMap);
}else{
setReturnStatusAndMessage("2", "Employee Not Found", employeeList, responseHeaderMap);
}
}catch (Throwable e){
setReturnStatusAndMessage("1", "System Error", employeeList, responseHeaderMap);
logger.error("System error occured :"+e);
}
Message<EmployeeList> message = new GenericMessage<EmployeeList>(employeeList, responseHeaderMap);
return message;
} |
Do you mean this: Employee expl=(Employee)inMessage.getPayload();
employeeList.getEmployee().add(expl); ? Thanks |
i want send object (json) by post method and add to list and get list (json); |
Strange: it works for me again:
Or you are using some old SAMPLES version, or I am wrong that test it against my Gradle branch. I think we will add your tweaks to this sample, but already after we commit Gradle migration. What might cause the issue, that I use Gradle and its Jetty pluging, but Maven sample uses Tomcat pluging. As the conclusion: all your modifications are correct and have the right to life |
i am using tomcat & maven |
i think this is cause when i remove xml in negotiation and remove marshaler ; |
Well, does it say that you haven't shown entire changes to the sample? |
i want to sent json by post method
after change integration configuration
and write test i send object but response is failed
The text was updated successfully, but these errors were encountered: