[jbosstools-issues] [JBoss JIRA] (JBIDE-13114) openshift-java-client: improve how userAgent is passed to UrlConnectionClient

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Thu Jan 10 05:24:08 EST 2013


     [ https://issues.jboss.org/browse/JBIDE-13114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andre Dietisheim updated JBIDE-13114:
-------------------------------------

    Priority: Minor  (was: Major)

    
> openshift-java-client: improve how userAgent is passed to UrlConnectionClient
> -----------------------------------------------------------------------------
>
>                 Key: JBIDE-13114
>                 URL: https://issues.jboss.org/browse/JBIDE-13114
>             Project: Tools (JBoss Tools)
>          Issue Type: Enhancement
>          Components: openshift
>    Affects Versions: 4.0.0.CR1
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>            Priority: Minor
>             Fix For: 4.1.x
>
>
> clarify how the user-agent is set to the UrlConnectionHttpClient.
> You can actually set it to the constructor but also by a setter:
> {code:title=com.openshift.internal.client.httpclient.UrlConnectionHttpClient}
> public UrlConnectionHttpClient(String username, String password, String userAgent, boolean sslChecks, IMediaType requestMediaType, String acceptedMediaType, String version, String authKey, String authIV) {
> {code}
> {code:title=com.openshift.internal.client.httpclient.UrlConnectionHttpClient}
> public void setUserAgent(String userAgent) {
> 	this.userAgent = userAgent;
> }
> {code}
> Both variants are actually used in the library code:
> {code:title=com.openshift.internal.client.RestService}
> public RestService(String baseUrl, String clientId, IHttpClient client) {
> 	this.baseUrl = UrlUtils.ensureStartsWithHttps(baseUrl);
> 	this.client = client;
> 	client.setUserAgent(new RestServiceProperties().getUseragent(clientId));
> {code}
> {code:title=com.openshift.client.OpenShiftConnectionFactory}
> public IOpenShiftConnection getConnection(final String clientId, final String login, final String password,
> 		final String authKey, final String authIV, final String serverUrl,
> 		final boolean proxySet, final String proxyHost, final String proxyPort) throws OpenShiftException {
> 	Assert.notNull(clientId);
> 	Assert.notNull(login);
> 	Assert.notNull(password);
> 	Assert.notNull(serverUrl);
> 	
> 	if (proxySet) {
> 		System.setProperty("proxyHost", proxyHost);
> 		System.setProperty("proxyPort", proxyPort);
> 	}
> 	try {
> 		final IHttpClient httpClient = new UrlConnectionHttpClientBuilder().setCredentials(login, password, authKey, authIV)
> 				.client();
> 		
> 		final IRestService service = new RestService(serverUrl, clientId, httpClient);
> 		return getConnection(service, login, password);
> 	} catch (FileNotFoundException e) {
> 		throw new OpenShiftException(e, "Failed to establish connection for user ''{0}}''", login);
> 	} catch (IOException e) {
> 		throw new OpenShiftException(e, "Failed to establish connection for user ''{0}}''", login);
> 	}
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list