Yes, I'm trying to get a value to be returned from HttpServletRequest#getAttribute().
It sounds like I need to:
0. Have my unit tests include a HTTP header, say X-userid.
1. Put a ContainerRequestFilter in my src/test/java/... package which turns the header into an attribute.
2. Set up my ResourceConfig to scan that package.
Is that what you're proposing?
Let's say I have another ContainerRequestFilter which relies on that attribute being set. How do I make sure that the filters run in the order I need them to?
Eric
-----Original Message-----
From: cowwoc [mailto:cowwoc_at_bbs.darktech.org]
Sent: Wednesday, October 30, 2013 8:04 PM
To: users_at_jersey.java.net
Subject: [Jersey] Re: Add attributes to Jersey Client Requests
On 30/10/2013 7:52 PM, Eric Stein wrote:
> I'm trying to do some testing using the Jersey client. I would like to put an attribute into the request, but I don't see any way to do that in the documentation or the javadocs. An internet search was less than helpful. Is this possible?
>
> Thanks,
> Eric
What do you mean by "attribute"? Are you trying to set a value to be returned by ServletRequest.getAttribute()? If so, you cannot pass such values directly from client to server. These attributes must be set on the server side (perhaps using a request filter). One approach would be to pass HTTP headers from the client to server, intercept them in the request filter and pass them into the ServletRequest.setAttribute().
Gili