9 Replies Latest reply: Mar 8, 2011 12:09 AM by handat RSS

    passing data between war file

    826528
      Hello experts,

      I have got this thread as my search result: How does one pass data between war files

      Here i found this post:-
      "If you set the cookie name to be the same for both web
      applications, you should be able to pass the data in the HttpSession...".

      My application is deployed in two war files. and i have assigned the task to if a user(who is successfully logged in) is going from one web application to another his session will not get expire and still i can get the values from that session which was created on 1st web application.
      Please give me any hint.

      Thanks
      Shams

      Edited by: shams.hq on Feb 22, 2011 1:01 PM
        • 1. Re: passing data between war file
          826528
          No Idea Guyss....???
          • 2. Re: passing data between war file
            EJP
            You found the hint yourself. But your container should support single signon, you shouldn't have to worry about cookies at all. I never have. Look at your container documentation.
            • 3. Re: passing data between war file
              826528
              Thanks for ur response.

              Sir, now my requirement has been changed.
              Now, i have to redirect from one web application to another with some data and i don't want to send data in Query String. Neither i can use crossContext facility on tomcat.

              I tried HttpClient, and other sendRedirect but in these cases i need to use a shared database.
              Is there any other way to do this??

              Please tell me if anyone.

              Thanks
              Shams
              • 4. Re: passing data between war file
                826528
                Please guys, any hint....
                May i use Http Header for this task??

                Thanks
                Shams
                • 5. Re: passing data between war file
                  EJP
                  You can do a server-side forward. Then only the server gets to see what's in the URL string.
                  • 6. Re: passing data between war file
                    826528
                    May i send some data in server-side redirect??
                    If yes, please guide me how??

                    Thanks
                    Shams
                    • 7. Re: passing data between war file
                      gimbal2
                      shams.hq wrote:
                      May i send some data in server-side redirect??
                      If yes, please guide me how??

                      Thanks
                      Shams
                      Basic HTTP: Add parameters to the url. But that makes them visible to the user.

                      If you're actually talking about a forward like is suggested in this thread, you can attach objects to the request object (request.setAttribute()). These objects can be retrieved back as long as it is within the same request.
                      • 8. Re: passing data between war file
                        826528
                        Thanks to every one.

                        I have done this simply by putting data in encrypted form in a form's hidden element on jsp page. And submit that page using javascript.
                        And this is working good.

                        I think through this i can also transfer data to web application deployed on different servers too.

                        Thanks and regards
                        Shams
                        • 9. Re: passing data between war file
                          handat
                          shams.hq wrote:
                          Thanks to every one.

                          I have done this simply by putting data in encrypted form in a form's hidden element on jsp page. And submit that page using javascript.
                          This is horrible! Why not do what others have suggested and forward on the server side rather than putting it on a client and requiring javascript as well.
                          And this is working good.

                          I think through this i can also transfer data to web application deployed on different servers too.
                          That would be even worst. I hope you are not writing an online shopping application.
                          Thanks and regards
                          Shams
                          Please use your web container's session capabilities, you don't even need an expensive Application server, even Tomcat can do this.