Dr. Hans-Peter Störr
Dr. Hans-Peter Störr

Reputation: 25996

Spring-WS: How to access MessageContext from PayloadEndpoint

What is the "canonical" way to access the MessageContext from a PayloadEndpoint?

We are using PayloadEndpoint and AbstractMarshallingPayloadEndpoint which do not expose the MessageContext to their invoke / invokeinternal methods, but will now need to access the HTTP request parameters.

Upvotes: 0

Views: 4275

Answers (2)

Dr. Hans-Peter Störr
Dr. Hans-Peter Störr

Reputation: 25996

Someone on the Spring forum suggested to use the TransportContext to access the HTTP request parameters. This helps to solve our particular problem, but does not answer the original question how to get the MessageContext.

Another Idea would be to introduce an EndpointInterceptor and use a ThreadLocal. But I was hoping there is a way that feels less like hack.

Upvotes: 0

user7094
user7094

Reputation:

Easiest way I can think of: create a 'wrapper' endpoint which implements MessageEndpoint. Then you can extract your request parameters and pass them down to your actual endpoint.

You could store the request variables in a ThreadLocal so the original endpoint can access them.

Upvotes: 1

Related Questions