You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2011/01/12 18:24:19 UTC

Struts2: httpheader result does not sent headers with hyphenated names

Hi all,

    I'm using Struts .2.1.8.1, and I've found a problem when I use  result
type httpheader and I try to use a header name with a hyphen. They don't get
sent. For example, the following result definition:

<result name="mvc.security.authentication.ntlm.solicited" type="httpheader">

    <param name="status">401</param>

    <param name="headers.WWW-Authenticate">NTLM</param>

    <param name="headers.a">my header</param>

    <param name="headers.WWWAuthenticate">NTLM</param>

</result>

    I receive the headers "a" and "WWWAuthenticate", but no the header
"WWW-Authenticate". Is there any way to fix this behaviour?



    Thanks.



Jose

HowRE: Struts2: httpheader result does not sent headers with hyphenated names

Posted by Jose Luis Martinez Avial <jl...@pb-santander.com>.
I launched an exception to get the stacktrace, and it calls OGNL:

java.lang.Throwable
        at
com.spb.mvc.controller.web.struts2.json.ResponseJSONResult.setMyValue(Re
sponseJSONResult.java:29)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:830)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1253)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
        at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.j
ava:85)
        at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
        at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectA
ccessor.java:28)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
        at ognl.SimpleNode.setValue(SimpleNode.java:301)
        at ognl.Ognl.setValue(Ognl.java:737)
        at
com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198)
        at
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:
394)
        at
com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:149)
        at
com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlRefl
ectionProvider.java:91)
        at
com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221
)
        at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActi
onInvocation.java:209)
        at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
ionInvocation.java:356)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
cation.java:266)
        at
com.spb.mvc.security.authoritation.web.AuthoritationInterceptor.intercep
t(AuthoritationInterceptor.java:100)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
cation.java:237)
        at
com.spb.mvc.controller.web.BusinessContextInterceptor.intercept(Business
ContextInterceptor.java:30)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
cation.java:237)
        at
com.spb.mvc.security.authentication.web.AuthenticationInterceptor.interc
ept(AuthenticationInterceptor.java:53)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
cation.java:237)

 Any idea on how to avoid this behaviour?

-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com] 
Sent: Wednesday, January 12, 2011 12:30 PM
To: Struts Users Mailing List
Subject: Re: Struts2: httpheader result does not sent headers with
hyphenated names

I wonder if that's an OGNL thing.

Dave

On Wed, Jan 12, 2011 at 12:24 PM, JOSE L MARTINEZ-AVIAL
<jl...@gmail.com>wrote:

> Hi all,
>
>    I'm using Struts .2.1.8.1, and I've found a problem when I use  
> result type httpheader and I try to use a header name with a hyphen. 
> They don't get sent. For example, the following result definition:
>
> <result name="mvc.security.authentication.ntlm.solicited"
> type="httpheader">
>
>    <param name="status">401</param>
>
>    <param name="headers.WWW-Authenticate">NTLM</param>
>
>    <param name="headers.a">my header</param>
>
>    <param name="headers.WWWAuthenticate">NTLM</param>
>
> </result>
>
>    I receive the headers "a" and "WWWAuthenticate", but no the header 
> "WWW-Authenticate". Is there any way to fix this behaviour?
>
>
>
>    Thanks.
>
>
>
> Jose
>

Internet communications are not secure and therefore Banco 
Santander International does not accept legal responsibility for 
the contents of this message. Any views or opinions presented 
are 
solely those of the author and do not necessarily represent those 
of Banco Santander International unless otherwise specifically 
stated. 

Las comunicaciones via Internet no son seguras y por lo tanto 
Banco Santander International no asume responsabilidad legal 
ni 
de ningun otro tipo por el contenido de este mensaje. Cualquier 
opinion transmitida pertenece unicamente al autor y no 
necesariamente representa la opinion del Banco Santander 
International a no ser que este expresamente detallado.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts2: httpheader result does not sent headers with hyphenated names

Posted by Dave Newton <da...@gmail.com>.
Not sure; maybe try "headers['WWW-Authenticate']" first?

Dave

On Wed, Jan 12, 2011 at 4:50 PM, JOSE L MARTINEZ-AVIAL <jl...@gmail.com>wrote:

> I launched an exception to get the stacktrace, and it calls OGNL:
>
> java.lang.Throwable
>        at
>
> com.spb.mvc.controller.web.struts2.json.ResponseJSONResult.setMyValue(ResponseJSONResult.java:29)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:830)
>        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1253)
>        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
>        at
>
> ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
>        at
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
>        at
>
> com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
>        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)
>        at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
>        at ognl.SimpleNode.setValue(SimpleNode.java:301)
>        at ognl.Ognl.setValue(Ognl.java:737)
>        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198)
>        at
>
> com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:394)
>        at
> com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:149)
>        at
>
> com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflectionProvider.java:91)
>        at
> com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221)
>        at
>
> com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:209)
>        at
>
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:356)
>        at
>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
>        at
>
> com.spb.mvc.security.authoritation.web.AuthoritationInterceptor.intercept(AuthoritationInterceptor.java:100)
>        at
>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
>        at
>
> com.spb.mvc.controller.web.BusinessContextInterceptor.intercept(BusinessContextInterceptor.java:30)
>        at
>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
>        at
>
> com.spb.mvc.security.authentication.web.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:53)
>        at
>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
>
>  Any idea on how to avoid this behaviour?
>
> 2011/1/12 Dave Newton <da...@gmail.com>
>
> > I wonder if that's an OGNL thing.
> >
> > Dave
> >
> > On Wed, Jan 12, 2011 at 12:24 PM, JOSE L MARTINEZ-AVIAL <
> jlmagc@gmail.com
> > >wrote:
> >
> > > Hi all,
> > >
> > >    I'm using Struts .2.1.8.1, and I've found a problem when I use
>  result
> > > type httpheader and I try to use a header name with a hyphen. They
> don't
> > > get
> > > sent. For example, the following result definition:
> > >
> > > <result name="mvc.security.authentication.ntlm.solicited"
> > > type="httpheader">
> > >
> > >    <param name="status">401</param>
> > >
> > >    <param name="headers.WWW-Authenticate">NTLM</param>
> > >
> > >    <param name="headers.a">my header</param>
> > >
> > >    <param name="headers.WWWAuthenticate">NTLM</param>
> > >
> > > </result>
> > >
> > >    I receive the headers "a" and "WWWAuthenticate", but no the header
> > > "WWW-Authenticate". Is there any way to fix this behaviour?
> > >
> > >
> > >
> > >    Thanks.
> > >
> > >
> > >
> > > Jose
> > >
> >
>

Re: Struts2: httpheader result does not sent headers with hyphenated names

Posted by JOSE L MARTINEZ-AVIAL <jl...@gmail.com>.
I launched an exception to get the stacktrace, and it calls OGNL:

java.lang.Throwable
        at
com.spb.mvc.controller.web.struts2.json.ResponseJSONResult.setMyValue(ResponseJSONResult.java:29)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:830)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1253)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
        at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
        at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
        at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
        at ognl.SimpleNode.setValue(SimpleNode.java:301)
        at ognl.Ognl.setValue(Ognl.java:737)
        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:198)
        at
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:394)
        at
com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:149)
        at
com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflectionProvider.java:91)
        at
com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221)
        at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:209)
        at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:356)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
        at
com.spb.mvc.security.authoritation.web.AuthoritationInterceptor.intercept(AuthoritationInterceptor.java:100)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        at
com.spb.mvc.controller.web.BusinessContextInterceptor.intercept(BusinessContextInterceptor.java:30)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        at
com.spb.mvc.security.authentication.web.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:53)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

 Any idea on how to avoid this behaviour?

2011/1/12 Dave Newton <da...@gmail.com>

> I wonder if that's an OGNL thing.
>
> Dave
>
> On Wed, Jan 12, 2011 at 12:24 PM, JOSE L MARTINEZ-AVIAL <jlmagc@gmail.com
> >wrote:
>
> > Hi all,
> >
> >    I'm using Struts .2.1.8.1, and I've found a problem when I use  result
> > type httpheader and I try to use a header name with a hyphen. They don't
> > get
> > sent. For example, the following result definition:
> >
> > <result name="mvc.security.authentication.ntlm.solicited"
> > type="httpheader">
> >
> >    <param name="status">401</param>
> >
> >    <param name="headers.WWW-Authenticate">NTLM</param>
> >
> >    <param name="headers.a">my header</param>
> >
> >    <param name="headers.WWWAuthenticate">NTLM</param>
> >
> > </result>
> >
> >    I receive the headers "a" and "WWWAuthenticate", but no the header
> > "WWW-Authenticate". Is there any way to fix this behaviour?
> >
> >
> >
> >    Thanks.
> >
> >
> >
> > Jose
> >
>

Re: Struts2: httpheader result does not sent headers with hyphenated names

Posted by Dave Newton <da...@gmail.com>.
I wonder if that's an OGNL thing.

Dave

On Wed, Jan 12, 2011 at 12:24 PM, JOSE L MARTINEZ-AVIAL <jl...@gmail.com>wrote:

> Hi all,
>
>    I'm using Struts .2.1.8.1, and I've found a problem when I use  result
> type httpheader and I try to use a header name with a hyphen. They don't
> get
> sent. For example, the following result definition:
>
> <result name="mvc.security.authentication.ntlm.solicited"
> type="httpheader">
>
>    <param name="status">401</param>
>
>    <param name="headers.WWW-Authenticate">NTLM</param>
>
>    <param name="headers.a">my header</param>
>
>    <param name="headers.WWWAuthenticate">NTLM</param>
>
> </result>
>
>    I receive the headers "a" and "WWWAuthenticate", but no the header
> "WWW-Authenticate". Is there any way to fix this behaviour?
>
>
>
>    Thanks.
>
>
>
> Jose
>