4 Replies Latest reply on Oct 12, 2006 6:15 PM by monkeyden

    Querystring param from remote application

    monkeyden

      I have a remote app which is linking to my Seam app and passing a user id on the querystring. My action will perform a SSO of the user, so it has a method that needs to be performed on creation. I am getting into the method but what scope do I use for the data member to get the id from the querystring? Nothing seems to be working.

        • 1. Re: Querystring param from remote application

          @RequestParameter?

          • 2. Re: Querystring param from remote application
            monkeyden

            Thanks Norman. I found that in the process of digging.

            Everything works fine and I'm able to log the user in, however, I can't seem to redirect to the first screen of the application (user-search.jsp). The URL looks like this:

            http://localhost:8080/myapp/login.seam?id=dKGvK69gCCxqbM9Ud1RS30mhXYBOI08e

            The create method of that login component looks like this:

            @Create
             public String login() {
             //decode userkey
             //query for user
             if(user == null){
             return "/login.jsp";
             }else{
             //go to first page
             return "/private/user-search.jsp";
             }
             }


            While debugging, it gets to the else condition but always goes to login.jsp instead of user-search.jsp. This appears to be how Seam is designed to work. The question is, can I go to a some other Seam action, other than the originally requested view-id from the create method? I only want the user to go to the requested view-id if there was a problem (not able to log in), otherwise they can pass through.

            • 3. Re: Querystring param from remote application
              monkeyden

              I looked at the Number Guess example and it got me half way, but it differs in that a successful login means redirecting to another view-id and Seam component.

              • 4. Re: Querystring param from remote application
                monkeyden

                For posterity sake:

                @RequestParameter
                private String id;
                
                @Create
                public void login() {
                 ...
                 user = getUser(userId);
                 if(user == null){
                 FacesMessages.instance().add("Unable to log you in. Try again.");
                 Redirect redirect = Redirect.instance();
                 redirect.setViewId("/login.jsp");
                 redirect.execute();
                 }else{
                 Context session = Contexts.getSessionContext();
                 session.set("user", user);
                 }
                 ...
                }
                


                Anyone know if there is a way to invoke a Seam action using HTTP GET, instead of using @Create?