Foren

HttpServletRequest attributes statically (threadlocal) available?

thumbnail
Roland Blochberger, geändert vor 15 Jahren.

HttpServletRequest attributes statically (threadlocal) available?

New Member Beiträge: 7 Beitrittsdatum: 03.09.08 Neueste Beiträge
Is there a way to obtain attributes from the HttpServletRequest (or PortletRequest) in a static way? I would need the request Locale outside the typical Struts/Servlet classes but inside their processing sequence. (see also Locale dependent view permission for pages
thumbnail
Roland Blochberger, geändert vor 15 Jahren.

RE: HttpServletRequest attributes statically (threadlocal) availa

New Member Beiträge: 7 Beitrittsdatum: 03.09.08 Neueste Beiträge
After a valuable hint from Stanislav Mores I could solve the problem by putting the user's selected Locale into a ThreadLocal Singleton. This is done in an Action class that is configured to run first in the list of servlet.service.events.pre. The methods of the extended PermissionChecker can obtain the Locale from the Singleton whenever it is needed.
thumbnail
Brian Scott Schupbach, geändert vor 10 Jahren.

RE: HttpServletRequest attributes statically (threadlocal) availa

Expert Beiträge: 329 Beitrittsdatum: 23.10.08 Neueste Beiträge
Hi Roland,

I'm attempting to do something similar. Could you provide any insights on how you did this? Any help you could provide would be much appreciated.

Thanks,

Brian