title: Spring MVC 3 Global Request Mapping
body: <p>I am trying to check whether the users have a cookie stored in their browser. If they do and the session is not set then call a service to log them in and set session. So the mapping scope has to be global because the users can bookmark any of the page and go back to it later.</p>
  
  <p>So I was thinking of making a global controller like so</p>
  
  <pre><code>@RequestMapping("/*", method=REQUESTMETHOD.GET)
  function(){login and set session if true}
  </code></pre>
  
  <p>..Unfortunately the /* doesn't seem to work with Spring MVC 3.</p>
  
  <p>Of course, I can always do the following </p>
  
  <p>--Inside my header.jsp (this file will be included on every pages)</p>
  
  <pre><code>&lt;jsp:useBean id="link" class = "Test.CLASSNAME" /&gt;
  &lt;%=link.getMETHOD() %&gt;
  </code></pre>
  
  <p>However, that solution doesn't seem to be too elegant.</p>
  
  <p>So, my questions are</p>
  
  <p>Is there anyway to do @RequestMapping with global scope?</p>
  
  <p>Is there a better way to handle my situation using Spring MVC 3?</p>
  
  <p>Thank you :)</p>