1

Is there any way to achieve multiple responses from a single request using Spring Boot ? If yes, please provide me a link.

1
  • Can you please elaborate on this. Multiple responses as in different type of responses for different parameters? Commented Jul 23, 2015 at 12:14

1 Answer 1

3

HTTP does not work this way. An HTTP request has exactly one response. Spring Boot will not let you send more than one response, because that would be against the HTTP specification and no HTTP clients would be able to figure out what was going on.

There may be another way to accomplish your underlying goals, but whatever it is, it won't involve sending more than one HTTP response to a single HTTP request.

Sign up to request clarification or add additional context in comments.

6 Comments

Hi Utkarsh, I accept that there will be only one response for request. My approch is I will send a request to some X service which will internally call other service Y, then is there way to send both the responses from X and Y services back to UI ?
Is this Y service of yours asynchronous ? If not, then you can very well call the service Y, get the response and then return the response back to Service X; where you can do further manipulation on the result returned by Service Y. BTW, what kind of Service are we talking about here ? What kind of response do we get (JSON or HTML ) ?
HI Utkarsh, everything mentioned above will work fine. We already had this kind of implementation. But the issue is we need to return the response of Y to front end instead of passing the response to service X. This is where we have an issue. Could you please guide the possible solution and our response is JSON ?
You need to provide your current implementation(sample code which you tried), that way only anyone here on Stack Overflow(SO) can help you. Your question is very subjective and its not very clear what you are trying to say.
@MartinAndersson Please feel free to write your own answer.
|

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.