using curl to call rather than browser you can do this.
*curl -v http://localhost:8888/jersey/message/set <http://localhost:8888/jersey/message/set>* > *...* > *< HTTP/1.1 200 OK* > *< Set-Cookie: JSESSIONID=a734bdcc-75fa-4c56-9d9a-c5bf0a5813d9; Path=/; > HttpOnly **...* *curl --cookie "JSESSIONID=a734bdcc-75fa-4c56-9d9a-c5bf0a5813d9" http://localhost:8888/jersey/message <http://localhost:8888/jersey/message>* Current user: It's ME! You see the session id is important to retrieve items stored. Hope this helps. I'm signing off. Good luck On 18 March 2014 21:59, Dominic Farr <[email protected]> wrote: > here is a sample project I added for another forum user. i've added a > jersey endpoint that basically does what you need. > > https://github.com/dominicfarr/skybird-shiro > > mvn jetty:run > > browse to http://localhost:8888/jersey/message to show no value in session > browse to http://localhost:8888/jersey/message/set to set a value. > browser again to http://localhost:8888/jersey/message and see the value > returned. > > when http://localhost:8888/jersey/message/set is called (sorry about the > poor use of get) it creates a session, adds value into session, drops a > cookie with the session id into the browser. the next call to > http://localhost:8888/jersey/message uses this cookie to retrieve the > session and look up the value in the session and response with it. > > shiro.ini<https://github.com/dominicfarr/skybird-shiro/blob/master/src/main/webapp/WEB-INF/shiro.ini#L21> > - > configures anonymous access to jersey endpint > > Jersey > Endpoint<https://github.com/dominicfarr/skybird-shiro/blob/master/src/main/java/domfarr/ws/SomeEndpoint.java> > - > configures two GET resources. 1 to get the session key. 1 to set the > session key. > > I suspect you aren't using a browser because this is an api rather than > web page/site. Is that correct? > > > On 18 March 2014 21:02, onelazyguy <[email protected]> wrote: > >> Dominic, >> I will post up my shiro config file when I get home tonight. >> Thank you! >> >> >> >> -- >> View this message in context: >> http://shiro-user.582556.n2.nabble.com/How-to-get-the-user-session-using-apache-shiro-with-jersey-RESTful-tp7579771p7579773.html >> Sent from the Shiro User mailing list archive at Nabble.com. >> > >
