Re: [Resteasy-users] NettyJaxrsServer not injecting @CookieParam

2013-03-14 Thread Bill Burke
Hmmm, it should understand CookieParam.

Inject @Context HttpHeaders.  See if there are Cookie headers.  I'll 
try and reproduce on my end too.

On 3/14/2013 8:34 AM, paul.ti...@rbs.com wrote:
 Hi all,
 I was hoping someone would be able to help with an issue I'm having
 setting up an embedded NettyJaxrsServer (for the purpose of testing).
 Basically, I'm trying to write integration tests for a fairly simple
 REST service implemented using RESTeasy 2.3.5.  Testing using JUnit and
 REST-assured.
 Spawning up my service on JBoss and testing against the URL works fine,
 however I'd like to use an embedded server so the tests can be automated
 into the CI build.
 I initially started trying to use a TJWSEmbeddedJaxrsServer, however I
 encountered insurmountable (for me) difficulties related to security.
 My REST service is simple, however, the request sends a security token
 inside a cookie, which my server authorises against another service over
 https.  There is a truststore involved aswell, and basically I couldn't
 get past SSL related code explosions... probably related to the
 following snippet from the RESTEasy user guide:
 http://docs.jboss.org/resteasy/docs/2.3.5.Final/userguide/html/RESTEasy_Embedded_Container.html#d4e1366
 /The server can either host non-encrypted or SSL based resources, but
 not both./
 So, I tried my hand at using the NettyJaxrsServer.  I was expecting more
 of the same, but lo and behold, no SSL issues.  Sadly, life is not that
 kind, and my next stumbling block (and finally getting to the point of
 this email) is that the cookie in the request is not getting injected
 into my GET method:
 @GET()
 @Produces(MediaType.APPLICATION_JSON)
 @Path(data)
 public Response getData(@CookieParam(COOKIE_PARAMETER_NAME) String
 securityToken) { ... }
 Example REST-assured request:
 given().cookie(securityToken).get(serviceUrl).prettyPrint();
 This works fine using the TJWSEmbeddedJaxrsServer, and when hosted on
 JBoss, however when using the NettyJaxrsServer, securityToken is null
 (it is definitely present in the request).
 Does the NettyJaxrsServer not understand @CookieParam, or am I doing
 something wrong or not doing something I should?
 Any help is greatly appreciated.
 Thanks
 Paul

 ***

 The Royal Bank of Scotland plc. Registered in Scotland No 90312.
 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorised and regulated by the Financial Services Authority. The
 Royal Bank of Scotland N.V. is authorised and regulated by the
 De Nederlandsche Bank and has its seat at Amsterdam, the
 Netherlands, and is registered in the Commercial Register under
 number 33002587. Registered Office: Gustav Mahlerlaan 350,
 Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and
 The Royal Bank of Scotland plc are authorised to act as agent for each
 other in certain jurisdictions.

 This e-mail message is confidential and for use by the addressee only.
 If the message is received by anyone other than the addressee, please
 return the message to the sender by replying to it and then delete the
 message from your computer. Internet e-mails are not necessarily
 secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland
 N.V. including its affiliates (RBS group) does not accept responsibility
 for changes made to this message after it was sent. For the protection
 of RBS group and its clients and customers, and in compliance with
 regulatory requirements, the contents of both incoming and outgoing
 e-mail communications, which could include proprietary information and
 Non-Public Personal Information, may be read by authorised persons
 within RBS group other than the intended recipient(s).

 Whilst all reasonable care has been taken to avoid the transmission of
 viruses, it is the responsibility of the recipient to ensure that the
 onward
 transmission, opening or use of this message and any attachments will
 not adversely affect its systems or data. No responsibility is accepted
 by the RBS group in this regard and the recipient should carry out such
 virus and other checks as it considers appropriate.

 Visit our website at www.rbs.com

 ***



 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar



 ___
 Resteasy-users mailing list
 Resteasy-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/resteasy-users


-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics 

Re: [Resteasy-users] NettyJaxrsServer not injecting @CookieParam

2013-03-14 Thread Bill Burke
With a simple test (a Resteasy client), CookieParam works, and Cookie is 
also in HttpHeaders.  Let me know what you find out.

On 3/14/2013 10:25 AM, Bill Burke wrote:
 Hmmm, it should understand CookieParam.

 Inject @Context HttpHeaders.  See if there are Cookie headers.  I'll
 try and reproduce on my end too.

 On 3/14/2013 8:34 AM, paul.ti...@rbs.com wrote:
 Hi all,
 I was hoping someone would be able to help with an issue I'm having
 setting up an embedded NettyJaxrsServer (for the purpose of testing).
 Basically, I'm trying to write integration tests for a fairly simple
 REST service implemented using RESTeasy 2.3.5.  Testing using JUnit and
 REST-assured.
 Spawning up my service on JBoss and testing against the URL works fine,
 however I'd like to use an embedded server so the tests can be automated
 into the CI build.
 I initially started trying to use a TJWSEmbeddedJaxrsServer, however I
 encountered insurmountable (for me) difficulties related to security.
 My REST service is simple, however, the request sends a security token
 inside a cookie, which my server authorises against another service over
 https.  There is a truststore involved aswell, and basically I couldn't
 get past SSL related code explosions... probably related to the
 following snippet from the RESTEasy user guide:
 http://docs.jboss.org/resteasy/docs/2.3.5.Final/userguide/html/RESTEasy_Embedded_Container.html#d4e1366
 /The server can either host non-encrypted or SSL based resources, but
 not both./
 So, I tried my hand at using the NettyJaxrsServer.  I was expecting more
 of the same, but lo and behold, no SSL issues.  Sadly, life is not that
 kind, and my next stumbling block (and finally getting to the point of
 this email) is that the cookie in the request is not getting injected
 into my GET method:
 @GET()
 @Produces(MediaType.APPLICATION_JSON)
 @Path(data)
 public Response getData(@CookieParam(COOKIE_PARAMETER_NAME) String
 securityToken) { ... }
 Example REST-assured request:
 given().cookie(securityToken).get(serviceUrl).prettyPrint();
 This works fine using the TJWSEmbeddedJaxrsServer, and when hosted on
 JBoss, however when using the NettyJaxrsServer, securityToken is null
 (it is definitely present in the request).
 Does the NettyJaxrsServer not understand @CookieParam, or am I doing
 something wrong or not doing something I should?
 Any help is greatly appreciated.
 Thanks
 Paul

 ***

 The Royal Bank of Scotland plc. Registered in Scotland No 90312.
 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorised and regulated by the Financial Services Authority. The
 Royal Bank of Scotland N.V. is authorised and regulated by the
 De Nederlandsche Bank and has its seat at Amsterdam, the
 Netherlands, and is registered in the Commercial Register under
 number 33002587. Registered Office: Gustav Mahlerlaan 350,
 Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and
 The Royal Bank of Scotland plc are authorised to act as agent for each
 other in certain jurisdictions.

 This e-mail message is confidential and for use by the addressee only.
 If the message is received by anyone other than the addressee, please
 return the message to the sender by replying to it and then delete the
 message from your computer. Internet e-mails are not necessarily
 secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland
 N.V. including its affiliates (RBS group) does not accept responsibility
 for changes made to this message after it was sent. For the protection
 of RBS group and its clients and customers, and in compliance with
 regulatory requirements, the contents of both incoming and outgoing
 e-mail communications, which could include proprietary information and
 Non-Public Personal Information, may be read by authorised persons
 within RBS group other than the intended recipient(s).

 Whilst all reasonable care has been taken to avoid the transmission of
 viruses, it is the responsibility of the recipient to ensure that the
 onward
 transmission, opening or use of this message and any attachments will
 not adversely affect its systems or data. No responsibility is accepted
 by the RBS group in this regard and the recipient should carry out such
 virus and other checks as it considers appropriate.

 Visit our website at www.rbs.com

 ***



 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://p.sf.net/sfu/appdyn_d2d_mar



 ___
 Resteasy-users mailing list
 Resteasy-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/resteasy-users



-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com