[jbosstools-issues] [JBoss JIRA] Issue Comment Edited: (JBIDE-7259) Cannot create a connection to the 0.0.7 deltacloud server

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Wed Oct 6 14:04:39 EDT 2010


    [ https://jira.jboss.org/browse/JBIDE-7259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555682#action_12555682 ] 

Andre Dietisheim edited comment on JBIDE-7259 at 10/6/10 2:04 PM:
------------------------------------------------------------------

the fix is relatively simple. The url has to be adapted and the accept-header of the urlconnecton that is being used:

original code:

		URL u = new URL(url + "/api.xml"); //$NON-NLS-1$
		Object o = u.getContent();


working version:

		URL u = new URL(url  + "/api?format=xml");
		URLConnection connection = u.openConnection();
		connection.setRequestProperty("Accept", "application/xml;q=1.0"); //$NON-NLS-1$
		Object o = connection.getContent();

      was (Author: adietish):
    the fix is relatively simple. The url has to be adapted and the accept-header of the urlconnecton that is being used:

original code:

		URL u = new URL(url + "/api.xml"); //$NON-NLS-1$
		Object o = u.getContent();


working version:

		URL u = new URL(url);
		URLConnection connection = u.openConnection();
		connection.setRequestProperty("Accept", "application/xml;q=1.0"); //$NON-NLS-1$
		Object o = connection.getContent();
  
> Cannot create a connection to the 0.0.7 deltacloud server
> ---------------------------------------------------------
>
>                 Key: JBIDE-7259
>                 URL: https://jira.jboss.org/browse/JBIDE-7259
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: deltacloud
>    Affects Versions: 3.2.0.M2
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>             Fix For: 3.2.0.Beta2
>
>
> I cannot create a connection to a local deltacloud server v0.0.7. The wizard reports that the URL (http://localhost:3001) is not a valid Deltacloud instance. The server throws an error 500:
>  RuntimeError - Invalid header value: "*; q=.2":
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/header.rb:19:in `parse'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/header.rb:13:in `each'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/header.rb:13:in `parse'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/header.rb:70:in `initialize'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/media_type.rb:49:in `initialize'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/request.rb:16:in `new'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/request.rb:16:in `media_type'
>  ./lib/sinatra/respond_to.rb:103:in `registered'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:461:in `instance_eval'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:461:in `before_filter!'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:461:in `each'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:461:in `before_filter!'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:600:in `dispatch!'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'
>  /usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/context.rb:22:in `call'
>  /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
>  /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'
>  /usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/stats.rb:24:in `call'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/stats.rb:33:in `log'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/stats.rb:24:in `call'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/connection.rb:76:in `pre_process'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/connection.rb:74:in `catch'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/connection.rb:74:in `pre_process'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1060:in `call'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1060:in `spawn_threadpool'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `initialize'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `new'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `spawn_threadpool'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1049:in `defer'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/connection.rb:54:in `process'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
>  /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/runner.rb:177:in `send'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
>  /usr/lib/ruby/gems/1.8/gems/thin-1.2.7/bin/thin:6
>  /usr/bin/thin:19:in `load'
>  /usr/bin/thin:19
> 127.0.0.1 - - [05/Oct/2010 16:32:01] "GET /api.xml HTTP/1.1" 500 30 0.1516
> If I connect to the same instance with a browser by slightly chaning the requested URL, I can get the API:
> http://localhost:3001/api?format=xml
> ->
> <api driver='mock' version='0.1'>
>   <link href='http://localhost:3001/api/images' rel='images'>
>   </link>
>   <link href='http://localhost:3001/api/storage_volumes' rel='storage_volumes'>
>   </link>
>   <link href='http://localhost:3001/api/hardware_profiles' rel='hardware_profiles'>
>   </link>
>   <link href='http://localhost:3001/api/instance_states' rel='instance_states'>
>   </link>
>   <link href='http://localhost:3001/api/realms' rel='realms'>
>   </link>
>   <link href='http://localhost:3001/api/instances' rel='instances'>
>     <feature name='hardware_profiles'></feature>
>     <feature name='user_name'></feature>
>   </link>
>   <link href='http://localhost:3001/api/storage_snapshots' rel='storage_snapshots'>
>   </link>
> </api>
> According to the deltacloud guys, a recent API change disabled content negotiation, so requesting .xml does not work any more. The content type has to be indicated in a url parameter (format=). Furthermore the deltacloud server seems no to be able to process a accept-header the tools use: "*; q=.2":

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list