Ich baue einen einfachen Proxy-Server mit Jetty HttpClient. Ich benutze Jetty Version 9.3.10.v20160621 auf Java 1.8.0_45.Tut Jettys httpClient.setResponseBufferSize() -Methode irgendetwas?
Ich habe eine Situation, in der ich eine GET auf eine Ressource, die eine Antwort zurückgibt, die etwa 3,5 M groß ist (ich bestimmt dies mit SoapUI). Da ich weiß, dass Jettys maximale Antwortgröße standardmäßig 2M ist, mache ich Folgendes, wenn ich die HttpClient-Instanz erstelle.
HttpClient client = new HttpClient();
client.setResponseBufferSize(4194304);
client.start();
Später führe ich eine Anfrage synchron GET wie folgt:
Antwortpuffer size = 4194304
Dennoch I:
System.out.println("response buffer size = " + client.getResponseBufferSize());
retVal = client.GET(uri);
Die Konsolenprotokoll der Folgendes bekomme ich eine java.util.concurrent.ExecutionException, wenn ich die GET() ausführen (st ack Spur unten). Ich kann nur folgern, dass entweder (a) ein Fehler in der setResponseBufferSize() -Methode vorliegt, oder (b) die Methode setResponseBufferSize() nicht das tut, was die Dokumentation sagt (die Antwortpuffergröße). Weiß jemand, was damit los ist?
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Buffering capacity exceeded
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:652)
at org.eclipse.jetty.client.HttpClient.GET(HttpClient.java:343)
at oracle.paas.tools.sifter.proxy.ProxySession.get(ProxySession.java:106)
at oracle.paas.tools.sifter.proxy.Endpoint.doGet(Endpoint.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:524)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Buffering capacity exceeded
at org.eclipse.jetty.client.util.BufferingResponseListener.onContent(BufferingResponseListener.java:114)
at org.eclipse.jetty.client.api.Response$Listener$Adapter.onContent(Response.java:248)
at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:124)
at org.eclipse.jetty.client.ResponseNotifier.access$100(ResponseNotifier.java:35)
at org.eclipse.jetty.client.ResponseNotifier$ContentCallback.process(ResponseNotifier.java:272)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)
at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:224)
at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:117)
at org.eclipse.jetty.client.HttpReceiver.responseContent(HttpReceiver.java:326)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.content(HttpReceiverOverHTTP.java:256)
at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1584)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1332)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:158)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:119)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:69)
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:90)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:115)
... 9 more
@Joakim Erdfelt danke dafür. – gilbertpilz