Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed1.swip.net!news.astraweb.com!border5.a.newsrouter.astraweb.com!border2.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 18 May 2014 05:13:37 -0500 Date: Sun, 18 May 2014 11:13:37 +0100 From: lipska the kat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: share data between two tomcat contexts? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 48 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-15DlGQhJmFcVPhXKd9GEYwlbCbx1B62TAes3S82tXAucRYWi++iEmtG2RrHcgLltM8e5A3+QjZGb6y4!6BzQFaJW56gPJoc1H4EQTnMEEecWTlFJKwA60MuWlyfWN0U3UtYnC1jUk/RYKHMEVY570MVzGj0e X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3082 Xref: csiph.com comp.lang.java.programmer:28528 On 17/05/14 12:22, Laura Schmidt wrote: > On 05/17/2014 08:35 AM, Leif Roar Moldskred wrote: >> Laura Schmidt wrote: >>> Hi, >>> >>> I want to share some data between two tomcat applications running on the >>> same server. >>> >> >> Are there performance demands that prevents you from having one >> application just make HTTP requests to the other and ask for the data >> when it needs it? > > Well, the first application is an existing legacy application where > users can login. > > When logged in, they are informed about a relaunch of the application > and they can follow a link to it. > > Within the new application I would like to know the identity of the user > who is coming from the legacy application. This is why I would like to > access the other one's sesson If all you want is the identity(username) of the logged in user you can get it from the request. When the user clicks the link to the new app they actually end up at a servlet in the legacy app, in the servlet you can get the login name by calling HttpServletRequest#getRemoteUser() You then build your request dispatcher to forward the request to a resource in the new app, appending the username to the request string or adding it as an attribute, maybe you could encrypt the username at this point. when the request arrives at the new app you extract the username ... and 'Roberts your relative', you know the username of the user that logged into the legacy app. Completely insecure of course but it depends on the situation. and I have no idea if you can actually forward to a different app in this way as I've never tried it. -- lipska the kat - treacherous feline. Proudly nominated for IPOTY 2014 - LIGAF GNU/Linux user #560883 - linuxcounter.net