Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 95450 invoked from network); 19 Nov 2009 14:57:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Nov 2009 14:57:53 -0000 Received: (qmail 99006 invoked by uid 500); 19 Nov 2009 14:57:52 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 98916 invoked by uid 500); 19 Nov 2009 14:57:52 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 98906 invoked by uid 99); 19 Nov 2009 14:57:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2009 14:57:52 +0000 X-ASF-Spam-Status: No, hits=-11.4 required=10.0 tests=HABEAS_ACCREDITED_SOI,RCVD_IN_BSP_TRUSTED,RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.33.244.6] (HELO rhv-mipot-001.corp.ebay.com) (216.33.244.6) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2009 14:57:43 +0000 X-EBay-Corp: Yes X-IronPort-AV: E=Sophos;i="4.44,771,1249282800"; d="scan'208";a="49633243" Received: from rhv-vtenf-001.corp.ebay.com (HELO RHV-MEXBH-003.corp.ebay.com) ([10.112.113.52]) by rhv-mipot-001.corp.ebay.com with ESMTP; 19 Nov 2009 06:57:21 -0800 Received: from RHV-EXM-04.corp.ebay.com ([10.245.17.53]) by RHV-MEXBH-003.corp.ebay.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Nov 2009 06:51:34 -0800 Received: from 10.101.112.25 ([10.101.112.25]) by RHV-EXM-04.corp.ebay.com ([10.245.17.64]) with Microsoft Exchange Server HTTP-DAV ; Thu, 19 Nov 2009 14:51:34 +0000 References: <2BC75D6D6FD0E342952A22AAA39C6506065F7324@RHV-EXM-04.corp.ebay.com> <003b01ca68f8$3631c550$1f02050a@emea.progress.com> <0D37DBA8-8AC0-45EE-8D0F-AECDCFB59C26@ebay.com> <01a701ca6908$38105610$1f02050a@emea.progress.com> <2BC75D6D6FD0E342952A22AAA39C6506065F746A@RHV-EXM-04.corp.ebay.com> <02b101ca691f$a2639ba0$1f02050a@emea.progress.com> Message-ID: <2933D1E7-3AC2-4825-8BCA-7743F57A5FD0@ebay.com> From: "Pydipati, Karuna" To: Thread-Topic: Deploying JAXWS&JAXRS together - error Thread-Index: AcppJ8mZbcitTaQPRjGDpb7VeU1NCw== In-Reply-To: <02b101ca691f$a2639ba0$1f02050a@emea.progress.com> Content-Type: text/plain; format=flowed; delsp=yes; charset="us-ascii" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 (iPhone Mail 7A341) Subject: Re: Deploying JAXWS&JAXRS together - error Date: Thu, 19 Nov 2009 06:51:11 -0800 Cc: X-OriginalArrivalTime: 19 Nov 2009 14:51:34.0582 (UTC) FILETIME=[C9EC2D60:01CA6927] X-CFilter: Scanned X-Virus-Checked: Checked by ClamAV on apache.org Perfectly make sense. BTW, if you are extending HeaderParam like @HeaderParam("a","b"), I would suggest to do something like @HeaderParam("map") and in AuthHeader class, we can have a constructor like A AuthHeader(Map headerMap) This Map contains all the header and I can get whatever headers I want and populate AuthHeader fields. The reason why I am suggesting Map is that imagine a scenario where AuthHeader class has 10 fields and Developer is passing 10 headers. Then, mentioning everything in @HeaderParam would not look nice. Map would work for any number of Headers. In addtion, developer can also get hold of other existing headers too. Same case, for static valueOf(Map headerMap) method too. This is just a suggestion. But, for now, I will try use one of the existing avaialble option. Thanks Karuna Pydipati On Nov 19, 2009, at 5:53 AM, "Sergey Beryozkin" wrote: > I think you have few options. > 1. Actually use a single header but with the value being a comma- > seperated lits of name/value pairs, ex : > > auth: id=123,password=bar > > 2. Similar to 1, but use a standard HTTP Authorization header > (basic64 encoded userid:password pair) given that it's an auth info > that your're passing in this specific case > > In both cases you'll parse the string and init an AuthHeader class. > You can get to the current message from the phase chain and use CXF > JAXRS HttpHeadersImpl to simplify the parsing, but it's probably an > overhead in this case. However, if you do decide to go with the > option 2, then you'll likely want to get a base64 decoded value of > the Authorization header, you can do it like this : > > // AuthorizationPolicy will have decoded user & password values > Message message = PhaseInterceptorChain.getCurrentMessage(); > AuthorizationPolicy policy = message.get(AuthorizationPolicy.class); > > 3. Finally, if you do prefer to keep different headers, one for > user, one for password, then I can't think of the easy way, > one can probably use @HeaderParam("userid") as a starting point and > then, inside the valueOf()/ParameterHandler/etc also extract the > password header value from the current message.... > > That said, may be I can add a support for HeaderParam("a,b") where a > & b are header names, which would let the runtime do the injection > into a bean. Ex, we have QueryParam(""), FormParam("") and PathParam > ("") extensions, but no HeaderParam("").... > > cheers, Sergey > > > > I want to expand my AuthHeader class to have another field called > "password". So, My AuthHeader class will look like this. > > @XmlAccessorType(XmlAccessType.FIELD) > @XmlType(name = "authHeader", propOrder = { "userId" }) > @XmlRootElement(name = "AuthHeader") > public class AuthHeader { > > @XmlElement(name = "UserId", required = true) > protected Long userId; > protected String password; > > public Long getUserId() { > return userId; > } > public void setUserId(Long userId) { > this.userId = userId; > } > public String getPassword() { > return password; > } > public void setPassword(String password) { > this.password = password; > } > public AuthHeader(String s){ > super(); > setUserId(10077L); > } > } > > My input headers would be like this(see below). Please see userid and > password in *Header* section below. How do I mention @HeaderParam in > that case? Is it like @HeaderParam("userid", "password") in interface > method? How do I write my AuthHeader constructor with string > argument OR > static valueOf()? Please provide some clue as to how to handle > multiple > headers pointing to same Java Object on server side? > > INFO: Inbound Message > ---------------------------- > ID: 2 > Address: > /paymentapi/stubHubPaymentJaxwsJaxrs_rest/payment/ > getorderpaymentmethod3 > Encoding: ISO-8859-1 > Content-Type: application/xml > Headers: {password=[abcde], content-length=[57], userid=[10077], > accept-encoding=[gzip,deflate], host=[10.249.136.95:280 > 80], user-agent=[Jakarta Commons-HttpClient/3.1], > Content-Type=[application/xml], content-type=[application/xml]} > Payload: 23544619 > > > Regards > Karuna Pydipati > StubHub/eBay - Platform & Services > Phone: (415)222-8752 > Email: kpydipati@ebay.com > > >