Spring app Response to non-spring webapp
I have two applications. One is a legacy webapp which is servlet-based. The other is a spring-based webapp. The legacy app has a page that has multiple jquery tabs. I want one of the tabs to act as an iframe to the spring based application. I have done the following to achieve that:
- trigger an http post request (by openning and http url connection and writing to a printing to a writer) to the spring app, upon clicking on the tab name
- the request contains information about the user in the legacy system, encrypted using a generated key shared on both systems
- configure the spring mvc framework to intercept calls to the url and calls a method to process the request.
The request handling ideally should do the following:
- decrypt the request data using the shared key
- validate the request, license, etc
- if the requester is deemed to be authentic and user has a valid license (uses an api for the license validation) then set up an account for the user and authenticate them programmatically into spring security
- generate a random authentication key (to be used for future communications instead of the shared key)
- send the random key back to legacy system (encrypted using the shared key)
- direct the user to a specific page in the spring app
1
,2
and 3
are complete, but I am struggling with 4
and 5
. How can I send the second key to the legacy system and have the legacy system read it in using a buffered reader
and then open the redirect page in the tab? Is it even possible in one response?
I used the @ResponseBody
to return the key, but dont know how to send the redirect?
p.s. feel free to ask me questions if anything is not clear