Author: sergeyb Date: Fri May 3 09:43:26 2013 New Revision: 1478692 URL: http://svn.apache.org/r1478692 Log: Merged revisions 1478688 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................ r1478688 | sergeyb | 2013-05-03 10:39:45 +0100 (Fri, 03 May 2013) | 16 lines Merged revisions 1478687 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1478687 | sergeyb | 2013-05-03 10:36:57 +0100 (Fri, 03 May 2013) | 9 lines Merged revisions 1478686 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1478686 | sergeyb | 2013-05-03 10:21:05 +0100 (Fri, 03 May 2013) | 1 line [CXF-4998] Adding one more method to client factories to make it a bit simpler to register providers and username and password ........ ................ ................ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1478687 Merged /cxf/trunk:r1478686 Merged /cxf/branches/2.6.x-fixes:r1478688 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java?rev=1478692&r1=1478691&r2=1478692&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java (original) +++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java Fri May 3 09:43:26 2013 @@ -193,6 +193,25 @@ public final class JAXRSClientFactory { } /** + * Creates a proxy which will do basic authentication + * @param baseAddress baseAddress + * @param cls proxy class, if not interface then a CGLIB proxy will be created + * @param providers list of providers + * @param username username + * @param password password + * @param configLocation classpath location of the configuration resource + * @return typed proxy + */ + public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, + String username, String password, String configLocation) { + JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); + bean.setUsername(username); + bean.setPassword(password); + bean.setProviders(providers); + return bean.create(cls); + } + + /** * Creates a proxy using user resource model * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1478692&r1=1478691&r2=1478692&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original) +++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Fri May 3 09:43:26 2013 @@ -193,6 +193,25 @@ public class WebClient extends AbstractC } /** + * Creates WebClient which will do basic authentication + * @param baseAddress baseAddress + * @param providers list of providers + * @param username username + * @param password password + * @param configLocation classpath location of the configuration resource, can be null + * @return WebClient instance + */ + public static WebClient create(String baseAddress, List<?> providers, + String username, String password, String configLocation) { + JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); + + bean.setUsername(username); + bean.setPassword(password); + bean.setProviders(providers); + return bean.createWebClient(); + } + + /** * Creates WebClient, baseURI will be set to Client currentURI * @param client existing client */
