Home debug not working for rest method PUT using postman rest client
Reply: 2

debug not working for rest method PUT using postman rest client

kiran rathod
kiran rathod Published in 2018-01-12 08:05:52Z

I have two Uri's

POST : http://localhost:8080/applications/2851/involved-parties/1/contacts
PUT : http://localhost:8080/applications/2851/involved-parties/1/contacts

I am trying to debug methods,I have added breakpoint for both methods at starting, started server in debug mode. while sending json request using postman rest client for POST method cursor stop you at break point at POST method. but same request for PUT method does not work your cursor does not stop you at break point its directly giving response back to client.

@RequestMapping(value = "/applications/{applicationReferenceNumber}/involved-parties/{id}/contacts", method = RequestMethod.PUT)
public PutApplicationsResponse putContacts(@Valid @RequestBody final PutApplicationsRequest req,
        final BindingResult bind, @PathVariable(value = "applicationReferenceNumber") final Long arn,
        @PathVariable(value = "id") final Integer id, @RequestHeader final HttpHeaders httpHeaders,
        final HttpServletRequest reqHTTP) throws ContactsException, SQLException, MethodArgumentNotValidException,
                HttpMessageNotReadableException {

    reqHTTP.setAttribute(ExceptionConstants.ARN, arn);
    reqHTTP.setAttribute(ExceptionConstants.id, id);
    objMp = new ObjectMapper();

    if (bind.hasErrors()) {
        throw new MethodArgumentNotValidException(null, bind);

FYI : I am testing negative scenario for both method e.g. length for id is 4 if I pass the 5 length for id then it has to return exception


Danny Dainton
Danny Dainton Reply to 2018-01-12 08:50:23Z

Normally with a PUT request to update, the particular resource URI should be known. So say the client makes a request to:


Our service will look up the the id passsed. If it can't be found, we return a 404 status code, as the resource doesn't exist. If it does exist, then we update the contacts for the application id provided in the request. If you wanted to create a contacts, where the URI is not known, then POST would be correct, and you'd send a application id representation to:


So basically if resource is available and we are doing put operation it will update directly on the server and also it is idempotent so evrytime you fire PUT request it will not do any other changes where as POST will create new resource every time and hence it will go through the code all the time.

Panupong Kongarn
Panupong Kongarn Reply to 2018-01-12 08:37:11Z

In Postman, you'll probably need to send the data via POST and then add the _method field as part of the request.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.36786 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO