httpbuilder

encoder function for multipart/form-data in groovy

心已入冬 提交于 2021-02-07 20:30:33
问题 I need to form a 'multipart/form-data' REST request with jpeg image and JSON file as the content.I am stuck with encoding the 'multipart/form-data' as a zip file. Can someone tell me, how I can achieve this with groovy RESTClient? I could not find any documentation regarding this. 回答1: As it can be seen in the docs RESTClient extends HTTPBuilder . HTTPBuilder has a getEncoder method that can be used to add dedicated encoder (with type and method). See the following piece of code: import org

How to set up logging.properties for HTTPBuilder in Java

故事扮演 提交于 2020-02-08 09:42:22
问题 I'm trying to get the logs of my connection with HTTP Builder. I read a lot and heard to set up a configuration file. I'm executing my jar from the terminal with this command java -jar -Djava.util.logging.config.file=logging.properties Console-0.1.jar And my logging.properties looks like this handlers=java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level=ALL .level=FINEST httpclient.wire.header.level=FINEST org.apache.commons.httpclient.level=FINEST I don't get why it's not

How to set up logging.properties for HTTPBuilder in Java

我的梦境 提交于 2020-02-08 09:40:31
问题 I'm trying to get the logs of my connection with HTTP Builder. I read a lot and heard to set up a configuration file. I'm executing my jar from the terminal with this command java -jar -Djava.util.logging.config.file=logging.properties Console-0.1.jar And my logging.properties looks like this handlers=java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level=ALL .level=FINEST httpclient.wire.header.level=FINEST org.apache.commons.httpclient.level=FINEST I don't get why it's not

Installing HTTPBuilder for Groovy

让人想犯罪 __ 提交于 2020-01-11 01:29:06
问题 Apologies for the newbie question, but how do you install HTTPBuilder for Groovy? I've added the http-builder-0.7.jar, http-builder-0.7-source.jar, and http-builder-0.7-javadoc.jar to GROOVY_HOME/lib. Is there anything else I need to do? The HTTPBuilder website isn't clear. Code run from GroovyConsole: import groovy.grape.Grape Grape.grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' ) def http = new groovyx.net.http.HTTPBuilder('http://www.codehaus

Installing HTTPBuilder for Groovy

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-11 01:29:02
问题 Apologies for the newbie question, but how do you install HTTPBuilder for Groovy? I've added the http-builder-0.7.jar, http-builder-0.7-source.jar, and http-builder-0.7-javadoc.jar to GROOVY_HOME/lib. Is there anything else I need to do? The HTTPBuilder website isn't clear. Code run from GroovyConsole: import groovy.grape.Grape Grape.grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' ) def http = new groovyx.net.http.HTTPBuilder('http://www.codehaus

HTTPBuilder HTTP Post url encoded parameters and accept xml response?

空扰寡人 提交于 2020-01-03 05:26:17
问题 Hi there i am wondering how i can post a urlencoded string and read in an xml response using HTTPBuilder? I would like to use this inside a Grails application. The REST plugin is no option. I tried the examples given on http://groovy.codehaus.org/modules/http-builder/doc/post.html but this gives me no xml response to read in. 回答1: You can try something like this: def httpBuilder = new HTTPBuilder("http://webite.url") httpBuilder.request(Method.POST, URLENC){req-> headers.accept = "application

Is there an easier way to tell HTTPBuilder to ignore an invalid cert?

。_饼干妹妹 提交于 2019-12-30 00:59:14
问题 Per the docs, you can go through a rather clunky process of export a cert from a browser manually and getting it recognized locally. Is there anything similar to curl's --insecure switch to make this practical? 回答1: Good news everyone! :-) Just found out that new version (0.7.1) of HttpBuilder introduces method: ignoreSSLIssues() This solves all problems regarding invalid SSL certificates (of course you have to be aware that it also decreases security). More information about this method:

Can't use ignoreSSLIssues in HttpBuilder version 0.7.1

喜欢而已 提交于 2019-12-24 02:58:15
问题 Java 8 | Groovy Language | IDE: IntelliJ IDEA | Gradle 3 I have problem with SSL issue Code: import groovyx.net.http.RESTClient def client = new RESTClient() client.ignoreSSLIssues() def result = client.get(uri: "https://sacvo76l6b.execute-api.ap-northeast- 1.amazonaws.com/") It throws below exception javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:431) at org.apache.http.conn.ssl.AbstractVerifier

POST XML data with Groovy HTTPBuilder

一世执手 提交于 2019-12-23 17:25:18
问题 I am trying to POST XML data to a URL using the HTTPBuilder class. At the moment I have: def http = new HTTPBuilder('http://m4m:aghae7eihuph@m4m.fetchapp.com/api/orders/create') http.request(POST, XML) { body = { element1 { subelement 'value' subsubelement { key 'value2' } } } response.success = { /* handle success*/ } response.failure = { resp, xml -> /* handle failure */ } } and upon inspection I see that the request does get made with the XML as the body. I have 3 issues with this though.

Groovy install HTTPBuilder now that Codehaus shutdown?

[亡魂溺海] 提交于 2019-12-23 17:03:18
问题 I'm a groovy n00b and trying to use http-builder, but ALL of the examples on the web just reference the same @Grab statement which doesn't work. I assume it is because codehaus.org isn't hosting groovy stuff anymore. I've tried downloading the source from github and building it with Maven, but the build fails. How and where am I supposed to get httpbuilder for groovy? Things I've already tried: Deleting the grapes directory from this post didn't work. I got this code snippet from this other