I have a spring controller method. This meant software user registration (through a single process sign from another system in the product). It works by receiving user data, checking it, creating a user account, if it does not exist, transferring a common token back to another system, and then authenticating the user. The handshake process continues, but to solve the problem. I want the same method to return a string if the user does not exist on the system, and return a ModelAndView if they are already registered.
Possible solutions (but cannot fulfill them):
- The returned string (in the case of the first user) will be read using the
HttpURLConnection input stream. Therefore, if there is a way to put data into a ModelAndView object and then read it using the input stream, then I am set up. - I can return the string and read it in order using the input stream, creating the return type as
@ResponseBody String , however I cannot return the view when it is an existing user.
Ideally, I would return the model and view, but the other system is not spring, and therefore it will not understand it.
To summarize, one of the methods that performs two functions, if the user is the first user, returns a string to another system with an encryption token that the other system will use in the iframe to authenticate the user.
It is necessary to return a string in one case for reading using an input stream reader in another system, and in the case of an existing user, the view should be returned for reading using spring itself.
Please let me know if this is not clear.
EDIT: Is there a way to return an HTTP response (something like an HTTP servlet response) that is fairly general and works inside and outside spring. This will also solve my problem.
Isaac source share