<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reading session variables from inside an Alfresco extension in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/reading-session-variables-from-inside-an-alfresco-extension/m-p/253614#M206744</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a filter setup where I set a session variable like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;HttpSession session = httpServletRequest.getSession();&lt;BR /&gt;session.setAttribute("myLastName", "some last name");&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;How would I access this value inside of an extension that I write? I tried:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;String lastName = (String) RequestContextHolder.currentRequestAttributes().getAttribute("myLastName", RequestAttributes.SCOPE_SESSION);&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;But I get the following error thrown when that line is executed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know how to access session variables created inside of filters?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Apr 2012 16:33:54 GMT</pubDate>
    <dc:creator>patorjk</dc:creator>
    <dc:date>2012-04-03T16:33:54Z</dc:date>
    <item>
      <title>Reading session variables from inside an Alfresco extension</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reading-session-variables-from-inside-an-alfresco-extension/m-p/253614#M206744</link>
      <description>I have a filter setup where I set a session variable like so:HttpSession session = httpServletRequest.getSession();session.setAttribute("myLastName", "some last name");‍‍How would I access this value inside of an extension that I write? I tried&lt;IMG id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;tring lastName = (String) RequestContextHolder.current</description>
      <pubDate>Tue, 03 Apr 2012 16:33:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reading-session-variables-from-inside-an-alfresco-extension/m-p/253614#M206744</guid>
      <dc:creator>patorjk</dc:creator>
      <dc:date>2012-04-03T16:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Reading session variables from inside an Alfresco extension</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reading-session-variables-from-inside-an-alfresco-extension/m-p/253615#M206745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It appears adding the following code to my web.xml file allows the code in my previous post to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;listener&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;description&amp;gt;Spring Framework Initilization&amp;lt;/description&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;listener-class&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org.springframework.web.context.request.RequestContextListener&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/listener-class&amp;gt;&lt;BR /&gt;&amp;lt;/listener&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I figured I'd post it in case anyone runs into the same issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 18:52:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reading-session-variables-from-inside-an-alfresco-extension/m-p/253615#M206745</guid>
      <dc:creator>patorjk</dc:creator>
      <dc:date>2012-04-03T18:52:41Z</dc:date>
    </item>
  </channel>
</rss>

