0

I have two api in AssetController.java

1.

@RequestMapping(value = "api/getString", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody
GetResult<String> getString() {
    String str= UUID.randomUUID().toString();
    return new GetResult<>(str);
}

2.

@RequestMapping(value = "api/asset", method = RequestMethod.POST, consumes = "application/json")
public ResponseEntity<Object> saveAsset(@Valid @RequestBody AssetDTO asset, BindingResult result)
        throws ValidationException, ServiceException, AccessDeniedException, NotFoundException {....//to do something}

I want to use str of api/getString to use in api/asset?How can i do that? Thanks so much.

3
  • I solved this similar case, but on client side. I used javascript to use first ajax call response to trigger a second ajax call to another controller, within the same process Commented Nov 10, 2016 at 13:26
  • Possible duplicate of Spring MVC, calling another controller from Inside a controller Commented Nov 10, 2016 at 13:39
  • @CristianMeneses This case on server.Thank you. Commented Nov 11, 2016 at 3:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.