[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] ConnectHandler issue
|
oops sorry, accidently click "send".
i did some experiments with different configurations:
1. sslconnector, WebAppContext:
a. let WebAppContext handle request (POST multipart, just like bellow) directly: works fine
b. put a handlerwrapper before WebAppContext, simple like this:
public class UploadHandler extends HandlerWrapper {
private static final String tmpDir = System.getProperty("java.io.tmpdir");
private static DiskFileItemFactory ff = new DiskFileItemFactory(20*1024*1024, new File(tmpDir));
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("handle");
String type = baseRequest.getContentType();
String method = baseRequest.getMethod();
System.out.println("type:" + type + ", method:" + method);
if (type != null && type.toLowerCase().contains("multipart/form-data") && method.equals("POST")) {
ServletFileUpload servlet = new ServletFileUpload(ff);
servlet.setProgressListener(new ProgressListener() {
@Override
public void update(long pBytesRead, long pContentLength, int pItems) {
System.out.println("parsed:" + pBytesRead);
}
});
try {
List<FileItem> items = servlet.parseRequest(request);
System.out.println("parse done");
} catch (Exception ex) {
ex.printStackTrace();
}
response.setStatus(200);
response.getWriter().write("DONE");
response.flushBuffer();
baseRequest.setHandled(true);
}
super.handle(target, baseRequest, request, response);
}
}
servlet.parseRequest(request) got stuck at arround 700k before throwing above exception.
2. sslconnector , connecthandler, webappcontext.
sslconnector works as proxyport, connecthandler tunnel CONNECT to sslconnector (so its kinda 2x hanshake/ssl.), request arrives at webappcontext, same problem with servlet.parseRequest(HttpServletRequest), the limit of around 700K seems strange to me.
anyway, is there a better way to handle this situation (tunnel to itself without openning new socket , like wrapping sslendpoint with another sslendpoint, which does the handshake the 2nd time...) ?
thanx alot
On Wed, Jan 4, 2012 at 1:06 PM, kim young ill
<khiemu@xxxxxxxxxxxxxx> wrote:
thanx for your help
i tried the 7.6.0.RC2 but it doesnt help,
trace:
org.eclipse.jetty.io.EofException
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.blockReadable(SelectChannelEndPoint.java:373)
at org.eclipse.jetty.io.nio.SslConnection$SslEndPoint.blockReadable(SslConnection.java:688)
at org.eclipse.jetty.http.HttpParser.blockForContent(HttpParser.java:1208)
at org.eclipse.jetty.server.HttpInput.read(HttpInput.java:57)
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:976)
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886)
at java.io.InputStream.read(InputStream.java:82)
at at de.app.servlet.FileUploadServlet.doPost(FileUploadServlet.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1360)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1027)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:961)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:870)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:238)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:75)
at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:194)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:615)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
at java.lang.Thread.run(Thread.java:680)
i did some expriments with some other configuration:
ssl-connector, webapphandler:
On Tue, Jan 3, 2012 at 11:00 AM, Simone Bordet
<sbordet@xxxxxxxxxxx> wrote:
Hi,
On Fri, Dec 30, 2011 at 16:46, kim young ill <
khiemu@xxxxxxxxxxxxxx> wrote:
> Hi,
> first of all: happy new year !!!
>
>
> i use embedded jetty 7.5.3 as a servlet container
Please update to 7.5.4, as 7.5.3 had a bug where connections where
closed after a while, which seems exactly what you're experiencing.
Simon
--
http://cometd.org
http://intalio.com
http://bordet.blogspot.com
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz