This page last changed on Nov 23, 2010 by jhammons.
Cannot resolve external resource into attachment. How do I get access to the current request?
Within your plugin code, you can perform the following static call to get access to the HttpServletRequest object. This then in turn gives you access to the session etc.
HttpServletRequest request = ActionContext.getRequest();
 | Please note! The request object may be null in some contexts, so always do a null-test before using the returned request. |
Be aware that your dependency in pom.xml may need amending, like so:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
|