Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CA57E4A07 for ; Wed, 11 May 2011 19:04:31 +0000 (UTC) Received: (qmail 71936 invoked by uid 500); 11 May 2011 19:04:31 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 71902 invoked by uid 500); 11 May 2011 19:04:31 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 71859 invoked by uid 99); 11 May 2011 19:04:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2011 19:04:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2011 19:04:28 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id A23F4453C1 for ; Wed, 11 May 2011 19:03:48 +0000 (UTC) Date: Wed, 11 May 2011 19:03:48 +0000 (UTC) From: "Benson Margulies (JIRA)" To: issues@cxf.apache.org Message-ID: <2002346601.4270.1305140628661.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <27679601.3558.1305131747368.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CXF-3511) Add support for creating WebClient with basic authentication credentials for non-Spring usecase MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-3511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031966#comment-13031966 ] Benson Margulies commented on CXF-3511: --------------------------------------- Isn't the class WebClient essentially defined by a standard? > Add support for creating WebClient with basic authentication credentials for non-Spring usecase > ----------------------------------------------------------------------------------------------- > > Key: CXF-3511 > URL: https://issues.apache.org/jira/browse/CXF-3511 > Project: CXF > Issue Type: Improvement > Components: JAX-RS > Affects Versions: 2.4 > Reporter: Arul Dhesiaseelan > Priority: Minor > > I create a JAX-RS server programmatically without using Spring and an authentication handler set: > JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); > sf.setResourceClasses(Resource.class); > sf.setResourceProvider(Resource.class, new SingletonResourceProvider(new Resource())); > sf.setAddress("http://localhost:9000/hello"); > sf.getOutInterceptors().add(new LoggingOutInterceptor()); > sf.getInInterceptors().add(new LoggingInInterceptor()); > sf.setProvider(new AuthenticationHandler()); > On, the client side (WebClient), there is no helper method that allows me to set basic authentication credentials for non-Spring use. I can have the static method in my code, but I thought it would be handy to have it in WebClient. Here is the utility method: > /** > * Creates WebClient which will do basic authentication > * @param baseAddress baseAddress > * @param username username > * @param password password > * @return WebClient instance > */ > public static WebClient create(String baseAddress, String username, String password) { > JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); > bean.setAddress(baseAddress); > bean.setUsername(username); > bean.setPassword(password); > return bean.createWebClient(); > } -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira