[
https://issues.jboss.org/browse/JBIDE-13888?page=com.atlassian.jira.plugi...
]
Andre Dietisheim edited comment on JBIDE-13888 at 3/31/13 4:28 PM:
-------------------------------------------------------------------
In the openshift-java-client it currently looks like as if the useragent is not sent:
{code:title=RestServiceProperties}
public String getUseragent(String id) {
String version = getVersion();
String useragentPattern = getUseragentPattern();
if (!StringUtils.isEmpty(id)
&& !StringUtils.isEmpty(version)
&& !StringUtils.isEmpty(useragentPattern)) {
String userAgent = MessageFormat.format(getUseragentPattern(), getVersion(), id);
}
return null;
}
{code}
this method always returns *null*, thus the useragent should always be null.
It turned out that bill decoste unfortunately introduced this issue here:
https://github.com/adietish/openshift-java-client/commit/b64d63fc50fc3911...
The http client will obviously not send the user agent since it would not set it if
it's null:
{code:title=UrlConnectionHttpClient}
private void setUserAgent(HttpURLConnection connection) {
String userAgent = this.userAgent;
if (!StringUtils.isEmpty(authKey)) {
userAgent = USERAGENT_FOR_KEYAUTH;
}
if (userAgent != null){
connection.setRequestProperty(PROPERTY_USER_AGENT, userAgent);
}
}
{code}
was (Author: adietish):
In the openshift-java-client it currently looks like as if the useragent is not sent:
{code:title=RestServiceProperties}
public String getUseragent(String id) {
String version = getVersion();
String useragentPattern = getUseragentPattern();
if (!StringUtils.isEmpty(id)
&& !StringUtils.isEmpty(version)
&& !StringUtils.isEmpty(useragentPattern)) {
String userAgent = MessageFormat.format(getUseragentPattern(), getVersion(), id);
}
return null;
}
{code}
this method always returns *null*, thus the useragent should always be null.
The http client will obviously not send the user agent since it would not set it if
it's null:
{code:title=UrlConnectionHttpClient}
private void setUserAgent(HttpURLConnection connection) {
String userAgent = this.userAgent;
if (!StringUtils.isEmpty(authKey)) {
userAgent = USERAGENT_FOR_KEYAUTH;
}
if (userAgent != null){
connection.setRequestProperty(PROPERTY_USER_AGENT, userAgent);
}
}
{code}
openshift-java-client: make sure useragent is sent
--------------------------------------------------
Key: JBIDE-13888
URL:
https://issues.jboss.org/browse/JBIDE-13888
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: openshift
Affects Versions: 4.1.0.Alpha2
Reporter: Andre Dietisheim
Assignee: Andre Dietisheim
Fix For: 4.1.0.Alpha2
--
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