[
https://issues.jboss.org/browse/JBIDE-11603?page=com.atlassian.jira.plugi...
]
Andre Dietisheim commented on JBIDE-11603:
------------------------------------------
PROD (
openshift.redhat.com) and STAGE (
stg.openshift.redhat.com) currently dont support
version negotiation. You get 406 NOT accepted if you add the version specification to the
Accept header:
{quote}
curl -k --user "<ACCOUNT>:<PASSWORD>" -H "Accept:
application/json;version=1.0"
https://openshift.redhat.com/broker/rest/cartridges -v
< HTTP/1.1 406 Not Acceptable
< Date: Wed, 25 Apr 2012 09:01:10 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.4
< X-Runtime: 0.920704
< Cache-Control: no-cache
< X-UA-Compatible: IE=Edge,chrome=1
< Status: 406
< Strict-Transport-Security: max-age=15768000, includeSubDomains
< Content-Type: text/html; charset=utf-8
< Vary: Accept-Encoding,User-Agent
< ProxyTime: D=946495
< Connection: close
< Transfer-Encoding: chunked
<
* Closing connection #0
{quote}
I therefore cannot enable version negotiation to the client library, we'd end up with
a non-functional client-lib for now.
I added version negotiation but commented the code that would add it to the Accept-header.
I also @Ignore'd the tests for it.
According to the openshift team version negotiation will make it to productin next monday.
That's unfortunately too late for us since we freeze on friday, we might have to
deploy a new client version after our freeze.
I furthermore found a version negotiation approach that is obviously compatible to the
current PROD/STG. It would just require us to indicate the required version in a slightly
different manner (that is IMHO RFC compliant - whereas their current approach is not
IMHO):
{quote}
Accept: application/json;q=1,version=1.0
{quote}
(note the media type quality indicator in between the media type and the version. The
version becomes accept-extension (a secondary media type qualifier) as state in the RFC
(
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
I dont know if this alternative would be parsed correctly by the new broker. The response
is currently still pending.
Support REST API version negotiation
------------------------------------
Key: JBIDE-11603
URL:
https://issues.jboss.org/browse/JBIDE-11603
Project: Tools (JBoss Tools)
Issue Type: Feature Request
Components: openshift
Affects Versions: 3.3.0.Beta3
Reporter: Andre Dietisheim
Assignee: Andre Dietisheim
Priority: Blocker
Fix For: 3.3.0.Beta3
The latest REST api supports version negotiation:
The client may indicate what service (protocol) version he'd like to use and the
service would then use this version to talk to the client:
Mail by Lili Nader on the 4.21.2012
{quote}
The rest api will return the latest version unless a version is explicitly requested by
specifying it in HTTP Accept header in this format "Accept: application/xml;
version=1.0"
For example:
curl -i -k
https://localhost/broker/rest/api -H "Accept: application/xml;
version=1.0"
The api also returns a list of supported versions (right now the only supported version
is 1.0):
<?xml version="1.0" encoding="UTF-8"?>
<response>
<version>2.0</version>
<supported-api-versions>
<supported-api-version>1.0</supported-api-version>
</supported-api-versions>
</response>
If the version requested in not supported then it will return a HTTP Status 406 and an
error message as shown below.
For example:
curl -i -k
https://localhost/broker/rest/api -H "Accept: application/xml;
version=2.2"
HTTP/1.1 406 Not Acceptable
<?xml version="1.0" encoding="UTF-8"?>
<response>
<version>1.0</version>
<messages>
<message>
<field nil="true"></field>
<text>Requested API version 2.2 is not supported. Supported versions are
1.0</text>
<exit-code/>
<severity>error</severity>
</message>
</messages>
<status>not_acceptable</status>
<supported-api-versions>
<supported-api-version>1.0</supported-api-version>
</supported-api-versions>
</response>
{quote}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira