xlightweb-develop Mailing List for xLightweb
Status: Inactive
Brought to you by:
grro
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(1) |
Oct
(21) |
Nov
(6) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(4) |
Mar
(7) |
Apr
(4) |
May
(9) |
Jun
(13) |
Jul
(1) |
Aug
(10) |
Sep
(8) |
Oct
(9) |
Nov
(8) |
Dec
(8) |
2010 |
Jan
|
Feb
(6) |
Mar
(2) |
Apr
|
May
(8) |
Jun
(3) |
Jul
|
Aug
(9) |
Sep
(2) |
Oct
(8) |
Nov
(4) |
Dec
|
2011 |
Jan
(3) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Rathaur A. <ami...@ge...> - 2016-08-02 05:35:42
|
Hi , Hope you are doing good, We are using xlightweb as http client to consume web services, which are exposed by our own application(a different application which is hosted on tomcat). We face one issue with this http client, sometimes when we call httpClient.call(postRequest) it is waiting for response indefinitely, Although I checked access logs of tomcat and also took the TCP dump of all request coming to 80 port on server side but request is not coming to the web server means request is not going out of the client machine. I also checked the TCP dump on client machine for outgoing requests and found that no request is going to server. Can you please help me out on , what is the exact issue or I am doing something wrong here. This is an intermittent issue means sometimes it occurs, other times this is working fine. XLight version : xlightweb-2.13.2-jar-with-dependencies.jar Java version : JRE7 Tomcat version : tomcat7 Plateform : server on Ubuntu , client on windows and ubuntu both (xlightweb is inside client and on both platform I saw this issue). Code snippet below : import java.security.NoSuchAlgorithmException; import javax.net.ssl.SSLContext; import org.xlightweb.BodyDataSource; import org.xlightweb.GetRequest; import org.xlightweb.IHttpRequest; import org.xlightweb.IHttpResponse; import org.xlightweb.client.HttpClient; public class ConnectionUtil { private static HttpClient objHttpClient = null; public static void init() throws NoSuchAlgorithmException{ objHttpClient = new HttpClient(SSLContext.getDefault()); /* set connection properties */ objHttpClient.setMaxRetries(3); objHttpClient.setResponseTimeoutMillis(30 * 1000); objHttpClient.setBodyDataReceiveTimeoutMillis(30 * 1000); objHttpClient.setConnectTimeoutMillis(30 * 1000); } public static String sendReqMsg() throws Exception { IHttpResponse objResponse = null; IHttpRequest request = new GetRequest("https://localhost:8441/YPServer/7303cab2-e314-446f-b0d5-fabdbc1c728d/aboutMe"); objResponse = objHttpClient.call(request); BodyDataSource objSource = objResponse.getBody(); String msgReceived = objSource.readString(); System.out.println(msgReceived); return msgReceived; } } Thread dump : "http-bio-8080-exec-1" #48 daemon prio=5 os_prio=0 tid=0x0000000026e51800 nid=0x19e4 in Object.wait() [0x000000003287b000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000006cc595510> (a java.lang.Object) at org.xlightweb.FutureResponseHandler.getResponse(FutureResponseHandler.java:135) - locked <0x00000006cc595510> (a java.lang.Object) at org.xlightweb.FutureResponseHandler.getResponse(FutureResponseHandler.java:117) at org.xlightweb.client.HttpClient.call(HttpClient.java:1082) Regards , Amit ________________________________ This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited. E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender. Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus. |
From: 蒙. <lix...@qq...> - 2015-03-27 01:20:54
|
hi, i'm using xlightweb.httpclient to repeatedly send GetRequest per second, there are 2 ways: 1. create a httpclient instance every time to send the request and close it after receive the response. 2. create a httpclient instance and use it send all the requests, and close it when quit the application. why way is better? |
From: Siegler, E. <Eri...@tr...> - 2013-10-10 23:03:04
|
xSocket Folks, We are testing your xSocket libraries in our performance lab, and this being our first use of this library, we are having trouble getting the connection pooling to work properly with the async xSocket client. We get only about two transactions through a connection before the xSocket client drops the socket. This leads to massive port depletion in Linux when running under load, and we are unsure which setting we need to tweak to get the xSocket client to keep the connections open longer before closing them. The server side of the connection has no limit to the number of transactions allowed on a given socket. When running with 8000 connections at about 300 messages per second, we can only run for a few minutes before local ports are depleted and the xSocket client cannot open any new channels (Linux then has 20K+ ports in TIME_WAIT state). Since our version of Redhat does not allow us to reduce the time_wait delay on local ports, we cannot sustain any sort of load through this library. We are using the default MaxActive value for our connection pool (which from your source files appears to be maxint), but in spite of this, we continue to churn through connections (and local IP ports) faster than Linux releases them. Generally speaking, our connection churn counts (the number of sockets used over the life of the test run) hover around 50% of total transaction counts, meaning the client is only sending, on average, two transactions on a socket before closing it. For reference, we connected our own injection tool that uses long-running connections to the same back-end system to confirm that the server is not dropping the connections. In that test we witnessed no connection churn at all, allowing us to sustain high transaction rates indefinitely without local port depletion. We believe xSocket can do the same, if only we knew which switches to throw. Can you please help us understand how we can tune xSocket to reuse these pooled connections properly? BTW: Idle time on the sockets does not exceed 1000ms in our controlled environment, and our connection timeout is set to 90 seconds (90000ms). What are we missing? Thank you for any help you can provide, Eric Siegler Enterprise Architecture Global Technology Solutions Travelport GDS +1.303.397.5306 Eri...@Tr... If you are not the intended recipient of this e-mail message, please notify the sender and delete all copies immediately. The sender believes this message and any attachments were sent free of any virus, worm, Trojan horse, and other forms of malicious code. This message and its attachments could have been infected during transmission. The recipient opens any attachments at the recipient's own risk, and in so doing, the recipient accepts full responsibility for such actions and agrees to take protective and remedial action relating to any malicious code. Travelport is not liable for any loss or damage arising from this message or its attachments. |
From: Magnus R. <mru...@ho...> - 2013-06-20 07:48:26
|
------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev |
From: wu j. <jos...@gm...> - 2013-06-20 06:29:55
|
who could help me ? On Wed, Jun 19, 2013 at 2:57 PM, wu jose <jos...@gm...> wrote: > Hi All, > > > How to connect websocket server with WSS? The example in > http://xlightweb.sourceforge.net/core/tutorial/V2/TutorialCore.htm connect > websockt server with ws.If I want to connect with wss, how to > > > do? > > XHttpClient httpClient = new XHttpClient(); > > // ... > IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:8877/services") > > > Thanks > Jose > |
From: Krishnaraju, S. <Sat...@Po...> - 2013-06-19 15:42:34
|
Hello, Firstly I would like to thank you for the amazing work on the server. I have been using xlightweb for the websockets and seems to be working alright, but the problem is when I try to use 'wss:' Here are a few code snippets trying to explain the problem I start the server as shown below HttpServer server = new HttpServer(8082, new ServerHandler(),SSLContext.getDefault(),true); server.start(); Server handler does nothing special, it just prints everything to the logger. This setup works for non ssl. Javascript client just uses the wss://<host>/<context-path>. On debugging the source I found that the server rejects the SSL connection while registering selection key OP_READ to the IoSocketDispatcher. I am not so familiar with the SSL socket connections. I see the below stacktrace WARNING: error occured while accepting connection: java.lang.RuntimeException: javax.net.ssl.SSLException: SSLEngine is closing/closed at org.xsocket.connection.IoSSLProcessor.start(IoSSLProcessor.java:161) at org.xsocket.connection.IoSSLHandler.startSSL(IoSSLHandler.java:155) at org.xsocket.connection.IoSSLHandler.init(IoSSLHandler.java:95) at org.xsocket.connection.NonBlockingConnection.init(NonBlockingConnection.java:1049) at org.xsocket.connection.NonBlockingConnection.init(NonBlockingConnection.java:1043) at org.xsocket.connection.Server$LifeCycleHandler.init(Server.java:1191) at org.xsocket.connection.Server$LifeCycleHandler.onConnectionAccepted(Server.java:1171) at org.xsocket.connection.IoAcceptor.accept(IoAcceptor.java:223) at org.xsocket.connection.IoAcceptor.listen(IoAcceptor.java:206) at org.xsocket.connection.Server.run(Server.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: javax.net.ssl.SSLException: SSLEngine is closing/closed at sun.security.ssl.SSLEngineImpl.kickstartHandshake(SSLEngineImpl.java:692) at sun.security.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:734) at org.xsocket.connection.IoSSLProcessor.start(IoSSLProcessor.java:159) ... 10 more Any ideas on what I can do or where I am going wrong? Any help would be appreciated. Thanks, Satish |
From: wu j. <jos...@gm...> - 2013-06-19 06:57:42
|
Hi All, How to connect websocket server with WSS? The example in http://xlightweb.sourceforge.net/core/tutorial/V2/TutorialCore.htm connect websockt server with ws.If I want to connect with wss, how to do? XHttpClient httpClient = new XHttpClient(); // ... IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:8877/services") Thanks Jose |
From: Joachim D. <jd...@gm...> - 2012-07-04 21:06:07
|
Hello, I have multiple invocations of my handler code for the same incoming request. I use xLightWeb 2.13.2 and try to build kind of a proxy - open a org.xlightweb.server.HttpServer and on request forward using a org.xlightweb.client.HttpClient. I test this via junit using a apache-HttpClient (with disabled retry). The Client's IHttpResponseHandler implementation is all annotated with "@Execution(Execution.NONTHREADED)" The Server's IHttpRequestHandler implementation is all annotated with "@Execution(Execution.MULTITHREADED)" While testing a bogus request, I ran into some bug in my code where I waited forever on a Future and so the server's onRequest(..) didnt return. I then noticed multiple other invocations of my implementation of IHttpRequestHandler.onRequest(..). I'm not totally clear about the exact error situation, because this now happens even without my deadlock. Up in the stacktraces I saw this rooting from worker-threads calling SerializedTaskQueue.performPendingTasks(..) - but the SerializedTaskQueue instance and the MultimodeExecutor it belonged to where different instances per thread. SerializedTaskQueue.performPendingTasks(..) synchronizes workers internally so it seems to me that there should NOT be multiple instances around and if so, they should NOT share all my same task and process it in parallel. A breakpoint to MultimodeExecutor's constructor got invoked multiple times: -> first before my http request: "xDispatcherSrv8080#1" daemon prio=6 tid=0x0b1be400 nid=0x2dc8 at breakpoint[0x0b62f000..0x0b62fc14] java.lang.Thread.State: RUNNABLE at org.xlightweb.HttpUtils$MultimodeExecutor.<init>(HttpUtils.java:2092) at org.xlightweb.HttpUtils.newMultimodeExecutor(HttpUtils.java:2086) at org.xlightweb.AbstractHttpConnection.<init>(AbstractHttpConnection.java:159) at org.xlightweb.server.HttpServerConnection.<init>(HttpServerConnection.java:152) at org.xlightweb.server.HttpProtocolAdapter.onConnect(HttpProtocolAdapter.java:534) at org.xsocket.connection.HandlerAdapter.performOnConnect(HandlerAdapter.java:137) at org.xsocket.connection.HandlerAdapter.onConnect(HandlerAdapter.java:90) at org.xsocket.connection.NonBlockingConnection.onConnect(NonBlockingConnection.java:1338) at org.xsocket.connection.NonBlockingConnection.access$1600(NonBlockingConnection.java:72) at org.xsocket.connection.NonBlockingConnection$IoHandlerCallback.onConnect(NonBlockingConnection.java:2488) at org.xsocket.connection.IoSocketHandler.onRegisteredEvent(IoSocketHandler.java:251) at org.xsocket.connection.IoSocketDispatcher.registerHandlerNow(IoSocketDispatcher.java:685) at org.xsocket.connection.IoSocketDispatcher.access$000(IoSocketDispatcher.java:50) at org.xsocket.connection.IoSocketDispatcher$RegisterTask.run(IoSocketDispatcher.java:396) at org.xsocket.connection.IoSocketDispatcher.performRegisterHandlerTasks(IoSocketDispatcher.java:669) at org.xsocket.connection.IoSocketDispatcher.run(IoSocketDispatcher.java:226) at java.lang.Thread.run(Thread.java:619) -> next stopped there after firing my http get request from junit: "xWorkerPool-1-thread-1" prio=6 tid=0x0aa74800 nid=0x3a1c at breakpoint[0x0b6df000..0x0b6dfd14] java.lang.Thread.State: RUNNABLE at org.xlightweb.HttpUtils$MultimodeExecutor.<init>(HttpUtils.java:2092) at org.xlightweb.HttpUtils.newMultimodeExecutor(HttpUtils.java:2086) at org.xlightweb.HttpUtils.newMultimodeExecutor(HttpUtils.java:2081) at org.xlightweb.AbstractHttpConnection$AbstractExchange.<init>(AbstractHttpConnection.java:1617) at org.xlightweb.client.HttpClientConnection$ClientExchange.<init>(HttpClientConnection.java:1461) at .... my custom code and my custom code is like: httpClient.send( myIHttpExchangeInstanceFromServer.getRequest() , HttpClientResponseHandler() { /* annotated as NONTHREADED */ }); -> after that it stops there twice in two diffenrent threads: "xDispatcherSrv8080#0" daemon prio=6 tid=0x0b1d4400 nid=0x1d5c at breakpoint[0x0b5df000..0x0b5dfa94] java.lang.Thread.State: RUNNABLE at org.xlightweb.HttpUtils$MultimodeExecutor.<init>(HttpUtils.java:2092) at org.xlightweb.HttpUtils.newMultimodeExecutor(HttpUtils.java:2086) at org.xlightweb.AbstractHttpConnection.<init>(AbstractHttpConnection.java:159) at org.xlightweb.server.HttpServerConnection.<init>(HttpServerConnection.java:152) at org.xlightweb.server.HttpProtocolAdapter.onConnect(HttpProtocolAdapter.java:534) at org.xsocket.connection.HandlerAdapter.performOnConnect(HandlerAdapter.java:137) at org.xsocket.connection.HandlerAdapter.onConnect(HandlerAdapter.java:90) at org.xsocket.connection.NonBlockingConnection.onConnect(NonBlockingConnection.java:1338) at org.xsocket.connection.NonBlockingConnection.access$1600(NonBlockingConnection.java:72) at org.xsocket.connection.NonBlockingConnection$IoHandlerCallback.onConnect(NonBlockingConnection.java:2488) at org.xsocket.connection.IoSocketHandler.onRegisteredEvent(IoSocketHandler.java:251) at org.xsocket.connection.IoSocketDispatcher.registerHandlerNow(IoSocketDispatcher.java:685) at org.xsocket.connection.IoSocketDispatcher.access$000(IoSocketDispatcher.java:50) at org.xsocket.connection.IoSocketDispatcher$RegisterTask.run(IoSocketDispatcher.java:396) at org.xsocket.connection.IoSocketDispatcher.performRegisterHandlerTasks(IoSocketDispatcher.java:669) at org.xsocket.connection.IoSocketDispatcher.run(IoSocketDispatcher.java:226) at java.lang.Thread.run(Thread.java:619) and "xDispatcherClientGlb#1" daemon prio=6 tid=0x0aac4c00 nid=0x19a0 at breakpoint[0x0b81f000..0x0b81fb94] java.lang.Thread.State: RUNNABLE at org.xlightweb.HttpUtils$MultimodeExecutor.<init>(HttpUtils.java:2092) at org.xlightweb.HttpUtils.newMultimodeExecutor(HttpUtils.java:2086) at org.xlightweb.AbstractHttpConnection.<init>(AbstractHttpConnection.java:159) at org.xlightweb.client.HttpClientConnection.<init>(HttpClientConnection.java:291) at org.xlightweb.client.HttpClientConnection.<init>(HttpClientConnection.java:247) at org.xlightweb.client.HttpClientConnection$ClientExchange.newHttpClientConnection(HttpClientConnection.java:1648) at org.xlightweb.client.HttpClientConnection$ClientExchange.access$2100(HttpClientConnection.java:1445) at org.xlightweb.client.HttpClientConnection$ClientExchange$ConnectHandler.onConnect(HttpClientConnection.java:1575) at org.xsocket.connection.HandlerAdapter.performOnConnect(HandlerAdapter.java:137) at org.xsocket.connection.HandlerAdapter.onConnect(HandlerAdapter.java:90) at org.xsocket.connection.NonBlockingConnectionPool$NonBlockingConnectionProxy.onConnect(NonBlockingConnectionPool.java:2206) at org.xsocket.connection.NonBlockingConnectionPool$NonBlockingConnectionProxy.onConnected(NonBlockingConnectionPool.java:2193) at org.xsocket.connection.NonBlockingConnectionPool$Connector.onConnected(NonBlockingConnectionPool.java:820) at org.xsocket.connection.NonBlockingConnectionPool$NativeConnectionHolder.onConnect(NonBlockingConnectionPool.java:1809) at org.xsocket.connection.HandlerAdapter.performOnConnect(HandlerAdapter.java:137) at org.xsocket.connection.HandlerAdapter.onConnect(HandlerAdapter.java:90) at org.xsocket.connection.NonBlockingConnection.onConnect(NonBlockingConnection.java:1338) at org.xsocket.connection.NonBlockingConnection.access$1600(NonBlockingConnection.java:72) at org.xsocket.connection.NonBlockingConnection$IoHandlerCallback.onConnect(NonBlockingConnection.java:2488) at org.xsocket.connection.IoActivateableSSLHandler$IOEventHandler.onConnect(IoActivateableSSLHandler.java:407) at org.xsocket.connection.IoSocketHandler.onRegisteredEvent(IoSocketHandler.java:251) at org.xsocket.connection.IoSocketDispatcher.registerHandlerNow(IoSocketDispatcher.java:685) at org.xsocket.connection.IoSocketDispatcher.access$000(IoSocketDispatcher.java:50) at org.xsocket.connection.IoSocketDispatcher$RegisterTask.run(IoSocketDispatcher.java:396) at org.xsocket.connection.IoSocketDispatcher.performRegisterHandlerTasks(IoSocketDispatcher.java:669) at org.xsocket.connection.IoSocketDispatcher.run(IoSocketDispatcher.java:226) at java.lang.Thread.run(Thread.java:619) -> and then I start loosing the picture - but it keeps calling that constructor when I resume the threads. ... so I'm i on the right track here or could this be normal and is due to my usage of it? Thanks a lot! Joachim |
From: HU,nan xa.V. <na...@xa...> - 2012-01-11 09:17:41
|
I am reading the source code , and I am blocked on step 5: step 1 : httpClient.openWebSocketConnection step 2 : performHandshake step 3 : HttpUtils.getConnectionFromAttribute(response.getResponseHeader()) step 4 : header.getAttribute("org.xlightweb.client.connection") step 5 : when does HttpClientConnection object created and setted with key "org.xlightweb.client.connection" |
From: xujun <xu...@um...> - 2011-04-27 15:25:34
|
Dear all, I'm George, could you help me analysis an issue: I got an error when running the follow raw code in my project: HttpClient httpclient = new HttpClient(); httpclient.setConnectTimeoutMillis(24 * 60 * 60 * 1000); httpclient.setResponseTimeoutMillis(2L * 60L * 1000L); httpclient.setBodyDataReceiveTimeoutMillis(2L * 60L * 1000L); The Exception stack: java.lang.IllegalStateException: Timer already cancelled. at java.util.Timer.sched(Timer.java:354) at java.util.Timer.schedule(Timer.java:222) at org.xlightweb.AbstractHttpConnection.schedule(AbstractHttpConnection.java:1217) at org.xlightweb.client.HttpClientConnection.schedule(HttpClientConnection.java:364) at org.xlightweb.client.SessionManager.<init>(SessionManager.java:60) at org.xlightweb.client.HttpClient.<init>(HttpClient.java:207) at org.xlightweb.client.HttpClient.<init>(HttpClient.java:165) Highly appreciate for your great support in advance. 2011-04-27 George |
From: Jeff S. <je...@so...> - 2011-01-11 21:27:33
|
Update. Our service was creating a new HttpClient instance for each request outbound. In that scenario it appears HttpCache instances continually get added to the JVM. Eventually, all the instances pile up such that their cleanup timers are all basically firing continuously :) I'm not sure what's right or wrong here, but I wanted to let folks know in case they have a similar setup and experience what seems like a leak and high CPU usage. I did implement a hardcoded, no-op, DummCacheHandler that met the interface of the existing CacheHandler. With that in place the HttpCache issue went away, even with HttpClient invocations on each server request. It'd be nice to either "fix" the current CacheHandler/HttpCache issue or implement some scheme whereby a Dummy/no-op is used when a disable cache setting is specified (or maybe maxCacheSize=0 could do this too). Thanks, -Jeff On 01/10/2011 12:26 PM, Jeff Simpson wrote: > Hi, > > We're using HttpClient from within a server to make requests for data > from other services and have seen an increase in memory and CPU over > time. Using VisualVM, I've narrowed the issue to the class > org.xlightweb.HttpCache, which seems to be the culprit. > > I've read in the XLightweb docs that client content caching is off by > default. Is this class used for some other sort of caching I can > disable? > > Thanks, > -Jeff |
From: Michael C. <qp...@ya...> - 2011-01-10 21:44:57
|
Hi, I am having problems with secure websocket. I am using xlightweb 2.13.2 and secure websocket does not work. There's an error during handshake on openWebSocketConnection(). I am not able verify if xlightweb secure websocket would work through a proxy. My jetty websocket servlet is an echo servlet. It would be really nice to have secure websocket working through a proxy... Thx! HttpClient httpClient = new HttpClient(SSLContext.getDefault()); //httpClient.setProxyHost("127.0.0.1"); //httpClient.setProxyPort(8888); System.out.println("proxy host: 127.0.0.1 port 8888:->"+uri); IWebSocketConnection webSocketConnection2 = httpClient.openWebSocketConnection(:wss://192.168.151.105:8443/MyWebSocket/MyWebSocketServlet"); TextMessage msg = new TextMessage("Hello"); webSocketConnection2.writeMessage(msg); |
From: Jeff S. <je...@so...> - 2011-01-10 19:53:14
|
Hi, We're using HttpClient from within a server to make requests for data from other services and have seen an increase in memory and CPU over time. Using VisualVM, I've narrowed the issue to the class org.xlightweb.HttpCache, which seems to be the culprit. I've read in the XLightweb docs that client content caching is off by default. Is this class used for some other sort of caching I can disable? Thanks, -Jeff |
From: Magnus R. <mru...@ho...> - 2010-11-24 19:06:19
|
I guess either my question has an obvious answer I should have found :-) ...or else, little more worryingly, this mailinglist might not be all that active ? cheersMagnus From: mru...@ho... To: xli...@li... Date: Fri, 19 Nov 2010 11:45:51 +0000 Subject: [Xlightweb-develop] Handling malformed http post requests.... Hi, Just started looking into xlightweb and it looks very exciting.However I was wondering how to pick up on the server side that a received request (for example a post request) is not a legal/parseable request. when I send some jibberish to the server I would like to be able to intercept/listen to/handle the exception that I guess is occuring inside the xlightweb framework classes when parsing the request.Would this be possible at all ? // sample client code (could be any client in my case it will be a soap client of which I have little control. )MyHttpServer server = new MyHttpServer(7077);IBlockingConnection con = new BlockingConnection("localhost", 7077); con.write("Not a proper request..");con.flush(); String data = con.readStringByDelimiter("\n\r"); // blocks..... would have been nice to be able to receive a http error code here System.out.println(data); server.stop(); // A very simple server:public class MyHttpServer { private HttpServer srv; public MyHttpServer(int port) { try { System.setProperty("org.xlightweb.showDetailedError", "true"); // creates the server by passing over the port number & the server handler srv = new HttpServer(port, new ClientHttpRequestHandler()); // run it srv.start(); } catch (Exception e) { throw new RuntimeException("Error starting httpserver"); } } public void stop() { srv.close(); }} public class ClientHttpRequestHandler implements IHttpRequestHandler{ public void onRequest(IHttpExchange exchange) throws IOException { System.out.println("Request received"); .... do stuff and send response }} kind regardsMagnus ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Xlightweb-develop mailing list Xli...@li... https://lists.sourceforge.net/lists/listinfo/xlightweb-develop |
From: Jan A. <ja...@pu...> - 2010-11-24 17:18:42
|
Hi, I would like to be able to set the source/local IP address used by HttpClient. Is it possible to override the NonBlockingConnectionPool to implement this? Greatful for any advice on how this can be done, /Jan Andersson |
From: Magnus R. <mru...@ho...> - 2010-11-19 11:45:59
|
Hi, Just started looking into xlightweb and it looks very exciting.However I was wondering how to pick up on the server side that a received request (for example a post request) is not a legal/parseable request. when I send some jibberish to the server I would like to be able to intercept/listen to/handle the exception that I guess is occuring inside the xlightweb framework classes when parsing the request.Would this be possible at all ? // sample client code (could be any client in my case it will be a soap client of which I have little control. )MyHttpServer server = new MyHttpServer(7077);IBlockingConnection con = new BlockingConnection("localhost", 7077); con.write("Not a proper request..");con.flush(); String data = con.readStringByDelimiter("\n\r"); // blocks..... would have been nice to be able to receive a http error code here System.out.println(data); server.stop(); // A very simple server:public class MyHttpServer { private HttpServer srv; public MyHttpServer(int port) { try { System.setProperty("org.xlightweb.showDetailedError", "true"); // creates the server by passing over the port number & the server handler srv = new HttpServer(port, new ClientHttpRequestHandler()); // run it srv.start(); } catch (Exception e) { throw new RuntimeException("Error starting httpserver"); } } public void stop() { srv.close(); }} public class ClientHttpRequestHandler implements IHttpRequestHandler{ public void onRequest(IHttpExchange exchange) throws IOException { System.out.println("Request received"); .... do stuff and send response }} kind regardsMagnus |
From: Oladapo A. <ola...@ho...> - 2010-11-02 18:10:59
|
Hello All, I need some help in relation to my xlightweb project i'm working on. I have a client request set to a jetty server using Continuation solution via HttpClient object like so: IHttpRequest request = new PostRequest(url.toString(), JsonUtils.JSON_MIME_TYPE, httpMessageManager.encodeMessageToString((AbstractMessage) requestMessage)); httpClient.send(request, consumer); The consumer an IHttpResponseHandler handles the response by reading content of the response and processing it's content like so: int nBytes = response.getContentLength(); ByteBuffer byteBuffer = ByteBuffer.allocate(nBytes); int nBytesRead = response.getBody().read(byteBuffer); if (nBytes == nBytesRead) { //do some work }else { throw new Exception("custom message"); } It works fine when I call the response once but under load I find that the exception is thrown. I've checked if the response is chunked from the server side and is not the case. I have traced the responses and it seem that the OS is receiving the response, any ideas. regards Ola |
From: Christophe R. <cr...@ac...> - 2010-10-28 13:29:45
|
On 10/16/2010 1:25 AM, Gregor Roth wrote: > > Hi Christophe, > > > take a look into the tutorial > http://xsocket.sourceforge.net/core/tutorial/V2/TutorialCore.htm > (Chapter 10) of the underlying lib xSocket > > > ;-) > > Gregor > > > >> ----- Original Message ----- >> >> From: Christophe Roudet >> >> Sent: 10/15/10 07:18 PM >> >> To: xli...@li... >> >> Subject: [Xlightweb-develop] IServer.idleTimeoutMillis >> >> >> Does anybody know what is IServer.idleTimeoutMillis? Thanks, Christophe ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Xlightweb-develop mailing list Xli...@li... https://lists.sourceforge.net/lists/listinfo/xlightweb-develop > > Thanks Gregor, I still a have a problem, I have set up a server FileServiceRequestHandler requestHandler = new FileServiceRequestHandler(args[0], true); Map<String, IHttpRequestHandler> handlers = new HashMap<String, IHttpRequestHandler>(); handlers.put("/*", requestHandler); Context context = new Context("", handlers); HttpServer httpServer = new HttpServer(InetAddress.getLocalHost(), Integer.valueOf(args[1]).intValue(), context); httpServer.setMaxConcurrentConnections(1000); httpServer.setIdleTimeoutMillis(15000); httpServer.start(); and an idleTimeout exception is always raised when the download exceeds 15 while there is still traffic going on. So does the idle timeout only applies for incoming traffic on the server? Thanks, Christophe |
From: Hongwenchina <hon...@16...> - 2010-10-18 03:45:38
|
Gregor, hi, there is a bug in HttpClientConnection. when call setMaxReadBufferThreshold, the ioHandler will be suspended, and the read is never resumed. xsocket version is 2.8.14, xlightweb version is 2.13.2. And testing case is below: public class TestXSocket implements IHttpResponseHandler, IBodyDataHandler{ int x; ByteBuffer buffer = ByteBuffer.allocate(1024); public void test() throws Exception{ IHttpRequest request = new GetRequest("http://viewer.tj.cnki.net/CAJViewer%207.0.2.self.exe"); HttpClientConnection httpClientConnection = new HttpClientConnection("viewer.tj.cnki.net", 80); httpClientConnection.getUnderlyingTcpConnection().setMaxReadBufferThreshold(4096); httpClientConnection.send(request,this); } @Override public void onException(IOException ioe) throws IOException { // TODO Auto-generated method stub } @Override public void onResponse(IHttpResponse response) throws IOException { // TODO Auto-generated method stub response.getNonBlockingBody().setDataHandler(this); } @Override public boolean onData(NonBlockingBodyDataSource bodyDataSource) throws BufferUnderflowException { // TODO Auto-generated method stub int ava; try { ava = bodyDataSource.available(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return true; } if(ava<0){ System.out.println(x); return true; } int size; try { buffer.clear(); size = bodyDataSource.read(buffer); buffer.flip(); String str = new String(buffer.array()); x += size; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } public static void main(String []args) throws Exception{ TestXSocket t = new TestXSocket(); Thread.sleep(2000); t.test(); Thread.sleep(200000); } } |
From: Hongwenchina <hon...@16...> - 2010-10-17 04:21:59
|
Gregor, I'm programming a project of HttpProxy with high load. It works well when small network flow. But when users download large files with local resources, the cpu is veriy busy ,up to 99% CPU usage. So, i write a test case of HttpClient below . Before testing , deploy an web server on the localhost, which provides an large file download (1 GBytes size or above) named 1.zip. when testing begin, the CPU usage keep 80% But when i use HttpUrlConnection of JRE to download the same file, it only use 30% CPU only, and finished download at the same time. Can you give me some idea? thx. import java.io.IOException; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import org.xlightweb.HttpRequest; import org.xlightweb.HttpResponse; import org.xlightweb.IBodyDataHandler; import org.xlightweb.NonBlockingBodyDataSource; import org.xlightweb.client.HttpClient; public class TestXSocket implements IBodyDataHandler{ int bytesReceived = 0; ByteBuffer buffer = ByteBuffer.allocate(1024); @Override public boolean onData(NonBlockingBodyDataSource bodyDataSource) throws BufferUnderflowException { try { int available = bodyDataSource.available(); if(available==0){ return true; } if(available<0){ System.out.println(bytesReceived + " bytes received"); return true; } buffer.clear(); int size = bodyDataSource.read(buffer); bytesReceived +=size; } catch (IOException e) { e.printStackTrace(); } return true; } public void test() throws Exception{ HttpClient httpClient = new HttpClient(); HttpRequest req = new org.xlightweb.HttpRequest("GET", "http://localhost:8080/1.zip"); HttpResponse resp = (HttpResponse) httpClient.call(req); NonBlockingBodyDataSource nbInputBodyChannel = resp.getNonBlockingBody(); nbInputBodyChannel.setDataHandler(this); } public static void main(String []args) throws Exception{ TestXSocket obj = new TestXSocket(); obj.test(); Thread.sleep(600000); } } |
From: Christophe R. <cr...@ac...> - 2010-10-15 17:31:42
|
Does anybody know what is IServer.idleTimeoutMillis? Thanks, Christophe |
From: Arshad A. <ars...@gm...> - 2010-10-07 14:37:51
|
Hi, I've attached the example I'm using with the previous email. I guess, its pretty much the same one as you pointed out.. Thing is that the client is not able to recieve response from the outside server. Its the xlightweb based client that gets hanged, in case of synchronous call and/or does not get call back initiated, in case of asynchronous call. I'm not sure.. I can't look in to the code for xlightweb right now, so I resorted to implement my own library to use NIO sockets for http communication. Although my requirements are less, but its still a good long way to go. Any help will be appreciated. Thanks and regards, Arshad |
From: Gregor R. <gre...@gm...> - 2010-10-07 14:24:34
|
Hi Arshad, which example do you mean? http://xlightweb.svn.sourceforge.net/viewvc/xlightweb/xlightweb/sandbox/HttpProxy/? Gregor ----- Original Message ----- From: Arshad Ansari Sent: 10/03/10 08:21 PM To: xli...@li... Subject: [Xlightweb-develop] Problem with Proxy Example Hello, I'm trying to run the proxy example as detailed below: [xLightWeb] HttpClient -> ProxyServer consisting of [HttpRequestHandler, HttpResponseHander] -> Apache Httpd server. Something is going wrong in HttpResponseHandler as it calls the onReponse method of response handler, but it is unable to run exchange.send(response) method.. It gets stuck (hanged!).. Can anyone help in this regards? Thanks in advance, Arshad Ansari Attachment: HttpResponseHandler and HttpRequestHandler... |
From: Gregor R. <gre...@gm...> - 2010-10-05 03:59:18
|
Hi Arshad, which example do you mean? http://xlightweb.svn.sourceforge.net/viewvc/xlightweb/xlightweb/sandbox/HttpProxy/? Gregor ----- Original Message ----- From: Arshad Ansari Sent: 10/03/10 08:21 PM To: xli...@li... Subject: [Xlightweb-develop] Problem with Proxy Example Hello, I'm trying to run the proxy example as detailed below: [xLightWeb] HttpClient -> ProxyServer consisting of [HttpRequestHandler, HttpResponseHander] -> Apache Httpd server. Something is going wrong in HttpResponseHandler as it calls the onReponse method of response handler, but it is unable to run exchange.send(response) method.. It gets stuck (hanged!).. Can anyone help in this regards? Thanks in advance, Arshad Ansari Attachment: HttpResponseHandler and HttpRequestHandler... |
From: Arshad A. <ars...@gm...> - 2010-10-03 18:21:59
|
Hello, I'm trying to run the proxy example as detailed below: [xLightWeb] HttpClient -> ProxyServer consisting of [HttpRequestHandler, HttpResponseHander] -> Apache Httpd server. Something is going wrong in HttpResponseHandler as it calls the onReponse method of response handler, but it is unable to run exchange.send(response) method.. It gets stuck (hanged!).. Can anyone help in this regards? Thanks in advance, Arshad Ansari Attachment: HttpResponseHandler and HttpRequestHandler... |