title: How to check whether a valid session exists or not with a given jsession id
body: <p>Actually I have a requirement.</p>
  
  <ol>
  <li>(Site1) <a href="https://myappdomain.it/" rel="nofollow">https://myappdomain.it/</a>...  This is my app which is using spring and hibernate and it is build on tomcat server. </li>
  <li>(Site2) <a href="https://wiki.myappdomain.com/docs/" rel="nofollow">https://wiki.myappdomain.com/docs/</a>........ This is the documentation website which contains the documentation information of the above app and this website is developed based on php.</li>
  </ol>
  
  <p>What here I want to do is if a user login to Site1 successfully, then he will click on docs link in this Site2. Then the url will be redirected to Site1. If a user try to open the docs site with out logging into Site1. then i should show access denied.</p>
  
  <h2>My approach for solution:</h2>
  
  <p>when a user clicks on docs link, then i will send a jsessionid of Site1 to Site2. There in php site i will make a request to first site saying that to check session availability by sending the requested jsessionid as a parameter. I will write a method in Site1 which checks whether a valid session exists or not based on given jsession id. If session is valid i will send response status 200 ok. Else i will send response status 401 unauthorised access. if response status is ok, then php site will show documentation page else it shows unauthorized access. </p>
  
  <p>So here my doubt is "Am I going in correct way, and in spring or java <code>servlet</code> context, can i get session by a given jsessionId." Is this possible to do?</p>