Tuesday 15 February 2011

jsp - Cookie sharing across application deployed on same server -


I have two applications that are outside the Stropes 1.3 frame and are positioned on Glassfish Server 3.1.2 < P> Your URL for app -1 http: localhost: 8080 / app-1

and

App-2's url for your URL: http: localhost: 8080 / app-2

Functionality: App-1 & amp; App-2 supports different languages ​​The user is logged in through App-1 and a cookie is setup for the selected language.

Later, there are many ARRs in app-2's AP-2. Href is more common, depending on the language selected on App-1, various pages are displayed after reaching AP-2.

The issue is that AP-2 is the language chosen in AP-1? How many cookies are set up in App-2 by App-To? Or is there any other option?

set the path attribute in the cookie / Servlet 3.0 application provides APIs to set cookie attributes when creating cookies.

If the path (the application reference root) is set, the cookies are sent only when the URL starts with that path by setting it to / Will be able to send cookies to all applications in the domain.

Java Doc: Setpath ......

Public Zero Setpath (java.lang.String uri)
That cookie Specifies the path to which the client should return the cookie on which the client should return the cookie.

The cookie is visible All pages in the directory that you specify and all pages in the subdirectory of that directory should include the servlet set to cook cookies in the path of the cookie, for example, / catalog, Which makes cookies visible on all the directories under the / catalog on the server.

Contact RFC 2109 More information about setting path names for cookies (available on the Internet).

parameter: uri - A string that specifies the path

No comments:

Post a Comment