groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suderman Keith <suder...@anc.org>
Subject Re: HTTPBuilder and Content-type
Date Tue, 07 Jun 2016 18:41:55 GMT

> On Jun 7, 2016, at 11:40 AM, Imholz, John J. <imholzj@musc.edu> wrote:
> 
> I'm still not sure how to get the Content-type sent as 'text/xml' (the webservice I'm
hitting doesn't like 'application/xml’.)

You should just be able to specify the content type as ‘text/xml’ without having to use
one of the ContentType enum values.  E.g.

	http.request(POST, ‘text/xml’)

Cheers,
Keith

>  
> Can I get some insight on how to log http components when executing a groovy script from
the command line?
>  
> jji
>  
> From: David Clark [mailto:plotinussmith@gmail.com <mailto:plotinussmith@gmail.com>]

> Sent: Tuesday, June 07, 2016 11:03 AM
> To: users@groovy.apache.org <mailto:users@groovy.apache.org>
> Subject: Re: HTTPBuilder and Content-type
>  
> 
> The content-type is set to the content type of the encoder. See here:
>  
> https://github.com/jgritman/httpbuilder/blob/master/src/main/java/groovyx/net/http/EncoderRegistry.java#L333
<https://github.com/jgritman/httpbuilder/blob/master/src/main/java/groovyx/net/http/EncoderRegistry.java#L333>
>  
> For the xml encoder that is "application/xml". See here (the first entry in the list
is taken to be the default content-type):
>  
> https://github.com/jgritman/httpbuilder/blob/master/src/main/java/groovyx/net/http/ContentType.java#L67
<https://github.com/jgritman/httpbuilder/blob/master/src/main/java/groovyx/net/http/ContentType.java#L67>
>  
> Your best bet is to enable debugging in the apache http client to see what is actually
being sent. You can do this by setting the system properties correctly. See here for the details
on how to do this: 
>  
> https://hc.apache.org/httpcomponents-client-ga/logging.html <https://hc.apache.org/httpcomponents-client-ga/logging.html>
>  
>  
> On Tue, Jun 7, 2016 at 8:15 AM, Imholz, John J. <imholzj@musc.edu <mailto:imholzj@musc.edu>>
wrote:
> I'd like to set the Content-type of a POST to "text/xml"  looks to me like http.request(
POST, XML)  sets it to "application/xml".
> 
> Also, to debug, how can I see the POST before I send it?
> 
> jji
> 

------------------------------
Research Associate
Department of Computer Science
Vassar College
Poughkeepsie, NY


Mime
View raw message