Discussion:
ContainerRequestContext.getHeaders() Returns Concatenated Values?
James Carman
2018-08-31 12:35:53 UTC
Permalink
I found a thread about this topic from 2015, but it seems to be talking
about client-side:

http://mail-archives.apache.org/mod_mbox/cxf-users/201504.mbox/%***@gmail.com%3E

I'm writing a CorsFilter and I need to get the list of
Access-Control-Request-Headers to evaluate them. If I do this:

JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split", true);

then everything works fine. However, it seems odd (even after reading the
referred javadocs) that the expected behavior would be concatenated
values. The return type is MultivaluedMap<String,String>. If the intent
was that there would always be only one "value" in the map for each key,
then why would they say to return a MultivaluedMap<String,String>? Perhaps
this is a problem with the spec or something, but I can't really see in the
spec where it specifically says to return the values this way. It does
have a @see pointing to the getHeaderString(String), where it does say
they'd be concatenated. I'm sure I'm missing something here. Thoughts?

Thanks,

James
James Carman
2018-08-31 12:49:57 UTC
Permalink
I think I misspoke here. Even if I set the header split property, the
ContainerRequestContext.getHeaders() still returns concatenated values, but
if I use a @Context annotation to inject HttpHeaders, I can get back the
header values individually (not concatenated). If I take away the header
split property, then HttpHeaders starts returning concatenated headers. I
probably should have said so in my original email, but I'm using CXF
v3.2.6.
Post by James Carman
I found a thread about this topic from 2015, but it seems to be talking
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split", true);
then everything works fine. However, it seems odd (even after reading the
referred javadocs) that the expected behavior would be concatenated
values. The return type is MultivaluedMap<String,String>. If the intent
was that there would always be only one "value" in the map for each key,
then why would they say to return a MultivaluedMap<String,String>? Perhaps
this is a problem with the spec or something, but I can't really see in the
spec where it specifically says to return the values this way. It does
they'd be concatenated. I'm sure I'm missing something here. Thoughts?
Thanks,
James
James Carman
2018-09-08 13:00:12 UTC
Permalink
No thoughts on this one? I'd like to keep my implementation very "vanilla"
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not doing any
unnecessary CXF-specific work-arounds in my code. If we were to "fix" it,
though, it might introduce a change in behavior and that's not good
either.
Post by James Carman
I think I misspoke here. Even if I set the header split property, the
ContainerRequestContext.getHeaders() still returns concatenated values, but
header values individually (not concatenated). If I take away the header
split property, then HttpHeaders starts returning concatenated headers. I
probably should have said so in my original email, but I'm using CXF
v3.2.6.
Post by James Carman
I found a thread about this topic from 2015, but it seems to be talking
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split", true);
then everything works fine. However, it seems odd (even after reading
the referred javadocs) that the expected behavior would be concatenated
values. The return type is MultivaluedMap<String,String>. If the intent
was that there would always be only one "value" in the map for each key,
then why would they say to return a MultivaluedMap<String,String>? Perhaps
this is a problem with the spec or something, but I can't really see in the
spec where it specifically says to return the values this way. It does
they'd be concatenated. I'm sure I'm missing something here. Thoughts?
Thanks,
James
Andy McCright
2018-09-12 22:37:54 UTC
Permalink
Hi James,

Just speculating here... what if you add this code to your Application
subclass:

@Override

public Map<String, Object> getProperties() {

Map<String,Object> props = new HashMap<>();

props.put("org.apache.cxf.http.header.split", true);

return props;

}


I think that might a more portable approach that does the same thing...


Hope this helps,


Andy
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very "vanilla"
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not doing any
unnecessary CXF-specific work-arounds in my code. If we were to "fix" it,
though, it might introduce a change in behavior and that's not good
either.
Post by James Carman
I think I misspoke here. Even if I set the header split property, the
ContainerRequestContext.getHeaders() still returns concatenated values,
but
Post by James Carman
header values individually (not concatenated). If I take away the header
split property, then HttpHeaders starts returning concatenated headers.
I
Post by James Carman
probably should have said so in my original email, but I'm using CXF
v3.2.6.
Post by James Carman
I found a thread about this topic from 2015, but it seems to be talking
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after reading
the referred javadocs) that the expected behavior would be concatenated
values. The return type is MultivaluedMap<String,String>. If the
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for each key,
then why would they say to return a MultivaluedMap<String,String>?
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really see in
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way. It does
they'd be concatenated. I'm sure I'm missing something here. Thoughts?
Thanks,
James
James Carman
2018-09-12 22:51:02 UTC
Permalink
Well, it still doesn't even work consistently . Even with that property
set, ContainerRequestContext.getHeaders() returns concatenated values.
HttpHeaders (injected via @Context) does not.

What I'm trying to determine is if this really is expected behavior. I've
looked at the spec and can't really find where it says these should be
concatenated values. I'm sure I missed something.

I actually don't typically usually use an Application class in my JAX-RS
projects, at least not with CXF. I get that's the only really portable way
to register stuff, but I typically don't.
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your Application
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same thing...
Hope this helps,
Andy
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not doing
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to "fix"
it,
Post by James Carman
though, it might introduce a change in behavior and that's not good
either.
Post by James Carman
I think I misspoke here. Even if I set the header split property, the
ContainerRequestContext.getHeaders() still returns concatenated values,
but
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away the
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated headers.
I
Post by James Carman
probably should have said so in my original email, but I'm using CXF
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to be
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after reading
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If the
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for each
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a MultivaluedMap<String,String>?
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really see
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way. It
does
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
Andy McCright
2018-09-13 18:20:10 UTC
Permalink
So it sounds like there are two issues here:

1) The "org.apache.cxf.http.header.split" property is applied
inconsistently - it works correctly in HttpHeaders, but not in
ContainerRequestContext.getHeaders(). This seems like a bug to me.
2) The value for this property should be true by default - this doesn't
seem clear in the spec, but I tend to agree with you that it ought to be
split by default. Unless somebody says otherwise, I don't think we should
change the default behavior in the released streams (3.1.X and 3.2.X). But
I think it would be fine to change the default behavior in the 3.3.X
(master) stream.

Would you open up a JIRA for these issues? We can probably use one JIRA
for both and just mention that the default behavior will remain the same in
the service releases.

Thanks, Andy
Post by James Carman
Well, it still doesn't even work consistently . Even with that property
set, ContainerRequestContext.getHeaders() returns concatenated values.
What I'm trying to determine is if this really is expected behavior. I've
looked at the spec and can't really find where it says these should be
concatenated values. I'm sure I missed something.
I actually don't typically usually use an Application class in my JAX-RS
projects, at least not with CXF. I get that's the only really portable way
to register stuff, but I typically don't.
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your Application
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same thing...
Hope this helps,
Andy
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not doing
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to "fix"
it,
Post by James Carman
though, it might introduce a change in behavior and that's not good
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman <
Post by James Carman
I think I misspoke here. Even if I set the header split property,
the
Post by Andy McCright
Post by James Carman
Post by James Carman
ContainerRequestContext.getHeaders() still returns concatenated
values,
Post by Andy McCright
Post by James Carman
but
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away the
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm using CXF
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to be
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If the
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for each
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a MultivaluedMap<String,String>?
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really see
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way. It
does
say
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
James Carman
2018-09-13 19:23:34 UTC
Permalink
Yeah, no problem. You mind if I take a stab at the PR?
Post by Andy McCright
1) The "org.apache.cxf.http.header.split" property is applied
inconsistently - it works correctly in HttpHeaders, but not in
ContainerRequestContext.getHeaders(). This seems like a bug to me.
2) The value for this property should be true by default - this doesn't
seem clear in the spec, but I tend to agree with you that it ought to be
split by default. Unless somebody says otherwise, I don't think we should
change the default behavior in the released streams (3.1.X and 3.2.X). But
I think it would be fine to change the default behavior in the 3.3.X
(master) stream.
Would you open up a JIRA for these issues? We can probably use one JIRA
for both and just mention that the default behavior will remain the same in
the service releases.
Thanks, Andy
Post by James Carman
Well, it still doesn't even work consistently . Even with that property
set, ContainerRequestContext.getHeaders() returns concatenated values.
What I'm trying to determine is if this really is expected behavior.
I've
Post by James Carman
looked at the spec and can't really find where it says these should be
concatenated values. I'm sure I missed something.
I actually don't typically usually use an Application class in my JAX-RS
projects, at least not with CXF. I get that's the only really portable
way
Post by James Carman
to register stuff, but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright <
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your Application
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same thing...
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman <
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not
doing
Post by James Carman
Post by Andy McCright
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to
"fix"
Post by James Carman
Post by Andy McCright
it,
Post by James Carman
though, it might introduce a change in behavior and that's not good
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman <
Post by James Carman
I think I misspoke here. Even if I set the header split property,
the
Post by Andy McCright
Post by James Carman
Post by James Carman
ContainerRequestContext.getHeaders() still returns concatenated
values,
Post by Andy McCright
Post by James Carman
but
back
Post by James Carman
Post by Andy McCright
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away the
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm using
CXF
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by James Carman
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to be
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
Post by James Carman
Post by Andy McCright
Post by James Carman
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If the
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for
each
Post by James Carman
Post by Andy McCright
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a MultivaluedMap<String,String>?
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really
see
Post by James Carman
Post by Andy McCright
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way. It
does
say
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
Andy McCright
2018-09-13 19:41:32 UTC
Permalink
By all means! :) Let me know once you've got something ready for review.

Thanks!
Post by James Carman
Yeah, no problem. You mind if I take a stab at the PR?
Post by Andy McCright
1) The "org.apache.cxf.http.header.split" property is applied
inconsistently - it works correctly in HttpHeaders, but not in
ContainerRequestContext.getHeaders(). This seems like a bug to me.
2) The value for this property should be true by default - this doesn't
seem clear in the spec, but I tend to agree with you that it ought to be
split by default. Unless somebody says otherwise, I don't think we
should
Post by Andy McCright
change the default behavior in the released streams (3.1.X and 3.2.X).
But
Post by Andy McCright
I think it would be fine to change the default behavior in the 3.3.X
(master) stream.
Would you open up a JIRA for these issues? We can probably use one JIRA
for both and just mention that the default behavior will remain the same
in
Post by Andy McCright
the service releases.
Thanks, Andy
Post by James Carman
Well, it still doesn't even work consistently . Even with that property
set, ContainerRequestContext.getHeaders() returns concatenated values.
What I'm trying to determine is if this really is expected behavior.
I've
Post by James Carman
looked at the spec and can't really find where it says these should be
concatenated values. I'm sure I missed something.
I actually don't typically usually use an Application class in my
JAX-RS
Post by Andy McCright
Post by James Carman
projects, at least not with CXF. I get that's the only really portable
way
Post by James Carman
to register stuff, but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright <
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your
Application
Post by Andy McCright
Post by James Carman
Post by Andy McCright
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same
thing...
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman <
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not
doing
Post by James Carman
Post by Andy McCright
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to
"fix"
Post by James Carman
Post by Andy McCright
it,
Post by James Carman
though, it might introduce a change in behavior and that's not good
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman <
Post by James Carman
I think I misspoke here. Even if I set the header split
property,
Post by Andy McCright
Post by James Carman
the
Post by Andy McCright
Post by James Carman
Post by James Carman
ContainerRequestContext.getHeaders() still returns concatenated
values,
Post by Andy McCright
Post by James Carman
but
back
Post by James Carman
Post by Andy McCright
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm using
CXF
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by James Carman
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to be
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
Post by James Carman
Post by Andy McCright
Post by James Carman
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for
each
Post by James Carman
Post by Andy McCright
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a
MultivaluedMap<String,String>?
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really
see
Post by James Carman
Post by Andy McCright
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way.
It
Post by Andy McCright
Post by James Carman
Post by Andy McCright
does
does
Post by Andy McCright
Post by James Carman
say
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
James Carman
2018-09-13 21:57:29 UTC
Permalink
I created two JIRAs:

https://jira.apache.org/jira/browse/CXF-7842
https://jira.apache.org/jira/browse/CXF-7843

I listed them both as bugs, but we may want to change 7843 to an
"improvement" or something maybe? I don't know. I am working on 7842 now.
Post by Andy McCright
By all means! :) Let me know once you've got something ready for review.
Thanks!
Post by James Carman
Yeah, no problem. You mind if I take a stab at the PR?
On Thu, Sep 13, 2018 at 2:20 PM Andy McCright <
Post by Andy McCright
1) The "org.apache.cxf.http.header.split" property is applied
inconsistently - it works correctly in HttpHeaders, but not in
ContainerRequestContext.getHeaders(). This seems like a bug to me.
2) The value for this property should be true by default - this doesn't
seem clear in the spec, but I tend to agree with you that it ought to
be
Post by James Carman
Post by Andy McCright
split by default. Unless somebody says otherwise, I don't think we
should
Post by Andy McCright
change the default behavior in the released streams (3.1.X and 3.2.X).
But
Post by Andy McCright
I think it would be fine to change the default behavior in the 3.3.X
(master) stream.
Would you open up a JIRA for these issues? We can probably use one
JIRA
Post by James Carman
Post by Andy McCright
for both and just mention that the default behavior will remain the
same
Post by James Carman
in
Post by Andy McCright
the service releases.
Thanks, Andy
On Wed, Sep 12, 2018 at 5:51 PM James Carman <
Post by James Carman
Well, it still doesn't even work consistently . Even with that
property
Post by James Carman
Post by Andy McCright
Post by James Carman
set, ContainerRequestContext.getHeaders() returns concatenated
values.
Post by James Carman
Post by Andy McCright
Post by James Carman
What I'm trying to determine is if this really is expected behavior.
I've
Post by James Carman
looked at the spec and can't really find where it says these should
be
Post by James Carman
Post by Andy McCright
Post by James Carman
concatenated values. I'm sure I missed something.
I actually don't typically usually use an Application class in my
JAX-RS
Post by Andy McCright
Post by James Carman
projects, at least not with CXF. I get that's the only really
portable
Post by James Carman
Post by Andy McCright
way
Post by James Carman
to register stuff, but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright <
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your
Application
Post by Andy McCright
Post by James Carman
Post by Andy McCright
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same
thing...
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman <
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not
doing
Post by James Carman
Post by Andy McCright
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to
"fix"
Post by James Carman
Post by Andy McCright
it,
Post by James Carman
though, it might introduce a change in behavior and that's not
good
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman <
Post by James Carman
I think I misspoke here. Even if I set the header split
property,
Post by Andy McCright
Post by James Carman
the
Post by Andy McCright
Post by James Carman
Post by James Carman
ContainerRequestContext.getHeaders() still returns concatenated
values,
Post by Andy McCright
Post by James Carman
but
back
Post by James Carman
Post by Andy McCright
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm
using
Post by James Carman
Post by Andy McCright
CXF
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by James Carman
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to
be
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
Access-Control-Request-Headers to evaluate them. If I do
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
Post by James Carman
Post by Andy McCright
Post by James Carman
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for
each
Post by James Carman
Post by Andy McCright
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a
MultivaluedMap<String,String>?
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't
really
Post by James Carman
Post by Andy McCright
see
Post by James Carman
Post by Andy McCright
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way.
It
Post by Andy McCright
Post by James Carman
Post by Andy McCright
does
does
Post by Andy McCright
Post by James Carman
say
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
James Carman
2018-09-13 22:50:53 UTC
Permalink
Andy, I've submitted a PR for the splitting part (not the changing the
defaults):

https://github.com/apache/cxf/pull/445

There was some funky stuff going on in there with how it nulls out the
existing HttpHeaders object on the ContainerRequestContextImpl. I wasn't
quite sure why that was being done and changing it didn't break any tests.
Hope this will work. Let me know.
Post by Andy McCright
By all means! :) Let me know once you've got something ready for review.
Thanks!
Post by James Carman
Yeah, no problem. You mind if I take a stab at the PR?
On Thu, Sep 13, 2018 at 2:20 PM Andy McCright <
Post by Andy McCright
1) The "org.apache.cxf.http.header.split" property is applied
inconsistently - it works correctly in HttpHeaders, but not in
ContainerRequestContext.getHeaders(). This seems like a bug to me.
2) The value for this property should be true by default - this doesn't
seem clear in the spec, but I tend to agree with you that it ought to
be
Post by James Carman
Post by Andy McCright
split by default. Unless somebody says otherwise, I don't think we
should
Post by Andy McCright
change the default behavior in the released streams (3.1.X and 3.2.X).
But
Post by Andy McCright
I think it would be fine to change the default behavior in the 3.3.X
(master) stream.
Would you open up a JIRA for these issues? We can probably use one
JIRA
Post by James Carman
Post by Andy McCright
for both and just mention that the default behavior will remain the
same
Post by James Carman
in
Post by Andy McCright
the service releases.
Thanks, Andy
On Wed, Sep 12, 2018 at 5:51 PM James Carman <
Post by James Carman
Well, it still doesn't even work consistently . Even with that
property
Post by James Carman
Post by Andy McCright
Post by James Carman
set, ContainerRequestContext.getHeaders() returns concatenated
values.
Post by James Carman
Post by Andy McCright
Post by James Carman
What I'm trying to determine is if this really is expected behavior.
I've
Post by James Carman
looked at the spec and can't really find where it says these should
be
Post by James Carman
Post by Andy McCright
Post by James Carman
concatenated values. I'm sure I missed something.
I actually don't typically usually use an Application class in my
JAX-RS
Post by Andy McCright
Post by James Carman
projects, at least not with CXF. I get that's the only really
portable
Post by James Carman
Post by Andy McCright
way
Post by James Carman
to register stuff, but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright <
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your
Application
Post by Andy McCright
Post by James Carman
Post by Andy McCright
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same
thing...
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman <
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not
doing
Post by James Carman
Post by Andy McCright
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to
"fix"
Post by James Carman
Post by Andy McCright
it,
Post by James Carman
though, it might introduce a change in behavior and that's not
good
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman <
Post by James Carman
I think I misspoke here. Even if I set the header split
property,
Post by Andy McCright
Post by James Carman
the
Post by Andy McCright
Post by James Carman
Post by James Carman
ContainerRequestContext.getHeaders() still returns concatenated
values,
Post by Andy McCright
Post by James Carman
but
back
Post by James Carman
Post by Andy McCright
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm
using
Post by James Carman
Post by Andy McCright
CXF
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by James Carman
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to
be
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
Access-Control-Request-Headers to evaluate them. If I do
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split",
Post by James Carman
Post by Andy McCright
Post by James Carman
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for
each
Post by James Carman
Post by Andy McCright
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a
MultivaluedMap<String,String>?
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't
really
Post by James Carman
Post by Andy McCright
see
Post by James Carman
Post by Andy McCright
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way.
It
Post by Andy McCright
Post by James Carman
Post by Andy McCright
does
does
Post by Andy McCright
Post by James Carman
say
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
James Carman
2018-09-13 23:20:28 UTC
Permalink
I also created a branch of my project which uses the local version of CXF
3.3.0-SNAPSHOT with my changes in it. I am able to use
ContainerRequestContext and I no longer have to set the property! W00T!

https://github.com/jaxxy-rs/jaxxy/tree/cxf-3.3.0-snapshot

Thanks for taking the time to help, Andy!
Post by James Carman
Andy, I've submitted a PR for the splitting part (not the changing the
https://github.com/apache/cxf/pull/445
There was some funky stuff going on in there with how it nulls out the
existing HttpHeaders object on the ContainerRequestContextImpl. I wasn't
quite sure why that was being done and changing it didn't break any tests.
Hope this will work. Let me know.
Post by Andy McCright
By all means! :) Let me know once you've got something ready for review.
Thanks!
Post by James Carman
Yeah, no problem. You mind if I take a stab at the PR?
On Thu, Sep 13, 2018 at 2:20 PM Andy McCright <
Post by Andy McCright
1) The "org.apache.cxf.http.header.split" property is applied
inconsistently - it works correctly in HttpHeaders, but not in
ContainerRequestContext.getHeaders(). This seems like a bug to me.
2) The value for this property should be true by default - this
doesn't
Post by James Carman
Post by Andy McCright
seem clear in the spec, but I tend to agree with you that it ought to
be
Post by James Carman
Post by Andy McCright
split by default. Unless somebody says otherwise, I don't think we
should
Post by Andy McCright
change the default behavior in the released streams (3.1.X and 3.2.X).
But
Post by Andy McCright
I think it would be fine to change the default behavior in the 3.3.X
(master) stream.
Would you open up a JIRA for these issues? We can probably use one
JIRA
Post by James Carman
Post by Andy McCright
for both and just mention that the default behavior will remain the
same
Post by James Carman
in
Post by Andy McCright
the service releases.
Thanks, Andy
On Wed, Sep 12, 2018 at 5:51 PM James Carman <
Post by James Carman
Well, it still doesn't even work consistently . Even with that
property
Post by James Carman
Post by Andy McCright
Post by James Carman
set, ContainerRequestContext.getHeaders() returns concatenated
values.
Post by James Carman
Post by Andy McCright
Post by James Carman
What I'm trying to determine is if this really is expected behavior.
I've
Post by James Carman
looked at the spec and can't really find where it says these should
be
Post by James Carman
Post by Andy McCright
Post by James Carman
concatenated values. I'm sure I missed something.
I actually don't typically usually use an Application class in my
JAX-RS
Post by Andy McCright
Post by James Carman
projects, at least not with CXF. I get that's the only really
portable
Post by James Carman
Post by Andy McCright
way
Post by James Carman
to register stuff, but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright <
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your
Application
Post by Andy McCright
Post by James Carman
Post by Andy McCright
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same
thing...
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman <
Post by James Carman
No thoughts on this one? I'd like to keep my implementation
very
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not
doing
Post by James Carman
Post by Andy McCright
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to
"fix"
Post by James Carman
Post by Andy McCright
it,
Post by James Carman
though, it might introduce a change in behavior and that's not
good
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman <
Post by James Carman
I think I misspoke here. Even if I set the header split
property,
Post by Andy McCright
Post by James Carman
the
Post by Andy McCright
Post by James Carman
Post by James Carman
ContainerRequestContext.getHeaders() still returns
concatenated
Post by James Carman
Post by Andy McCright
Post by James Carman
values,
Post by Andy McCright
Post by James Carman
but
get
Post by James Carman
Post by Andy McCright
back
Post by James Carman
Post by Andy McCright
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm
using
Post by James Carman
Post by Andy McCright
CXF
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by James Carman
v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to
be
Post by James Carman
Post by Andy McCright
Post by James Carman
Post by Andy McCright
talking
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
Access-Control-Request-Headers to evaluate them. If I do
JAXRSServerFactoryBean factory = new
JAXRSServerFactoryBean();
Post by James Carman
Post by Andy McCright
factory.getProperties(true).put("org.apache.cxf.http.header.split",
Post by James Carman
Post by Andy McCright
Post by James Carman
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even
after
Post by James Carman
Post by Andy McCright
Post by James Carman
reading
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
the referred javadocs) that the expected behavior would be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>.
If
Post by James Carman
the
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map
for
Post by James Carman
Post by Andy McCright
each
Post by James Carman
Post by Andy McCright
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a
MultivaluedMap<String,String>?
Post by Andy McCright
Post by James Carman
Post by Andy McCright
Post by James Carman
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't
really
Post by James Carman
Post by Andy McCright
see
Post by James Carman
Post by Andy McCright
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this
way.
Post by James Carman
It
Post by Andy McCright
Post by James Carman
Post by Andy McCright
does
does
Post by Andy McCright
Post by James Carman
say
Post by Andy McCright
Post by James Carman
Post by James Carman
Post by James Carman
they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
Andrei Shakirin
2018-09-14 09:35:17 UTC
Permalink
Hi James,

Looks as inconsistency on the first view.
Could you invest a bit more efforts and check how Jersey behaves in this case?

Regards,
Andrei.
-----Original Message-----
Sent: Donnerstag, 13. September 2018 00:51
Subject: Re: ContainerRequestContext.getHeaders() Returns Concatenated
Values?
Well, it still doesn't even work consistently . Even with that property set,
ContainerRequestContext.getHeaders() returns concatenated values.
What I'm trying to determine is if this really is expected behavior. I've looked
at the spec and can't really find where it says these should be concatenated
values. I'm sure I missed something.
I actually don't typically usually use an Application class in my JAX-RS projects,
at least not with CXF. I get that's the only really portable way to register stuff,
but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your
Application
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same thing...
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not doing
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to "fix"
it,
Post by James Carman
though, it might introduce a change in behavior and that's not good
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman
Post by James Carman
I think I misspoke here. Even if I set the header split property, the
ContainerRequestContext.getHeaders() still returns concatenated values,
but
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away the
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated headers.
I
Post by James Carman
probably should have said so in my original email, but I'm using
CXF v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to be
talking
https://urldefense.proofpoint.com/v2/url?u=http-3A__mail-2Darchives.ap
ache.org_mod-5Fmbox_cxf-2Dusers_201504.mbox_-
253C552BED6B.3000809-40gm
Post by Andy McCright
ail.com-
253E&d=DwIBaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm
Post by Andy McCright
-lcbhtB3cv08OlIr0lkKR4&m=LtVUiAWp616aAPUnohJFxm_7-
hgmuQHkcURHKrhRpBI&s
Post by Andy McCright
=aRsXwOJ2jihkyx9DqweSVqU5t3C9TwVls5OwhTdDPZk&e=
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split
",
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading the referred javadocs) that the expected behavior would
be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If the
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for each
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a MultivaluedMap<String,String>?
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really see
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way.
It
does
Post by James Carman
Post by James Carman
Post by James Carman
does say they'd be concatenated. I'm sure I'm missing something here.
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
As a recipient of an email from Talend, your contact personal data will be on our systems. Please see our contacts privacy notice at Talend, Inc
James Carman
2018-09-14 12:51:17 UTC
Permalink
So, I wrote a simple filter to test this out on Jersey and it also does NOT
split the headers:

@Provider
public class DumpHeadersFilter implements ContainerRequestFilter {

@Context
private HttpHeaders httpHeaders;

@Override
public void filter(ContainerRequestContext requestContext) throws
IOException {
Map<String,Integer> valueCounts = new HashMap<>();

httpHeaders.getRequestHeaders().forEach((name,values)->{
valueCounts.put(name, values == null ? 0 : values.size());
});
requestContext.abortWith(Response.ok(String.valueOf(valueCounts),
MediaType.TEXT_PLAIN_TYPE).build());
}
}

I flipped this between using the injected HttpHeaders and the
ContainerRequestContext and they both return 1's for all the counts.

Apparently there was a JIRA issue (JERSEY-2164) filed for this as a bug.
There's even a test case:

https://github.com/eclipse-ee4j/jersey/blob/master/tests/integration/jersey-2164/src/test/java/org/glassfish/jersey/tests/integration/jersey2164/Jersey2164ITCase.java

This is how I found JERSEY-2164 (the JIRA link is dead):

https://www.logicbig.com/how-to/jax-rs/jax-rs-multi-header-example.html

This is just very odd, though. Why on Earth would the spec return
MultivaluedMap if it didn't intend for there to be multiple values? This
just seems very counter-intuitive.

What do we want to do here? The one PR at least makes it consistent wrt
our "split headers" setting between ContainerRequestFilter.getHeaders() and
HttpHeaders. Should we integrate that only and leave the default behavior
alone?

Thanks for all your time, guys. I really appreciate it.

James
Post by Andy McCright
Hi James,
Looks as inconsistency on the first view.
Could you invest a bit more efforts and check how Jersey behaves in this case?
Regards,
Andrei.
-----Original Message-----
Sent: Donnerstag, 13. September 2018 00:51
Subject: Re: ContainerRequestContext.getHeaders() Returns Concatenated
Values?
Well, it still doesn't even work consistently . Even with that property
set,
ContainerRequestContext.getHeaders() returns concatenated values.
What I'm trying to determine is if this really is expected behavior.
I've looked
at the spec and can't really find where it says these should be
concatenated
values. I'm sure I missed something.
I actually don't typically usually use an Application class in my JAX-RS
projects,
at least not with CXF. I get that's the only really portable way to
register stuff,
but I typically don't.
On Wed, Sep 12, 2018 at 6:38 PM Andy McCright
Post by Andy McCright
Hi James,
Just speculating here... what if you add this code to your Application
@Override
public Map<String, Object> getProperties() {
Map<String,Object> props = new HashMap<>();
props.put("org.apache.cxf.http.header.split", true);
return props;
}
I think that might a more portable approach that does the same thing...
Hope this helps,
Andy
On Sat, Sep 8, 2018 at 8:00 AM James Carman
Post by James Carman
No thoughts on this one? I'd like to keep my implementation very
"vanilla"
Post by James Carman
with respect to the JAX-RS spec, but I am using CXF as my JAX-RS
implementation during testing. I just want to make sure I'm not doing
any
Post by James Carman
unnecessary CXF-specific work-arounds in my code. If we were to
"fix"
Post by Andy McCright
it,
Post by James Carman
though, it might introduce a change in behavior and that's not good
either.
On Fri, Aug 31, 2018 at 8:49 AM James Carman
Post by James Carman
I think I misspoke here. Even if I set the header split property, the
ContainerRequestContext.getHeaders() still returns concatenated values,
but
the
Post by James Carman
Post by James Carman
header values individually (not concatenated). If I take away the
header
Post by James Carman
Post by James Carman
split property, then HttpHeaders starts returning concatenated
headers.
Post by Andy McCright
Post by James Carman
I
Post by James Carman
probably should have said so in my original email, but I'm using
CXF v3.2.6.
On Fri, Aug 31, 2018 at 8:35 AM James Carman <
Post by James Carman
I found a thread about this topic from 2015, but it seems to be
talking
https://urldefense.proofpoint.com/v2/url?u=http-3A__mail-2Darchives.ap
ache.org_mod-5Fmbox_cxf-2Dusers_201504.mbox_-
253C552BED6B.3000809-40gm
Post by Andy McCright
ail.com-
253E&d=DwIBaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm
Post by Andy McCright
-lcbhtB3cv08OlIr0lkKR4&m=LtVUiAWp616aAPUnohJFxm_7-
hgmuQHkcURHKrhRpBI&s
Post by Andy McCright
=aRsXwOJ2jihkyx9DqweSVqU5t3C9TwVls5OwhTdDPZk&e=
Post by James Carman
Post by James Carman
Post by James Carman
I'm writing a CorsFilter and I need to get the list of
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.getProperties(true).put("org.apache.cxf.http.header.split
",
true);
Post by James Carman
Post by James Carman
then everything works fine. However, it seems odd (even after
reading the referred javadocs) that the expected behavior would
be
concatenated
Post by James Carman
Post by James Carman
Post by James Carman
values. The return type is MultivaluedMap<String,String>. If the
intent
Post by James Carman
Post by James Carman
was that there would always be only one "value" in the map for each
key,
Post by James Carman
Post by James Carman
Post by James Carman
then why would they say to return a MultivaluedMap<String,String>?
Perhaps
Post by James Carman
Post by James Carman
this is a problem with the spec or something, but I can't really see
in
Post by James Carman
the
Post by James Carman
Post by James Carman
spec where it specifically says to return the values this way.
It
does
Post by James Carman
Post by James Carman
Post by James Carman
does say they'd be concatenated. I'm sure I'm missing something
here.
Post by Andy McCright
Thoughts?
Post by James Carman
Post by James Carman
Post by James Carman
Thanks,
James
As a recipient of an email from Talend, your contact personal data will be
on our systems. Please see our contacts privacy notice at Talend, Inc. <
https://www.talend.com/contacts-privacy-policy/>
Loading...