nuwan chandrasoma-2 wrote:
>
> http://struts.apache.org/2.x/docs/how-can-we-access-the-httpservletrequest.html
>
Struts Documentation wrote:
>
> It is more difficult to test Actions with runtime dependencies on
> HttpServletRequest. Only implement ServletRequestAware as a last resort.
> If the use case cannot be solved by one of the other servet-config
> interfaces (ApplicationAware, SessionAware, ParameterAware), consider
> whether an custom Interceptor could be used instead of Action code.
>
Thanks for the link. I started looking at implementing a custom interceptor
and think it's a much better solution for me than putting the code in the
action. However, now I'm having the problem that I can't figure out how to
access the HTTP request headers from the interceptor. Is
ServletRequestAware meant to be used only in Actions? I am receiving a null
HTTP Request Servlet in my Interceptor. Also, I have included a portion of
my struts.xml file below. I am using servlet-config, so I'm not sure why
the object is not being set.
<interceptors>
<interceptor name="wireless"
class="com.sherwin.whitePages.interceptor.WirelessInterceptor"/>
<interceptor-stack name="customStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="servlet-config"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="params"/>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="wireless"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="customStack"/>
--
View this message in context:
http://www.nabble.com/-S2--Accessing-HTTP-Header-tf3907721.html#a11087892
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]