public Confluence(String endpoint) throws MalformedURLException { if (endpoint.endsWith("/")) { endpoint = endpoint.substring(0, endpoint.length() - 1); } if (!endpoint.endsWith("/rpc/xmlrpc")) { endpoint += "/rpc/xmlrpc"; } XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL(new URL(endpoint)); clientConfig.setEnabledForExtensions(true); client = new XmlRpcClient(); client.setTransportFactory( new XmlRpcAhcTransportFactory(client) ); client.setConfig(clientConfig); }
public Jira(String endpoint) throws MalformedURLException { if (endpoint.endsWith("/")) { endpoint = endpoint.substring(0, endpoint.length() - 1); } if (!endpoint.endsWith("/rpc/xmlrpc")) { endpoint += "/rpc/xmlrpc"; } XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL(new URL(endpoint)); client = new XmlRpcClient(); client.setTransportFactory( new XmlRpcAhcTransportFactory(client) ); client.setConfig(clientConfig); BasicIssueFiller basicIssueFiller = new BasicIssueFiller(this); basicIssueFiller.setEnabled(true); issueFillers.put("issue", basicIssueFiller); issueFillers.put("project", new ProjectFiller(this)); autofillProviders.put("issue", BasicIssueFiller.class.getName()); autofillProviders.put("project", ProjectFiller.class.getName()); autofillProviders.put("voters", "org.codehaus.swizzle.jira.VotersFiller"); autofillProviders.put("subtasks", "org.codehaus.swizzle.jira.SubTasksFiller"); autofillProviders.put("attachments", "org.codehaus.swizzle.jira.AttachmentsFiller"); autofillProviders.put("comments", "org.codehaus.swizzle.jira.CommentsFiller"); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = null; logger.debug("Invoke : " + clazz.getName() + "." + method.getName() + "(" + Arrays.toString(args) + ")"); logger.debug("XML-RPC , Using uri = http:" + this.serviceLocation); //Le client XMLRPC de crispy est en version < 3 XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); try { config.setServerURL(new URL("http:" + this.serviceLocation)); XmlRpcClient client = new XmlRpcClient(); client .setTransportFactory(new XmlRpcCommonsTransportFactory( client)); client.setConfig(config); result = client.execute(clazz.getName() + "." + method.getName(), args); } catch (java.net.MalformedURLException e) { System.out.println("Caught MalformedURLException\n"); e.printStackTrace(); } catch (XmlRpcException e) { System.out.println("Caught XmlRpcException\n"); e.printStackTrace(); } return result; }
config.setReplyTimeout(60*1000); XmlRpcClient client = new XmlRpcClient(); client.setTransportFactory(new XmlRpcCommonsTransportFactory(client)); client.setConfig(config);
@SuppressWarnings("unchecked") public Map<String, Object> getVersion() throws Exception { Map<String, Object> versionMap = null; setSSLIdentity(); try { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); //TODO //config.setServerURL(new URL(GUI.getInstance().getSelectedController())); config.setServerURL(new URL(CONTROLLER_URL)); //TODO XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); // set this transport factory for host-specific SSLContexts to work XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client); client.setTransportFactory(f); // get verbose list of the AMs versionMap = (Map<String, Object>)client.execute(GET_VERSION, new Object[]{}); } catch (MalformedURLException e) { throw new Exception("Please check the SM URL " + CONTROLLER_URL); } catch (XmlRpcException e) { throw new Exception("Unable to contact SM " + CONTROLLER_URL + " due to " + e); } catch (Exception e) { throw new Exception("Unable to contact SM " + CONTROLLER_URL); } return versionMap; }
private XmlRpcClient getConfiguredClient() { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(cUrl); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); // set this transport factory for host-specific SSLContexts to work XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client); client.setTransportFactory(f); return client; }
private XmlRpcClient client() { if ( this.client == null ) { XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL( url ); client = new XmlRpcClient(); client.setTransportFactory( new XmlRpcAhcTransportFactory( client ) ); client.setConfig( clientConfig ); } return client; }
protected Confluence(String endpoint, ConfluenceProxy proxyInfo ) throws URISyntaxException, MalformedURLException { this(new XmlRpcClient()); if (endpoint.endsWith("/")) { endpoint = endpoint.substring(0, endpoint.length() - 1); } endpoint = ConfluenceService.Protocol.XMLRPC.addTo(endpoint); final java.net.URI serviceURI = new java.net.URI(endpoint); XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL(serviceURI.toURL() ); clientConfig.setEnabledForExtensions(true); // add this to support attachment upload client.setConfig( clientConfig ); if( isProxyEnabled(proxyInfo, serviceURI) ) { final XmlRpcCommonsTransportFactory transportFactory = new XmlRpcCommonsTransportFactory( client ); final HttpClient httpClient = new HttpClient(); final HostConfiguration hostConfiguration = httpClient.getHostConfiguration(); hostConfiguration.setProxy( proxyInfo.host, proxyInfo.port ); hostConfiguration.setHost(serviceURI.getHost(), serviceURI.getPort(), serviceURI.toURL().getProtocol()); if( !isNullOrEmpty(proxyInfo.userName) && !isNullOrEmpty(proxyInfo.password) ) { Credentials cred = new UsernamePasswordCredentials(proxyInfo.userName,proxyInfo.password); httpClient.getState().setProxyCredentials(AuthScope.ANY, cred); } transportFactory.setHttpClient( httpClient ); client.setTransportFactory( transportFactory ); } } // Would have been nicer to have a constructor with clientConfig and optionally a transport
xmlRpcClient.setConfig(config); if(tracConnectionConfig.getXmlRpcTransportFactory() != null){ xmlRpcClient.setTransportFactory(tracConnectionConfig.getXmlRpcTransportFactory());
/** * @param uri * the {@link URI} to connect to * @param interfaceClass * the class literal for the XML-RPC interface */ public Client(URI uri, Class<T> interfaceClass) { this.uri = uri; XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); try { config.setServerURL(uri.toURL()); } catch (MalformedURLException e) { throw new RosRuntimeException(e); } config.setConnectionTimeout(CONNECTION_TIMEOUT); config.setReplyTimeout(REPLY_TIMEOUT); XmlRpcClient client = new XmlRpcClient(); client.setTransportFactory(new XmlRpcCommonsTransportFactory(client)); client.setConfig(config); XmlRpcClientFactory<T> factory = new XmlRpcClientFactory<T>(client); xmlRpcEndpoint = interfaceClass.cast(factory.newInstance(getClass().getClassLoader(), interfaceClass, "", XMLRPC_TIMEOUT)); }
protected Confluence(String endpoint, ConfluenceProxy proxyInfo ) throws URISyntaxException, MalformedURLException { this(new XmlRpcClient()); if (endpoint.endsWith("/")) { endpoint = endpoint.substring(0, endpoint.length() - 1); } endpoint = ConfluenceService.Protocol.XMLRPC.addTo(endpoint); final java.net.URI serviceURI = new java.net.URI(endpoint); XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL(serviceURI.toURL() ); clientConfig.setEnabledForExtensions(true); // add this to support attachment upload client.setConfig( clientConfig ); if( isProxyEnabled(proxyInfo, serviceURI) ) { final XmlRpcCommonsTransportFactory transportFactory = new XmlRpcCommonsTransportFactory( client ); final HttpClient httpClient = new HttpClient(); final HostConfiguration hostConfiguration = httpClient.getHostConfiguration(); hostConfiguration.setProxy( proxyInfo.host, proxyInfo.port ); hostConfiguration.setHost(serviceURI.getHost(), serviceURI.getPort(), serviceURI.toURL().getProtocol()); if( !isNullOrEmpty(proxyInfo.userName) && !isNullOrEmpty(proxyInfo.password) ) { Credentials cred = new UsernamePasswordCredentials(proxyInfo.userName,proxyInfo.password); httpClient.getState().setProxyCredentials(AuthScope.ANY, cred); } transportFactory.setHttpClient( httpClient ); client.setTransportFactory( transportFactory ); } } // Would have been nicer to have a constructor with clientConfig and optionally a transport
private XmlRpcClient setupClient(FedAgent a, URL url) throws MalformedURLException { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(url); XmlRpcClient client = new XmlRpcClient(); config.setEnabledForExtensions(true); client.setConfig(config); client.setTypeFactory(new MyTypeFactory(client)); // set this transport factory for host-specific SSLContexts to work XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client); client.setTransportFactory(f); return client; }
public ContinuumXmlRpcClient( URL serviceUrl, String login, String password ) { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl() { public boolean isEnabledForExtensions() { return true; } }; if ( login != null ) { config.setBasicUserName( login ); config.setBasicPassword( password ); } config.setServerURL( serviceUrl ); XmlRpcClient client = new XmlRpcClient(); client.setTransportFactory( new XmlRpcCommonsTransportFactory( client ) ); client.setConfig( config ); ClientFactory factory = new ClientFactory( client ); continuum = (ContinuumService) factory.newInstance( ContinuumService.class ); }
protected TalkToRegistry() { super(); // We use our own HttpClient with an HttpConnectionManager // configured with timeouts, so we don't block the liveness // thread forever. // Connect timeout, 10 seconds; Read timeout, 5 seconds; Close timeout, 3 seconds. connMgr = new SimpleHttpConnectionManager(true); connMgr.getParams().setConnectionTimeout(10*1000); connMgr.getParams().setSoTimeout(5*1000); connMgr.getParams().setLinger(3); httpClient = new HttpClient(connMgr); // We use XmlRpcCommonsTransportFactory, initialized // using the HttpClient from above, so that SSLContexts // work. xmlrpcClient = new XmlRpcClient(); xmlrpcClientConfig = new XmlRpcClientConfigImpl(); transportFactory = new XmlRpcCommonsTransportFactory(xmlrpcClient); transportFactory.setHttpClient(httpClient); xmlrpcClient.setTransportFactory(transportFactory); // Finally - since the SimpleHttpConnectionManager only // provides one backend HttpConnection, ensure that the // XmlRpcClient only has one backend worker available to // consume it. xmlrpcClient.setMaxThreads(1); }