Removing HttpClient "http-outgoing" log lines - java

I am using HttpClient 4.5.2 to manage http requests.
By default it sends log lines to my log file in the format of:
http-outgoing-50 >> "0[\r][\n]"
http-outgoing-50 >> "[\r][\n]"
http-outgoing-50 << "HTTP/1.1 200 OK[\r][\n]"
http-outgoing-50 << "Server: Apache-Coyote/1.1[\r][\n]"
http-outgoing-50 << "Content-Type: text/xml[\r][\n]"
http-outgoing-50 << "Content-Length: 163[\r][\n]"
http-outgoing-50 << "Date: Tue, 04 Apr 2017 08:36:40 GMT[\r][\n]"
http-outgoing-50 << "[\r][\n]"
http-outgoing-50 << "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><WbxTSPSchema
http-outgoing-50 << HTTP/1.1 200 OK
http-outgoing-50 << Server: Apache-Coyote/1.1
http-outgoing-50 << Content-Type: text/xml
http-outgoing-50 << Content-Length: 163
http-outgoing-50 << Date: Tue, 04 Apr 2017 08:36:40 GMT
Connection can be kept alive indefinitely
Response Code : 200
Connection [id: 50][route: {}->http://stires-web-a.smst290.att.com:3100] can be kept alive
It multiples the log size by 10 or more!!!
How can I avoid those lines.
My log is log4j based.

Here is the solution: https://hc.apache.org/httpcomponents-client-ga/logging.html
I put the lines for log4j in my app main class constructor.

If you are using Log4j 2.x, then set the org.apache.http Logger to the Info level. This will block the log messages since those are logged at the Debug level.
<Logger name="org.apache.http" level="Info"/>

Related

HtmlUnit 400 Bad Request when additional Host header is set

I need to use a browser that can be run from Java program and allows to send a custom HTTP request directly and modify any part of the HTTP request. Therefore I chose HtmlUnit.
I tried to make a simple GET request to http://localhost and added an additional header Host:localhost. The page on my localhost home is XAMPP home. Inside the page, there is a request to other site (facebook.com). If the Host header is added, I got 400 Bad Request error. The error doesn't happen if I don't add Host header.
com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 400 Bad Request for http://connect.facebook.net/en_US/all.js#xfbml=1&appId=277385395761685
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:894)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:628)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:515)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:775)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:751)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:739)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:910)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:307)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:368)
at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:239)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:258)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:781)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:738)
at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1243)
at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1143)
at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:226)
at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:345)
at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3154)
at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2117)
at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:945)
at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:521)
at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:472)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:988)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:246)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:188)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:267)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:155)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:517)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:391)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:309)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:473)
In HtmlUnit, is all additional headers are applied on all request on the page (not only the first URL)?
How to fix it?
No, additional requests are not applied to other requests.
Below is a complete case, compare it with yours:
index.html:
First
test
index2.html
Second
Test case:
LogManager.getLogger("org.apache.http.wire").setLevel(Level.ALL);
final CollectingAlertHandler handler = new CollectingAlertHandler();
try (final WebClient webClient = new WebClient(BrowserVersion.CHROME)) {
WebRequest request = new WebRequest(new URL("http://localhost:8080"));
request.setAdditionalHeader("Host", "abc.com");
HtmlPage page = webClient.getPage(request);
page.getAnchors().get(0).click();
}
Output:
DEBUG 08:07:31,868 org.apache.http.wire: http-outgoing-0 >> "GET / HTTP/1.1[\r][\n]"
DEBUG 08:07:31,869 org.apache.http.wire: http-outgoing-0 >> "Host: abc.com[\r][\n]"
DEBUG 08:07:31,869 org.apache.http.wire: http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
DEBUG 08:07:31,869 org.apache.http.wire: http-outgoing-0 >> "Accept: */*[\r][\n]"
DEBUG 08:07:31,869 org.apache.http.wire: http-outgoing-0 >> "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36[\r][\n]"
DEBUG 08:07:31,869 org.apache.http.wire: http-outgoing-0 >> "Accept-Encoding: gzip, deflate[\r][\n]"
DEBUG 08:07:31,869 org.apache.http.wire: http-outgoing-0 >> "Accept-Language: en-US[\r][\n]"
DEBUG 08:07:31,870 org.apache.http.wire: http-outgoing-0 >> "[\r][\n]"
DEBUG 08:07:31,873 org.apache.http.wire: http-outgoing-0 << "HTTP/1.1 200 [\r][\n]"
DEBUG 08:07:31,873 org.apache.http.wire: http-outgoing-0 << "Accept-Ranges: bytes[\r][\n]"
DEBUG 08:07:31,873 org.apache.http.wire: http-outgoing-0 << "ETag: W/"37-1491113233075"[\r][\n]"
DEBUG 08:07:31,873 org.apache.http.wire: http-outgoing-0 << "Last-Modified: Sun, 02 Apr 2017 06:07:13 GMT[\r][\n]"
DEBUG 08:07:31,873 org.apache.http.wire: http-outgoing-0 << "Content-Type: text/html[\r][\n]"
DEBUG 08:07:31,873 org.apache.http.wire: http-outgoing-0 << "Content-Length: 37[\r][\n]"
DEBUG 08:07:31,875 org.apache.http.wire: http-outgoing-0 << "Date: Sun, 02 Apr 2017 06:07:31 GMT[\r][\n]"
DEBUG 08:07:31,875 org.apache.http.wire: http-outgoing-0 << "[\r][\n]"
DEBUG 08:07:31,875 org.apache.http.wire: http-outgoing-0 << "First[\r][\n]"
DEBUG 08:07:31,875 org.apache.http.wire: http-outgoing-0 << "test"
DEBUG 08:07:32,172 org.apache.http.wire: http-outgoing-0 >> "GET /index2.html HTTP/1.1[\r][\n]"
DEBUG 08:07:32,172 org.apache.http.wire: http-outgoing-0 >> "Host: localhost:8080[\r][\n]"
DEBUG 08:07:32,172 org.apache.http.wire: http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
DEBUG 08:07:32,172 org.apache.http.wire: http-outgoing-0 >> "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]"
DEBUG 08:07:32,172 org.apache.http.wire: http-outgoing-0 >> "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36[\r][\n]"
DEBUG 08:07:32,173 org.apache.http.wire: http-outgoing-0 >> "Referer: http://localhost:8080/[\r][\n]"
DEBUG 08:07:32,173 org.apache.http.wire: http-outgoing-0 >> "Accept-Encoding: gzip, deflate[\r][\n]"
DEBUG 08:07:32,173 org.apache.http.wire: http-outgoing-0 >> "Accept-Language: en-US[\r][\n]"
DEBUG 08:07:32,173 org.apache.http.wire: http-outgoing-0 >> "[\r][\n]"
DEBUG 08:07:32,174 org.apache.http.wire: http-outgoing-0 << "HTTP/1.1 200 [\r][\n]"
DEBUG 08:07:32,174 org.apache.http.wire: http-outgoing-0 << "Accept-Ranges: bytes[\r][\n]"
DEBUG 08:07:32,174 org.apache.http.wire: http-outgoing-0 << "ETag: W/"6-1491113144011"[\r][\n]"
DEBUG 08:07:32,174 org.apache.http.wire: http-outgoing-0 << "Last-Modified: Sun, 02 Apr 2017 06:05:44 GMT[\r][\n]"
DEBUG 08:07:32,174 org.apache.http.wire: http-outgoing-0 << "Content-Type: text/html[\r][\n]"
DEBUG 08:07:32,175 org.apache.http.wire: http-outgoing-0 << "Content-Length: 6[\r][\n]"
DEBUG 08:07:32,175 org.apache.http.wire: http-outgoing-0 << "Date: Sun, 02 Apr 2017 06:07:31 GMT[\r][\n]"
DEBUG 08:07:32,175 org.apache.http.wire: http-outgoing-0 << "[\r][\n]"
DEBUG 08:07:32,175 org.apache.http.wire: http-outgoing-0 << "Second"

How do I stop appache.commons.logging from spamming System.out?

I am writing a clojure app that uses Amazon S3. It is using the standard amazonaws library, under this wrapper. For some reason, it is logging to System.out a ton of DEBUG info, including but not limited to the entire binary file I am sending to S3.
As of writing this, I have tried setting up a log4j.properties file:
# Direct log messages to NULL gdmnt
log4j.appender.devnull=org.apache.log4j.varia.NullAppender
log4j.rootLogger=fatal, devnull
log4j.logger.httpclient.wire.header=ERROR
log4j.logger.httpclient.wire.content=ERROR
org.appache.http=ERROR
org.appache.http.wire=ERROR
org.appache.http.headers=ERROR
log4j.logger.com.amazonaws=WARN
log4j.logger.com.amazonaws.request=WARN
log4j.logger.com.amazonaws.http=WARN
log4j.logger.org.apache.http.wire = WARN
Yet it still sends DEBUG info. Yes, log4j is on my classpath. Here is a printout of my classpath filtered for log4j
/Users/collinbell/.m2/repository/org/apache/logging/log4j/log4j-api/2.7/log4j-api-2.7.jar
/Users/collinbell/.m2/repository/org/apache/logging/log4j/log4j-core/2.7/log4j-core-2.7.jar
Here is an example of the logs produced when I send just a simple string to an S3 bucket.
17:53:52.092 [nREPL-worker-0] DEBUG c.a.internal.config.InternalConfig - Configuration override awssdk_config_override.json not found.
17:53:52.126 [nREPL-worker-0] DEBUG c.a.services.s3.internal.S3Signer - Calculated string to sign:
"PUT
text/plain; charset=UTF-8
Tue, 10 Jan 2017 22:53:52 GMT
/eden-cybernetics-voice/key"
17:53:52.225 [nREPL-worker-0] DEBUG com.amazonaws.request - Sending Request: PUT https://eden-cybernetics-voice.s3.amazonaws.com /key Headers: (Authorization: AWS YA,FUCKTHAT=, User-Agent: aws-sdk-java/1.7.5 Mac_OS_X/10.11.5 Java_HotSpot(TM)_64-Bit_Server_VM/25.102-b14/1.8.0_102, Content-Length: 3, Date: Tue, 10 Jan 2017 22:53:52 GMT, Content-Type: text/plain; charset=UTF-8, )
17:53:52.326 [nREPL-worker-0] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Connection request: [route: {s}->https://eden-cybernetics-voice.s3.amazonaws.com:443][total kept alive: 0; route allocated: 0 of 50; total allocated: 0 of 50]
17:53:52.356 [nREPL-worker-0] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Connection leased: [id: 0][route: {s}->https://eden-cybernetics-voice.s3.amazonaws.com:443][total kept alive: 0; route allocated: 1 of 50; total allocated: 1 of 50]
17:53:52.889 [nREPL-worker-0] DEBUG o.a.h.i.c.DefaultClientConnectionOperator - Connecting to eden-cybernetics-voice.s3.amazonaws.com:443
17:53:53.145 [nREPL-worker-0] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: default
17:53:53.147 [nREPL-worker-0] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the context
17:53:53.148 [nREPL-worker-0] DEBUG o.a.h.c.p.RequestProxyAuthentication - Proxy auth state: UNCHALLENGED
17:53:53.149 [nREPL-worker-0] DEBUG c.a.http.impl.client.SdkHttpClient - Attempt 1 to execute request
17:53:53.150 [nREPL-worker-0] DEBUG o.a.h.i.conn.DefaultClientConnection - Sending request: PUT /key HTTP/1.1
17:53:53.151 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "PUT /key HTTP/1.1[\r][\n]"
17:53:53.153 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Host: eden-cybernetics-voice.s3.amazonaws.com[\r][\n]"
17:53:53.154 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Authorization: AWS YA, FUCKTHAT=[\r][\n]"
17:53:53.155 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "User-Agent: aws-sdk-java/1.7.5 Mac_OS_X/10.11.5 Java_HotSpot(TM)_64-Bit_Server_VM/25.102-b14/1.8.0_102[\r][\n]"
17:53:53.155 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Date: Tue, 10 Jan 2017 22:53:52 GMT[\r][\n]"
17:53:53.156 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Content-Type: text/plain; charset=UTF-8[\r][\n]"
17:53:53.156 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Content-Length: 3[\r][\n]"
17:53:53.157 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Connection: Keep-Alive[\r][\n]"
17:53:53.157 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "Expect: 100-continue[\r][\n]"
17:53:53.157 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "[\r][\n]"
17:53:53.158 [nREPL-worker-0] DEBUG org.apache.http.headers - >> PUT /key HTTP/1.1
17:53:53.158 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Host: eden-cybernetics-voice.s3.amazonaws.com
17:53:53.158 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Authorization: AWS YA, I AM NOT SHOWING YOU THIS=
17:53:53.159 [nREPL-worker-0] DEBUG org.apache.http.headers - >> User-Agent: aws-sdk-java/1.7.5 Mac_OS_X/10.11.5 Java_HotSpot(TM)_64-Bit_Server_VM/25.102-b14/1.8.0_102
17:53:53.159 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Date: Tue, 10 Jan 2017 22:53:52 GMT
17:53:53.159 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Content-Type: text/plain; charset=UTF-8
17:53:53.159 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Content-Length: 3
17:53:53.159 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Connection: Keep-Alive
17:53:53.160 [nREPL-worker-0] DEBUG org.apache.http.headers - >> Expect: 100-continue
17:53:53.209 [nREPL-worker-0] DEBUG org.apache.http.wire - << "HTTP/1.1 100 Continue[\r][\n]"
17:53:53.213 [nREPL-worker-0] DEBUG org.apache.http.wire - << "[\r][\n]"
17:53:53.214 [nREPL-worker-0] DEBUG o.a.h.i.conn.DefaultClientConnection - Receiving response: HTTP/1.1 100 Continue
17:53:53.214 [nREPL-worker-0] DEBUG org.apache.http.headers - << HTTP/1.1 100 Continue
17:53:53.215 [nREPL-worker-0] DEBUG org.apache.http.wire - >> "key"
17:53:53.252 [nREPL-worker-0] DEBUG org.apache.http.wire - << "HTTP/1.1 200 OK[\r][\n]"
17:53:53.253 [nREPL-worker-0] DEBUG org.apache.http.wire - << "x-amz-id-2: KxZ8+cp4/BDEm4hdEjaVI/8tUaz0RRh6hcM041BB5pMlHXGXTAjJS3hA3VojH6H4UlleHmD2HSE=[\r][\n]"
17:53:53.253 [nREPL-worker-0] DEBUG org.apache.http.wire - << "x-amz-request-id: F83687CB8CDEB189[\r][\n]"
17:53:53.254 [nREPL-worker-0] DEBUG org.apache.http.wire - << "Date: Tue, 10 Jan 2017 22:53:54 GMT[\r][\n]"
17:53:53.254 [nREPL-worker-0] DEBUG org.apache.http.wire - << "ETag: "3c6e0b8a9c15224a8228b9a98ca1531d"[\r][\n]"
17:53:53.255 [nREPL-worker-0] DEBUG org.apache.http.wire - << "Content-Length: 0[\r][\n]"
17:53:53.256 [nREPL-worker-0] DEBUG org.apache.http.wire - << "Server: AmazonS3[\r][\n]"
17:53:53.257 [nREPL-worker-0] DEBUG org.apache.http.wire - << "[\r][\n]"
17:53:53.258 [nREPL-worker-0] DEBUG o.a.h.i.conn.DefaultClientConnection - Receiving response: HTTP/1.1 200 OK
17:53:53.258 [nREPL-worker-0] DEBUG org.apache.http.headers - << HTTP/1.1 200 OK
17:53:53.258 [nREPL-worker-0] DEBUG org.apache.http.headers - << x-amz-id-2: KxZ8+cp4/BDEm4hdEjaVI/8tUaz0RRh6hcM041BB5pMlHXGXTAjJS3hA3VojH6H4UlleHmD2HSE=
17:53:53.259 [nREPL-worker-0] DEBUG org.apache.http.headers - << x-amz-request-id: F83687CB8CDEB189
17:53:53.259 [nREPL-worker-0] DEBUG org.apache.http.headers - << Date: Tue, 10 Jan 2017 22:53:54 GMT
17:53:53.259 [nREPL-worker-0] DEBUG org.apache.http.headers - << ETag: "3c6e0b8a9c15224a8228b9a98ca1531d"
17:53:53.259 [nREPL-worker-0] DEBUG org.apache.http.headers - << Content-Length: 0
17:53:53.260 [nREPL-worker-0] DEBUG org.apache.http.headers - << Server: AmazonS3
17:53:53.265 [nREPL-worker-0] DEBUG c.a.http.impl.client.SdkHttpClient - Connection can be kept alive indefinitely
17:53:53.276 [nREPL-worker-0] DEBUG com.amazonaws.request - Received successful response: 200, AWS Request ID: F83687CB8CDEB189
17:53:53.277 [nREPL-worker-0] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Connection [id: 0][route: {s}->https://eden-cybernetics-voice.s3.amazonaws.com:443] can be kept alive indefinitely
17:53:53.278 [nREPL-worker-0] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Connection released: [id: 0][route: {s}->https://eden-cybernetics-voice.s3.amazonaws.com:443][total kept alive: 1; route allocated: 1 of 50; total allocated: 1 of 50]
#object[com.amazonaws.services.s3.model.PutObjectResult 0x3822e74d "com.amazonaws.services.s3.model.PutObjectResult#3822e74d"]
17:54:51.712 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Closing connections idle longer than 60 SECONDS
17:55:51.793 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Closing connections idle longer than 60 SECONDS
17:55:51.881 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.DefaultClientConnection - Connection 0.0.0.0:61322<->52.216.80.64:443 closed
17:56:51.896 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Closing connections idle longer than 60 SECONDS
17:57:51.909 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Closing connections idle longer than 60 SECONDS
17:58:51.918 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Closing connections idle longer than 60 SECONDS
17:59:51.929 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Closing connections idle longer than 60 SECOND
My current strategy is to first find out if appache.commons.logging is even using log4j, but I don't know how to do that.
Next, I want to check that log4j is loading in the log4j.properties file.
Is this a good strategy? How do I accomplish it? Do you know another strategy?
S3 under clojure is unusable as is.
Here is my summarized project.clj:
(defproject voice "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:plugins [[lein-cljsbuild "1.1.5"]
[lein-figwheel "0.5.8"]]
:dependencies [[org.clojure/clojure "1.8.0"]
[org.apache.logging.log4j/log4j-core "2.7"]
[org.apache.logging.log4j/log4j-api "2.7"]
;browser repl
[org.clojure/clojurescript "1.9.293"]
[lein-figwheel "0.5.8"]
[figwheel-sidecar "0.5.8"]
;explicitly get the right version
[instaparse "1.4.0"]
;for the trainer
[org.deeplearning4j/deeplearning4j-core "0.7.1"]
[org.deeplearning4j/deeplearning4j-ui_2.10 "0.7.1"]
;[org.nd4j/nd4j-cuda-7.5 "0.7.1"] ;for cuda
[org.nd4j/nd4j-native "0.7.1"]
;for the sampler
[clojure-opennlp "0.3.3"]
[compojure "1.5.1"]
[hiccup "1.0.5"]
[http-kit "2.2.0"]
[garden "1.3.2"]
;;for the sampler client
[jayq "2.5.4"]
[cljs-ajax "0.5.8"]
;for the database
[korma "0.4.3"]
[org.postgresql/postgresql "9.4.1212"]
[clj-aws-s3 "0.3.10" :exclusions [joda-time]]
[org.clojure/data.json "0.2.6"]]
:profiles {:dev {:dependencies [[alembic "0.3.2"]
[org.clojure/tools.nrepl "0.2.10"]
[com.cemerick/piggieback "0.2.1"]]}}
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:jvm-opts ["-Dlog4j.debug=true"]
:cljsbuild {
:builds [{
:source-paths ["src/cljs/"]
:id "dev"
:figwheel {:websocket-host "localhost"}
:compiler {
:main "voice.sampler"
:asset-path "js/out"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/out"}}]})
Here is my fullish classpath:
/Users/collinbell/voice/test/
/Users/collinbell/voice/src/
/Users/collinbell/voice/dev-resources
/Users/collinbell/voice/resources/
/Users/collinbell/voice/target/classes/
/Users/collinbell/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.4/jackson-annotations-2.4.4.jar
/Users/collinbell/.m2/repository/org/nd4j/nd4j-jackson/0.7.1/nd4j-jackson-0.7.1.jar
/Users/collinbell/.m2/repository/net/jodah/typetools/0.4.3/typetools-0.4.3.jar
/Users/collinbell/.m2/repository/org/flatland/classlojure/0.7.0/classlojure-0.7.0.jar
/Users/collinbell/.m2/repository/com/mchange/mchange-commons-java/0.2.11/mchange-commons-java-0.2.11.jar
/Users/collinbell/.m2/repository/org/nd4j/jackson/0.7.1/jackson-0.7.1.jar
/Users/collinbell/.m2/repository/lein-as-resource/lein-as-resource/2.5.0/lein-as-resource-2.5.0.jar
/Users/collinbell/.m2/repository/org/apache/commons/commons-lang3/3.3.1/commons-lang3-3.3.1.jar
/Users/collinbell/.m2/repository/ring-cors/ring-cors/0.1.8/ring-cors-0.1.8.jar
/Users/collinbell/.m2/repository/org/clojure/tools.analyzer/0.6.9/tools.analyzer-0.6.9.jar
/Users/collinbell/.m2/repository/com/amazonaws/aws-java-sdk/1.7.5/aws-java-sdk-1.7.5.jar
/Users/collinbell/.m2/repository/ring/ring-core/1.5.0/ring-core-1.5.0.jar
/Users/collinbell/.m2/repository/org/nd4j/nd4j-common/0.7.1/nd4j-common-0.7.1.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/leptonica/1.73-1.2/leptonica-1.73-1.2-macosx-x86_64.jar
/Users/collinbell/.m2/repository/com/typesafe/play/play-functional_2.10/2.4.6/play-functional_2.10-2.4.6.jar
/Users/collinbell/.m2/repository/com/google/jsinterop/jsinterop-annotations/1.0.0/jsinterop-annotations-1.0.0.jar
/Users/collinbell/.m2/repository/org/eclipse/collections/eclipse-collections-api/7.1.0/eclipse-collections-api-7.1.0.jar
/Users/collinbell/.m2/repository/com/typesafe/config/1.3.0/config-1.3.0.jar
/Users/collinbell/.m2/repository/com/stuartsierra/dependency/0.2.0/dependency-0.2.0.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/leptonica/1.73-1.2/leptonica-1.73-1.2.jar
/Users/collinbell/.m2/repository/com/cemerick/piggieback/0.2.1/piggieback-0.2.1.jar
/Users/collinbell/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar
/Users/collinbell/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.5.3/jackson-dataformat-cbor-2.5.3.jar
/Users/collinbell/.m2/repository/org/eclipse/collections/eclipse-collections/7.1.0/eclipse-collections-7.1.0.jar
/Users/collinbell/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
/Users/collinbell/.m2/repository/compojure/compojure/1.5.1/compojure-1.5.1.jar
/Users/collinbell/.m2/repository/org/springframework/spring-beans/4.1.6.RELEASE/spring-beans-4.1.6.RELEASE.jar
/Users/collinbell/.m2/repository/com/twelvemonkeys/imageio/imageio-core/3.1.1/imageio-core-3.1.1.jar
/Users/collinbell/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.4/jackson-core-2.4.4.jar
/Users/collinbell/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/opencv/3.1.0-1.2/opencv-3.1.0-1.2-macosx-x86_64.jar
/Users/collinbell/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
/Users/collinbell/.m2/repository/org/springframework/spring-context/4.1.6.RELEASE/spring-context-4.1.6.RELEASE.jar
/Users/collinbell/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
/Users/collinbell/.m2/repository/net/cgrand/sjacket/0.1.1/sjacket-0.1.1.jar
/Users/collinbell/.m2/repository/org/eclipse/collections/eclipse-collections-forkjoin/7.1.0/eclipse-collections-forkjoin-7.1.0.jar
/Users/collinbell/.m2/repository/org/apache/httpcomponents/httpclient/4.5.1/httpclient-4.5.1.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.0.2-1.2/ffmpeg-3.0.2-1.2.jar
/Users/collinbell/.m2/repository/org/agrona/Agrona/0.5.4/Agrona-0.5.4.jar
/Users/collinbell/.m2/repository/com/typesafe/play/play-exceptions/2.4.6/play-exceptions-2.4.6.jar
/Users/collinbell/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
/Users/collinbell/.m2/repository/com/stuartsierra/component/0.3.1/component-0.3.1.jar
/Users/collinbell/.m2/repository/org/apache/directory/studio/org.apache.commons.codec/1.8/org.apache.commons.codec-1.8.jar
/Users/collinbell/.m2/repository/cider/cider-nrepl/0.15.0-SNAPSHOT/cider-nrepl-0.15.0-SNAPSHOT.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.0.2-1.2/ffmpeg-3.0.2-1.2-windows-x86_64.jar
/Users/collinbell/.m2/repository/org/apache/commons/commons-compress/1.8/commons-compress-1.8.jar
/Users/collinbell/.m2/repository/clj-aws-s3/clj-aws-s3/0.3.10/clj-aws-s3-0.3.10.jar
/Users/collinbell/.m2/repository/org/postgresql/postgresql/9.4.1212/postgresql-9.4.1212.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/leptonica/1.73-1.2/leptonica-1.73-1.2-linux-x86_64.jar
/Users/collinbell/.m2/repository/org/ow2/asm/asm-all/4.2/asm-all-4.2.jar
/Users/collinbell/.m2/repository/com/twelvemonkeys/common/common-image/3.1.1/common-image-3.1.1.jar
/Users/collinbell/.m2/repository/garden/garden/1.3.2/garden-1.3.2.jar
/Users/collinbell/.m2/repository/com/twelvemonkeys/imageio/imageio-psd/3.1.1/imageio-psd-3.1.1.jar
/Users/collinbell/.m2/repository/org/nd4j/nd4j-buffer/0.7.1/nd4j-buffer-0.7.1.jar
/Users/collinbell/.m2/repository/io/netty/netty/3.10.4.Final/netty-3.10.4.Final.jar
/Users/collinbell/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
/Users/collinbell/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar
/Users/collinbell/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar
/Users/collinbell/.m2/repository/org/deeplearning4j/deeplearning4j-core/0.7.1/deeplearning4j-core-0.7.1.jar
/Users/collinbell/.m2/repository/org/clojure/data.priority-map/0.0.7/data.priority-map-0.0.7.jar
/Users/collinbell/.m2/repository/com/twelvemonkeys/imageio/imageio-bmp/3.1.1/imageio-bmp-3.1.1.jar
/Users/collinbell/.m2/repository/cljs-ajax/cljs-ajax/0.5.8/cljs-ajax-0.5.8.jar
/Users/collinbell/.m2/repository/org/clojure/tools.reader/1.0.0-beta3/tools.reader-1.0.0-beta3.jar
/Users/collinbell/.m2/repository/org/tcrawley/dynapath/0.2.5/dynapath-0.2.5.jar
/Users/collinbell/.m2/repository/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar
/Users/collinbell/.m2/repository/org/nd4j/nd4j-api/0.7.1/nd4j-api-0.7.1.jar
/Users/collinbell/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar
/Users/collinbell/.m2/repository/org/projectlombok/lombok/1.16.10/lombok-1.16.10.jar
/Users/collinbell/.m2/repository/com/yahoo/platform/yui/yuicompressor/2.4.8/yuicompressor-2.4.8.jar
/Users/collinbell/.m2/repository/org/yaml/snakeyaml/1.12/snakeyaml-1.12.jar
/Users/collinbell/.m2/repository/crypto-random/crypto-random/1.2.0/crypto-random-1.2.0.jar
/Users/collinbell/.m2/repository/org/mapdb/elsa/3.0.0-M5/elsa-3.0.0-M5.jar
/Users/collinbell/.m2/repository/org/deeplearning4j/deeplearning4j-ui-model/0.7.1/deeplearning4j-ui-model-0.7.1.jar
/Users/collinbell/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
/Users/collinbell/.m2/repository/cheshire/cheshire/5.5.0/cheshire-5.5.0.jar
/Users/collinbell/.m2/repository/org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.jar
/Users/collinbell/.m2/repository/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1.jar
/Users/collinbell/.m2/repository/org/deeplearning4j/deeplearning4j-nlp/0.7.1/deeplearning4j-nlp-0.7.1.jar
/Users/collinbell/.m2/repository/com/cognitect/transit-java/0.8.311/transit-java-0.8.311.jar
/Users/collinbell/.m2/repository/org/mapdb/mapdb/3.0.2/mapdb-3.0.2.jar
/Users/collinbell/.m2/repository/org/apache/logging/log4j/log4j-core/2.7/log4j-core-2.7.jar
/Users/collinbell/.m2/repository/org/mozilla/rhino/1.7R5/rhino-1.7R5.jar
/Users/collinbell/.m2/repository/strictly-specking-standalone/strictly-specking-standalone/0.1.1/strictly-specking-standalone-0.1.1.jar
/Users/collinbell/.m2/repository/com/typesafe/play/play-iteratees_2.10/2.4.6/play-iteratees_2.10-2.4.6.jar
/Users/collinbell/.m2/repository/com/twelvemonkeys/common/common-io/3.1.1/common-io-3.1.1.jar
/Users/collinbell/.m2/repository/org/nd4j/nd4j-native/0.7.1/nd4j-native-0.7.1.jar
/Users/collinbell/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar
/Users/collinbell/.m2/repository/http-kit/http-kit/2.2.0/http-kit-2.2.0.jar
/Users/collinbell/.m2/repository/org/jboss/logging/jboss-logging/3.2.1.Final/jboss-logging-3.2.1.Final.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/leptonica/1.73-1.2/leptonica-1.73-1.2-windows-x86_64.jar
/Users/collinbell/.m2/repository/org/msgpack/msgpack/0.6.10/msgpack-0.6.10.jar
/Users/collinbell/.m2/repository/clojure-opennlp/clojure-opennlp/0.3.3/clojure-opennlp-0.3.3.jar
/Users/collinbell/.m2/repository/net/cgrand/parsley/0.9.3/parsley-0.9.3.jar
/Users/collinbell/.m2/repository/org/hibernate/hibernate-validator/5.0.3.Final/hibernate-validator-5.0.3.Final.jar
/Users/collinbell/.m2/repository/commons-fileupload/commons-fileupload/1.3.1/commons-fileupload-1.3.1.jar
/Users/collinbell/.m2/repository/net/incongru/watchservice/barbary-watchservice/1.0/barbary-watchservice-1.0.jar
/Users/collinbell/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar
/Users/collinbell/.m2/repository/com/mchange/c3p0/0.9.5.2/c3p0-0.9.5.2.jar
/Users/collinbell/.m2/repository/org/clojure/core.cache/0.6.5/core.cache-0.6.5.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.0.2-1.2/ffmpeg-3.0.2-1.2-linux-x86_64.jar
/Users/collinbell/.m2/repository/org/bytedeco/javacpp-presets/ffmpeg/3.0.2-1.2/ffmpeg-3.0.2-1.2-macosx-x86_64.jar
/Users/collinbell/.m2/repository/net/sf/jwordnet/jwnl/1.3.3/jwnl-1.3.3.jar
/Users/collinbell/.m2/repository/org/scala-lang/modules/scala-java8-compat_2.10/0.3.0/scala-java8-compat_2.10-0.3.0.jar
/Users/collinbell/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.1/httpasyncclient-4.1.1.jar
/Users/collinbell/.m2/repository/com/twelvemonkeys/imageio/imageio-jpeg/3.1.1/imageio-jpeg-3.1.1.jar
/Users/collinbell/.m2/repository/clout/clout/2.1.2/clout-2.1.2.jar
/Users/collinbell/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.8/clj-stacktrace-0.2.8.jar
/Users/collinbell/.m2/repository/com/typesafe/play/twirl-api_2.10/1.1.1/twirl-api_2.10-1.1.1.jar
/Users/collinbell/.m2/repository/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/src.zip
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/lib/tools.jar
/Users/collinbell/.m2/repository/org/apache/logging/log4j/log4j-api/2.7/log4j-api-2.7.jar
This isnt an answer but I cant comment with my low reputation :(. The spelling for the 'apache' namespace seems to be wrong in the config
org.appache.http=ERROR
org.appache.http.wire=ERROR
org.appache.http.headers=ERROR
I had the same issue,
creating a logback.xml and putting it on classpath with below config fixed it:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<logger name="org.apache" level="ERROR" />
<logger name="httpclient" level="ERROR" />
</configuration>
Hope it helps the others.

Box API file upload 400 bad request

I have a problem using the file upload Box API. I'm using Java with the Apache HttpClient (4.4). As far as I can tell, I am setting everything correctly, but I always get a 400 Bad request response.
I can provide more details if necessary, but here is the debug output that includes the request and response data as seen by the HttpClient:
http-outgoing-2 >> POST /api/2.0/files/content HTTP/1.1
http-outgoing-2 >> Authorization: Bearer taMJdbLcm1gJmTdnUUctqU53lpRXlVEi
http-outgoing-2 >> Content-Length: 506
http-outgoing-2 >> Content-Type: multipart/form-data; boundary=NMMQjAsnXwlKj02hT5qkfGNSn7hoOE1T1nGpaV52
http-outgoing-2 >> Host: upload.box.com
http-outgoing-2 >> Connection: Keep-Alive
http-outgoing-2 >> User-Agent: Apache-HttpClient/4.4 (Java 1.5 minimum; Java/1.7.0_79)
http-outgoing-2 >> Cookie: box_visitor_id=55b9188c8618a3.22188589
http-outgoing-2 >> Accept-Encoding: gzip,deflate
http-outgoing-2 >> "POST /api/2.0/files/content HTTP/1.1[\r][\n]"
http-outgoing-2 >> "Authorization: Bearer taMJdbLcm1gJmTdnUUctqU53lpRXlVEi[\r][\n]"
http-outgoing-2 >> "Content-Length: 506[\r][\n]"
http-outgoing-2 >> "Content-Type: multipart/form-data; boundary=NMMQjAsnXwlKj02hT5qkfGNSn7hoOE1T1nGpaV52[\r][\n]"
http-outgoing-2 >> "Host: upload.box.com[\r][\n]"
http-outgoing-2 >> "Connection: Keep-Alive[\r][\n]"
http-outgoing-2 >> "User-Agent: Apache-HttpClient/4.4 (Java 1.5 minimum; Java/1.7.0_79)[\r][\n]"
http-outgoing-2 >> "Cookie: box_visitor_id=55b9188c8618a3.22188589[\r][\n]"
http-outgoing-2 >> "Accept-Encoding: gzip,deflate[\r][\n]"
http-outgoing-2 >> "[\r][\n]"
http-outgoing-2 >> "--NMMQjAsnXwlKj02hT5qkfGNSn7hoOE1T1nGpaV52[\r][\n]"
http-outgoing-2 >> "Content-Disposition: form-data; name="attributes"[\r][\n]"
http-outgoing-2 >> "Content-Type: text/plain; charset=US-ASCII[\r][\n]"
http-outgoing-2 >> "Content-Transfer-Encoding: 8bit[\r][\n]"
http-outgoing-2 >> "[\r][\n]"
http-outgoing-2 >> "{"name":"This-is-a-Temp-File1438193805638", "parent":{"id":"4108964579"}}"
http-outgoing-2 >> "[\r][\n]"
http-outgoing-2 >> "--NMMQjAsnXwlKj02hT5qkfGNSn7hoOE1T1nGpaV52[\r][\n]"
http-outgoing-2 >> "Content-Disposition: form-data; name="file"[\r][\n]"
http-outgoing-2 >> "Content-Type: application/octet-stream[\r][\n]"
http-outgoing-2 >> "Content-Transfer-Encoding: binary[\r][\n]"
http-outgoing-2 >> "[\r][\n]"
http-outgoing-2 >> "this is a test file for upload1438193805640"
http-outgoing-2 >> "[\r][\n]"
http-outgoing-2 >> "--NMMQjAsnXwlKj02hT5qkfGNSn7hoOE1T1nGpaV52--[\r][\n]"
http-outgoing-2 << "HTTP/1.1 400 Bad Request[\r][\n]"
http-outgoing-2 << "Content-Type: text/html;charset=UTF-8[\r][\n]"
http-outgoing-2 << "Content-Length: 0[\r][\n]"
http-outgoing-2 << "Date: Wed, 29 Jul 2015 18:16:45 GMT[\r][\n]"
http-outgoing-2 << "Age: 0[\r][\n]"
http-outgoing-2 << "Connection: keep-alive[\r][\n]"
http-outgoing-2 << "Server: ATS[\r][\n]"
http-outgoing-2 << "[\r][\n]"
http-outgoing-2 << HTTP/1.1 400 Bad Request
http-outgoing-2 << Content-Type: text/html;charset=UTF-8
http-outgoing-2 << Content-Length: 0
http-outgoing-2 << Date: Wed, 29 Jul 2015 18:16:45 GMT
http-outgoing-2 << Age: 0
http-outgoing-2 << Connection: keep-alive
http-outgoing-2 << Server: ATS
Can anyone see where the problem lies? Thanks for any help, Martin
In your second mime chunk you have said the content type is binary but your data is actually text. This could be one issue with the request.

Huge amount of debug data with AWS for Java

I am using the was-sdk-java.
Recently I get huge amount of debug data, a snapshot below, and it completely bugs down my system (as each line item is longer). Even the binary data appears.
2015-03-01 17:10:44,644 DEBUG ~ CookieSpec selected: best-match
2015-03-01 17:10:44,644 DEBUG ~ Auth cache not set in the context
2015-03-01 17:10:44,644 DEBUG ~ Proxy auth state: UNCHALLENGED
2015-03-01 17:10:44,644 DEBUG ~ Sending request: GET /app1/xxx HTTP/1.1
2015-03-01 17:10:44,644 DEBUG ~ >> "GET /app1/xxx HTTP/1.1[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "Host: testcerts.xxx.eu[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "Authorization: AWS xxx:xxx[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "Date: Sun, 01 Mar 2015 17:10:44 GMT[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "User-Agent: aws-sdk-java/1.7.13 Linux/3.13.0-46-generic OpenJDK_64-Bit_Server_VM/24.75-b04/1.7.0_75[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "Content-Type: application/x-www-form-urlencoded; charset=utf-8[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "Connection: Keep-Alive[\r][\n]"
2015-03-01 17:10:44,645 DEBUG ~ >> "[\r][\n]"
2015-03-01 17:10:44,646 DEBUG ~ >> GET /app1/xxx HTTP/1.1
2015-03-01 17:10:44,646 DEBUG ~ >> Host: testcerts.xxx
2015-03-01 17:10:44,646 DEBUG ~ >> Authorization: AWS xxx:xxx
2015-03-01 17:10:44,646 DEBUG ~ >> Date: Sun, 01 Mar 2015 17:10:44 GMT
2015-03-01 17:10:44,646 DEBUG ~ >> User-Agent: aws-sdk-java/1.7.13 Linux/3.13.0-46-generic OpenJDK_64-Bit_Server_VM/24.75-b04/1.7.0_75
2015-03-01 17:10:44,646 DEBUG ~ >> Content-Type: application/x-www-form-urlencoded; charset=utf-8
2015-03-01 17:10:44,646 DEBUG ~ >> Connection: Keep-Alive
2015-03-01 17:10:44,655 DEBUG ~ << "HTTP/1.1 200 OK[\r][\n]"
2015-03-01 17:10:44,656 DEBUG ~ << "Server: nginx[\r][\n]"
2015-03-01 17:10:44,656 DEBUG ~ << "Date: Sun, 01 Mar 2015 17:10:44 GMT[\r][\n]"
2015-03-01 17:10:44,656 DEBUG ~ << "Content-Type: application/x-pkcs12[\r][\n]"
2015-03-01 17:10:44,656 DEBUG ~ << "Content-Length: 3249[\r][\n]"
2015-03-01 17:10:44,656 DEBUG ~ << "Connection: keep-alive[\r][\n]"
2015-03-01 17:10:44,656 DEBUG ~ << "Bucket: "testcerts"[\r][\n]"
2015-03-01 17:10:44,657 DEBUG ~ << "Accept-Ranges: bytes[\r][\n]"
2015-03-01 17:10:44,657 DEBUG ~ << "Last-Modified: Fri, 23 Jan 2015 10:04:12 GMT[\r][\n]"
2015-03-01 17:10:44,657 DEBUG ~ << "ETag: "xxx"[\r][\n]"
2015-03-01 17:10:44,657 DEBUG ~ << "Age: 0[\r][\n]"
2015-03-01 17:10:44,658 DEBUG ~ << "X-Cache-Hit: No[\r][\n]"
2015-03-01 17:10:44,658 DEBUG ~ << "Accept-Ranges: bytes[\r][\n]"
2015-03-01 17:10:44,658 DEBUG ~ << "[\r][\n]"
2015-03-01 17:10:44,658 DEBUG ~ Receiving response: HTTP/1.1 200 OK
2015-03-01 17:10:44,658 DEBUG ~ << HTTP/1.1 200 OK
2015-03-01 17:10:44,659 DEBUG ~ << Server: nginx
2015-03-01 17:10:44,659 DEBUG ~ << Date: Sun, 01 Mar 2015 17:10:44 GMT
2015-03-01 17:10:44,659 DEBUG ~ << Content-Type: application/x-pkcs12
2015-03-01 17:10:44,659 DEBUG ~ << Content-Length: 3249
2015-03-01 17:10:44,659 DEBUG ~ << Connection: keep-alive
2015-03-01 17:10:44,659 DEBUG ~ << Bucket: "testcerts"
2015-03-01 17:10:44,660 DEBUG ~ << Accept-Ranges: bytes
2015-03-01 17:10:44,660 DEBUG ~ << Last-Modified: Fri, 23 Jan 2015 10:04:12 GMT
2015-03-01 17:10:44,660 DEBUG ~ << ETag: "xxx"
2015-03-01 17:10:44,660 DEBUG ~ << Age: 0
2015-03-01 17:10:44,660 DEBUG ~ << X-Cache-Hit: No
2015-03-01 17:10:44,660 DEBUG ~ << Accept-Ranges: bytes
I tried to turn this off in log4j, as debugging of the whole application is now impossible:
log4j.logger.httpclient.wire=INFO
log4j.logger.com.amazonaws=WARN
log4j.logger.com.amazonaws.request=WARN
But this doesn't seem to make any difference. Any suggestion why I suddenly get all these log warning, and what I can do about it?

How get http response headers via axis2 stub

I access a SOAP service using adb-stubs created by axis2 and I should get sessionId and cookies from response, then send with another request...
I need get this parameters which you may see at the picture
http://www.imageup.ru/img36/1635686/skrinshot-2014-01-23-104646.png
MessageContext msgCtx = serviceStub._getServiceClient().getLastOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
msgCtx.getProperty(HTTPConstants.HTTP_HEADERS);
SOAPHeader soapHeader = msgCtx.getEnvelope().getHeader();
I tried these, but I could get result :(
Also I set manageSession parameters to true.
When I debuged request and response I got following log:
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Cache-Control: private, max-age=0[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Content-Length: 505[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Content-Type: text/xml; charset=utf-8[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Server: Microsoft-IIS/7.5[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "X-AspNet-Version: 2.0.50727[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "Set-Cookie: ASP.NET_SessionId=agj1njnpvoerup45tqnmsz45; path=/; HttpOnly[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "X-Powered-By: ASP.NET[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "Date: Thu, 23 Jan 2014 06:35:59 GMT[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] CookieSpec - Unrecognized cookie attribute: name=HttpOnly, value=null
2014/01/23 12:35:55:382 ALMT [DEBUG] HttpMethodBase - Cookie accepted: "$Version=0; ASP.NET_SessionId=agj1njnpvoerup45tqnmsz45; $Path=/"
Please, help me.
After much anguish, I found the answer ...
I retrieve cookies from axis2 stub response with following code:
CommonsTransportHeaders cth = (CommonsTransportHeaders) msgCtx.getProperty(MessageContext.TRANSPORT_HEADERS);
String cookie = (String) cth.get(WSConstants.SET_COOKIE);
I hope this will help others :)

Categories

Resources