Need to reset an http header in Jcloud.
Hi, I am using Jcloud 1.9.1 to connect to a custom S3 server. But when Itry to upload a file to this server, I am getting following error - -" HTTP/1.1 500 Internal Server Error". I found issue because sending the Http header - "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" ,server throwing this error. If I modify this to - "Accept: text/plain", it is working perfectly. So I would like to know, If there is a way to remove this HttpHeader in Jcloud? Please provide some sample, if it has.. Regards Pratheesh
Re: Need to reset an http header in Jcloud.
The default Java HTTP client adds this header. You can work around this via a different HTTP client, e.g., Apache or OkHttp: ContextBuilder.modules(ImmutableSet.of(new OkHttpCommandExecutorServiceModule())) On Thu, Mar 01, 2018 at 08:25:26PM +0530, Ranjith R wrote: > That sounds like the problem in > > https://mail-archives.apache.org/mod_mbox/jclouds-user/201601.mbox/%3c7fb39cd6f35fba4a84437e6707bd6f59150d5...@g9w0757.americas.hpqcorp.net%3E > > Check the responses, there was suggestion to use a different http client > and that worked. > > On Thu, Mar 1, 2018 at 8:00 PM, Pratheesh> wrote: > > > Hi, > > > > > > > > I am using Jcloud 1.9.1 to connect to a custom S3 server. But when Itry to > > upload a file to this server, I am getting following error - –“ HTTP/1.1 > > 500 Internal Server Error”. > > > > I found issue because sending the Http header – “Accept: text/html, > > image/gif, image/jpeg, *; q=.2, */*; q=.2” ,server throwing this > > error. If I modify this to – “Accept: text/plain”, it is working perfectly. > > > > So I would like to know, If there is a way to remove this HttpHeader in > > Jcloud? Please provide some sample, if it has.. > > > > > > > > Regards > > > > Pratheesh > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- Andrew Gaul http://gaul.org/
Re: Need to reset an http header in Jcloud.
That sounds like the problem in https://mail-archives.apache.org/mod_mbox/jclouds-user/201601.mbox/%3c7fb39cd6f35fba4a84437e6707bd6f59150d5...@g9w0757.americas.hpqcorp.net%3E Check the responses, there was suggestion to use a different http client and that worked. On Thu, Mar 1, 2018 at 8:00 PM, Pratheeshwrote: > Hi, > > > > I am using Jcloud 1.9.1 to connect to a custom S3 server. But when Itry to > upload a file to this server, I am getting following error - –“ HTTP/1.1 > 500 Internal Server Error”. > > I found issue because sending the Http header – “Accept: text/html, > image/gif, image/jpeg, *; q=.2, */*; q=.2” ,server throwing this > error. If I modify this to – “Accept: text/plain”, it is working perfectly. > > So I would like to know, If there is a way to remove this HttpHeader in > Jcloud? Please provide some sample, if it has.. > > > > Regards > > Pratheesh > > > > > > > > > > > > > > >
Re: Upgrading an application to jclouds 2.1.0
Hi, I think the commit message is slightly misleading, it should read `remote ServerPredicates as the functionality is duplicated` in fact [1] serves the same purpose. At [2] you can find an example of how jclouds uses it now Sorry for any inconvenience, Andrea [1]: https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java#L197-L204 [2]: https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java#L138 On Thu, Mar 1, 2018 at 6:58 PM, Fritz Elfertwrote: > Hi, > > I want to upgrade a small administrative application for an internal > OpenStack environment to jclouds-2.1.0, however I'm stuck due to missing > ServerPredicates. > > In the commit message of aa11765bee8e5e7f2d062ba8123c0dced822f071, > Andrea Turli states: > > "- remove ServerPredicates as it is now duplicated" > > but I can't find another ServerPredicates class?! > > So: how is the following code supposed to be implemented using > jclouds-2.1.0 resp. what is the replacement for ServerPredicates? > > = snip == > private void doSomethingWhileServerRunning(final Server s) { > final String sid = s.getId(); > while (!ServerPredicates.awaitStatus(sapi, > Server.Status.SHUTOFF, 30, 5).apply(sid)) { > /* do something with the server console ... */ > } > ... > = snip == > > Thanks in Advance. > > -Fritz
Re: Upgrading an application to jclouds 2.1.0
Thanks a lot, Andrea for the quick response! Exactly what i needed :-) Cheers -Fritz On 01.03.2018 19:12, Andrea Turli wrote: > Hi, > > I think the commit message is slightly misleading, it should read > `remote ServerPredicates as the functionality is duplicated` > > in fact [1] serves the same purpose. At [2] you can find an example of > how jclouds uses it now > > Sorry for any inconvenience, > Andrea > > [1]: > https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java#L197-L204 > [2]: > https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceAdapter.java#L138 > > On Thu, Mar 1, 2018 at 6:58 PM, Fritz Elfertwrote: >> Hi, >> >> I want to upgrade a small administrative application for an internal >> OpenStack environment to jclouds-2.1.0, however I'm stuck due to missing >> ServerPredicates. >> >> In the commit message of aa11765bee8e5e7f2d062ba8123c0dced822f071, >> Andrea Turli states: >> >> "- remove ServerPredicates as it is now duplicated" >> >> but I can't find another ServerPredicates class?! >> >> So: how is the following code supposed to be implemented using >> jclouds-2.1.0 resp. what is the replacement for ServerPredicates? >> >> = snip == >> private void doSomethingWhileServerRunning(final Server s) { >> final String sid = s.getId(); >> while (!ServerPredicates.awaitStatus(sapi, >> Server.Status.SHUTOFF, 30, 5).apply(sid)) { >> /* do something with the server console ... */ >> } >> ... >> = snip == >> >> Thanks in Advance. >> >> -Fritz
Upgrading an application to jclouds 2.1.0
Hi, I want to upgrade a small administrative application for an internal OpenStack environment to jclouds-2.1.0, however I'm stuck due to missing ServerPredicates. In the commit message of aa11765bee8e5e7f2d062ba8123c0dced822f071, Andrea Turli states: "- remove ServerPredicates as it is now duplicated" but I can't find another ServerPredicates class?! So: how is the following code supposed to be implemented using jclouds-2.1.0 resp. what is the replacement for ServerPredicates? = snip == private void doSomethingWhileServerRunning(final Server s) { final String sid = s.getId(); while (!ServerPredicates.awaitStatus(sapi, Server.Status.SHUTOFF, 30, 5).apply(sid)) { /* do something with the server console ... */ } ... = snip == Thanks in Advance. -Fritz