Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28528

Re: share data between two tomcat contexts?

Date 2014-05-18 11:13 +0100
From lipska the kat <lipskathekat@example.com>
Newsgroups comp.lang.java.programmer
Subject Re: share data between two tomcat contexts?
References <ll675j$4rn$1@news.m-online.net> <MZqdnW2ubo69nurOnZ2dnUVZ8rSdnZ2d@giganews.com> <ll7gok$ghl$1@news.m-online.net>
Message-ID <B82dnaOLrq5MGuXOnZ2dnUVZ8jadnZ2d@bt.com> (permalink)

Show all headers | View raw


On 17/05/14 12:22, Laura Schmidt wrote:
> On 05/17/2014 08:35 AM, Leif Roar Moldskred wrote:
>> Laura Schmidt <ls@mailinator.com> 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

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

share data between two tomcat contexts? Laura Schmidt <ls@mailinator.com> - 2014-05-17 01:32 +0200
  Re: share data between two tomcat contexts? markspace <markspace@nospam.nospam> - 2014-05-16 16:41 -0700
    Re: share data between two tomcat contexts? Laura Schmidt <ls@mailinator.com> - 2014-05-17 02:19 +0200
      Re: share data between two tomcat contexts? markspace <markspace@nospam.nospam> - 2014-05-16 17:40 -0700
        Re: share data between two tomcat contexts? Laura Schmidt <ls@mailinator.com> - 2014-05-17 08:16 +0200
      Re: share data between two tomcat contexts? Josip Almasi <joe@vrspace.org> - 2014-05-17 09:29 +0200
  Re: share data between two tomcat contexts? Arne Vajhøj <arne@vajhoej.dk> - 2014-05-16 19:45 -0400
    Re: share data between two tomcat contexts? Robert Klemme <shortcutter@googlemail.com> - 2014-05-17 12:46 +0200
  Re: share data between two tomcat contexts? leif.roar@invalid.com (Leif Roar Moldskred) - 2014-05-17 01:35 -0500
    Re: share data between two tomcat contexts? Laura Schmidt <ls@mailinator.com> - 2014-05-17 13:22 +0200
      Re: share data between two tomcat contexts? lipska the kat <lipskathekat@example.com> - 2014-05-17 13:04 +0100
      Re: share data between two tomcat contexts? leif.roar@invalid.com (Leif Roar Moldskred) - 2014-05-17 08:25 -0500
      Re: share data between two tomcat contexts? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-05-17 17:21 +0100
      Re: share data between two tomcat contexts? Robert Klemme <shortcutter@googlemail.com> - 2014-05-18 10:12 +0200
      Re: share data between two tomcat contexts? lipska the kat <lipskathekat@example.com> - 2014-05-18 11:13 +0100
      Re: share data between two tomcat contexts? Brixomatic <brixomatic@yahoo.com> - 2014-05-22 18:58 +0200
  Re: share data between two tomcat contexts? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-05-17 11:11 +0100

csiph-web