I'd like to use java.net.http.HttpClient instead of curl to perform the http examples list here:
https://docs.docker.com/engine/api/sdk/examples/
Is there a way to do this?
The JDK does not support Unix Domain Socket connections yet (JEP 380 will add this feature). But regardless of that it appears java.net.http.HttpClient only supports URIs (but not SocketAddress) as destination, therefore it would not work anyways.
There are however libraries which offer this functionality:
junixsocket (relevant issue)
Reactor Netty
Netty: How do I connect to a UNIX domain socket running an HTTP server using Netty?
unix-socket-factory (for Apache HttpClient)
However, since your goal is to connect to Docker, it would be easiest to use one of the available Java Docker clients.
Related
Just noticed that netty-tcnative-boringssl doesn't support AIX(tried on AIX and confirmed by netty-tcnative's dev). Which got my ass burning and eager to find the alternative solution for HTTP2 with native openssl lib as sooner as possible.
Since I need to run it on Java8 which doesn't have HTTP2, so they must have native support of it. Does anyone know Apache HTTP Client 5 or OkHTTP have native openssl(boringSSL) builtin, or addon lib that could make them running without using JDK's SSL provider?
I am fairly new to the web development, I have been going over the release notes of the Java on different platforms like linux (oracle hotspot), AIX and hp-ux. I am actually investigating around the TLS support of each version of java on those platforms. I am coming across information(Java 8, AIX) showing the support for client-side connections and server-side connections. What I do not understand is what is the difference between them.
Does it simply mean that the client trying to connect to a server and the other is server trying to connect to a client? If that is the case why is the TLS support different for both of those connections. I would like to understand the general difference between both of them and what it has to do with the TLS support.
I have a multi-player game that uses Java sockets, the server is a standard Java application and the client is a Java applet that runs in the web-browser.
Now since last Java's update (Java 7 update 51) all applets require code signing, so I would like to move way from the applet and rewrite the client in HTML5.
I've been looking into the socket.io and it seems quite easy, but I can't find any information on how to implement it into my server.
I would like to keep the server in Java, because it will be a lot of work to port it, so is there any libs that I could use on my server to make the communication possible between a java sockets server and a socket.io client, or what is the best approach? do I really need to port the entirely server?
Thanks.
The html5 WebSocket on which socket.io works is not equal to a "normal" C or Java socket. It implements its own protocol over TCP which includes handshakes and other stuff. To port your server you have to use a library maybe this helps you.
For more information on the WebSocket protocol see here.
I'm looking for a secure way to tunnel RMI traffic.
In My application(java Webstart) i must assume that the only port that is open is port 80.
I have the looked att socketfactories for rmi but do i really need a proxy then.
I need to do all my tunneling on the client side.
The only firewall i am trying to get past is on the client side.
I'm not able to open 1099 with port ranges above.
Would be nice to see some implementations.
Thanks!
Port 1099 was reserved for RMI at IANA in about 1995. There is no reason for it not to be open for outbound access in the client-side firewall.
RMI can be made to use fixed port numbers by supplying a port number when constructing (super(port)) or exporting (exportObject(object, port)). Better still, if you create the Registry within the server JVM via LocateRegistry.createRegistry(), all subequently exported remote objects will use that port unless they specify a different port or they use a server socket factory.
BUT ... RMI already includes HTTP tunneling 'out of the box'. No external solution required. You have to deploy the RMI-Servlet provided with the JDK, at the server end.
(a)
although not the newest fashion, exposing remote services with Hessian and Burlap seems to be a simple solution to avoid problem working across firewalls: http://hessian.caucho.com/doc/
see sample code for the server and client side:
http://www.javatpoint.com/spring-remoting-by-hessian-example
(b) or consider using Spring HttpInvokder (see some sample code here: http://www.javatpoint.com/spring-remoting-by-http-invoker-example)
HttpInvokder provides more customization options through the RemoteInvocationFactory, RemoteInvocationExecutor and HttpInvokerRequestExecutor strategies (for example, to add custom context information (such as user credentials) to the remote invocation, or using java’s built-in object serialization etc.), see:
http://docs.spring.io/spring-framework/docs/2.0.x/api/org/springframework/remoting/support/RemoteInvocationFactory.html
I have to implement a Python web application which operates on data available through web-services (API with GET requests and JSON responses).
The API server is implemented in Java. Preliminarily tests show significant overhead if API calls are made through urllib2 (connection is opened and closed for each request).
If I enable AJP in API server, which library should I use to perform requests using AJP protocol from Python? I googled Plup, but I can't find a clear way to request and consume data in Python, not just proxying it elsewhere.
Is using AJP a good solution? Obviously I have to maintain a connection pool to perform AJP requests, but I can't find anything related in Plup.
Thank you.
I have no idea what's AJP is. Also you did not open what goes to "sigfinicant overhead", so I might be a poor person to answer to this question.
But if I were you I would first try to few tricks:
Enable HTTP 1.1 keep-alive on urllib2
(here is an example using another library Python urllib2 with keep alive )
HTTP 1.1 keep-alive connections do not close TCP/IP pipe for the subsequent requests.
Use Spawning / eventlets web server which does non-blocking IO patch for urllib / Python sockets.
http://pypi.python.org/pypi/Spawning/
This will make parallelization in Python much more robust, when the overhead in the application is input/output, not using CPU to process the requests. JSON decoding is rarely CPU bound.
With these two tricks we were able to consume 1000 request/sec in our Python web application from Microsoft IIS backed API server (farm).