Redirect back to localhost:8080 in request handler

1
I am trying to write a request handler so that it can automatically login me into an application when i click on the following link: localhost:8081/login/username=mxadmin&password=1 It will log me in and create the session. However it does not redirect me back to the default home page of localhost:8081/. What do i need to write in java to make it load the localhost:8081/? I have looked at the deeplink module and tried using the response.header option but this didn't work. Any help would be good.
asked
2 answers
3

Hi Simon. We've done something like that, here some code that will help you out. The key is that the request handler has to add a header for location redirect and set session cookies. Here a relevant substract from that code, you'll have to change it a bit:

public void processRequest(IMxRuntimeRequest request, IMxRuntimeResponse response,
            String arg2) throws Exception {


        String userName = request.getParameter("userName");

            IContext systemContext = Core.createSystemContext();

            ISession newSession = Core.login(userName, ....)
            response.addCookie(XAS_SESSION_ID, newSession.getId().toString(),"/" ,"" ,-1 );
            response.addCookie(XAS_ID, "0." + Core.getXASId(),"/" ,"" ,-1);

        response.setStatus(IMxRuntimeResponse.SEE_OTHER);
        response.addHeader("location", "../index.html");
    }
answered
0

Maybe this would help you: Redirect widget

answered