You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jmcginn13 <jo...@railinc.com> on 2013/10/15 18:53:15 UTC
CXF rest service route copies all request headers to response
Hi,
I'm having an issue where all my request headers (and all headers I add
during the route) are being copied to my http response (camel 2.12.0).
My CXF service bean looks like this:
@Path("/equipment/health/summaries")
public class EquipmentHealthSummaryWebService {
...
@Path("/stations/{stationId}")
@GET
@Produces({"application/json", "application/xml"})
@Profiled(tag="web.getEquipmentGroupHealthSummaries", level="WARN")
public EquipmentGroupHealthSummaries
getEquipmentGroupHealthSummaries(@PathParam("stationId") String stationId) {
return null;
}
...
My configured endpoint looks like this:
<cxf:rsServer id="rsEquipmentHealthRecordsWebService" address="/"
loggingFeatureEnabled="true">
<cxf:serviceBeans>
<ref bean="equipmentHealthRecordWebService"/>
<ref bean="equipmentHealthSummaryWebService"/>
<ref bean="equipmentGroupWebService"/>
</cxf:serviceBeans>
<cxf:providers>
<ref bean="jsonProvider"/>
</cxf:providers>
</cxf:rsServer>
Finally my route looks like this:
from("cxfrs://bean://rsEquipmentHealthRecordsWebService?bindingStyle=SimpleConsumer")
.tracing()
.setHeader("user").mvel("org.apache.shiro.SecurityUtils.getSubject()")
.recipientList(simple("direct:${header.operationName}"));
and
from("direct:getEquipmentGroupHealthSummaries")
.beanRef("equipmentGroupService", "getEquipmentGroupHealthSummaries")
When I hit this service, every header in my request gets copied to my
response. How can I prevent this?
Thanks
John
--
View this message in context: http://camel.465427.n5.nabble.com/CXF-rest-service-route-copies-all-request-headers-to-response-tp5741613.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF rest service route copies all request headers to response
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
IMHO the way headers are dealt with by default by CXFRS is
confusing/wrong, hopefully a filter strategy (as already recommended)
will help, in meantime, can you please consider attaching a Maven-based
test project to
https://issues.apache.org/jira/browse/CAMEL-6865 ?
so that we can investigate if it is realistic to update the current
default header filter strategy ?
Thanks, Sergey
On 15/10/13 17:53, jmcginn13 wrote:
> Hi,
>
> I'm having an issue where all my request headers (and all headers I add
> during the route) are being copied to my http response (camel 2.12.0).
>
> My CXF service bean looks like this:
> @Path("/equipment/health/summaries")
> public class EquipmentHealthSummaryWebService {
> ...
> @Path("/stations/{stationId}")
> @GET
> @Produces({"application/json", "application/xml"})
> @Profiled(tag="web.getEquipmentGroupHealthSummaries", level="WARN")
> public EquipmentGroupHealthSummaries
> getEquipmentGroupHealthSummaries(@PathParam("stationId") String stationId) {
> return null;
> }
> ...
>
> My configured endpoint looks like this:
> <cxf:rsServer id="rsEquipmentHealthRecordsWebService" address="/"
> loggingFeatureEnabled="true">
> <cxf:serviceBeans>
> <ref bean="equipmentHealthRecordWebService"/>
> <ref bean="equipmentHealthSummaryWebService"/>
> <ref bean="equipmentGroupWebService"/>
> </cxf:serviceBeans>
> <cxf:providers>
> <ref bean="jsonProvider"/>
> </cxf:providers>
> </cxf:rsServer>
>
> Finally my route looks like this:
>
> from("cxfrs://bean://rsEquipmentHealthRecordsWebService?bindingStyle=SimpleConsumer")
> .tracing()
> .setHeader("user").mvel("org.apache.shiro.SecurityUtils.getSubject()")
> .recipientList(simple("direct:${header.operationName}"));
>
> and
> from("direct:getEquipmentGroupHealthSummaries")
> .beanRef("equipmentGroupService", "getEquipmentGroupHealthSummaries")
>
> When I hit this service, every header in my request gets copied to my
> response. How can I prevent this?
>
> Thanks
>
> John
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-rest-service-route-copies-all-request-headers-to-response-tp5741613.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: CXF rest service route copies all request headers to response
Posted by Mark Frazier <mm...@icloud.com>.
set a headerFilterStrategy on the http component and write your own filter to remove the headers
you don't want.
Documented here under "HttpEndpointOptions":
http://camel.apache.org/http.html
On Oct 15, 2013, at 9:59 AM, jmcginn13 <jo...@railinc.com> wrote:
> As an extra detail, I also have the following route for a different endpoint:
>
> from("direct:getEquipmentHealthRecords")
> .beanRef("equipmentEinService")
>
> .split().simple("body").parallelProcessing().aggregationStrategyRef("equipmentHealthRecordsAggregationStrategy")
> .beanRef("equipmentHealthRecordService")
> .beanRef("healthRecordSecurityFilter",
> "filterEquipmentHealthRecord(${header.user}, ${body})")
> .end();
>
> and the headers do not get copied to the response here. I'm guessing the
> split/aggregation is losing them which is good for me, but how do can I
> consistently make sure my response does not get a copy of my request
> headers?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-rest-service-route-copies-all-request-headers-to-response-tp5741613p5741614.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF rest service route copies all request headers to response
Posted by jmcginn13 <jo...@railinc.com>.
As an extra detail, I also have the following route for a different endpoint:
from("direct:getEquipmentHealthRecords")
.beanRef("equipmentEinService")
.split().simple("body").parallelProcessing().aggregationStrategyRef("equipmentHealthRecordsAggregationStrategy")
.beanRef("equipmentHealthRecordService")
.beanRef("healthRecordSecurityFilter",
"filterEquipmentHealthRecord(${header.user}, ${body})")
.end();
and the headers do not get copied to the response here. I'm guessing the
split/aggregation is losing them which is good for me, but how do can I
consistently make sure my response does not get a copy of my request
headers?
--
View this message in context: http://camel.465427.n5.nabble.com/CXF-rest-service-route-copies-all-request-headers-to-response-tp5741613p5741614.html
Sent from the Camel - Users mailing list archive at Nabble.com.