From Apache, you can use the "mod_jk" module to send HTTP requests to Tomcat using the "AJP" protocol, which is far more efficient that HTTP itself.
I want to do the same, but from a Java program. I want to use "AJP" because of its good performances (and Tomcat is not bad after all).
Does someone know about a Java implementation of the client side of "AJP" ?
Doesn't the tomcat-ajp.jar present in %TOMCAT_HOME%/server/lib have the AJP implementation?
There's open source Apache ajp-client available if someone needs it:
This is a java implementation of an ajp13 client, allowing to send requests to a servlet container using this protocol.
Whithout any real idea, but have you looked into Tomcat's source code, yet? Maybe Tomcat doesn't just implement the receiving end of AJP.
Related
I must create a desktop java client that comunicate to a servlet in order to receive some notificationes.
The servlet is an async servlet but my doubt is with the client.
How is the best way to "listen" a response from the server. I looked to the httpcomponents-asyncclient from apache, but I´m not trully convinced about that library. Maybe an infinite loop?
You might want to check out netty, it's what we use for our IntelliJ IDEA real time collaboration plugin to communicate with our remote server. It's very simple to get started with and abstracts all the hard parts, including creating secure connections. This is the netty user guide, it should get you started.
HttpComponents from Apache is very common
(be careful not to use the old one). Check a simple example.
Do you need to be constantly waiting for responses? If so, this is not the correct direction! The client should not have to call any method to get notifications... it should just be listening to some socket that the server writes to... Or just processing some queue. Perhaps you need to consider learning a bit of real time technologies and methods.
I know Thrift has its own Threadpool server but I'm not sure it will be able to handle heavy load. Would you recommend putting it behind tomcat ?
In addition, if you wanted to use the socket transport implementation could you still use tomcat ? or would need to use some other solution ?
I would really love to hear about your experience deploying thrift java services.
Consider putting it inside application server (tomcat, jetty, etc.) and accessing it through HTTP using TServlet. You get from the server:
Threads management
Connections management
You get to use standard Filters to maybe rate limit the requests, or manage access based on cookies
Probably readily available access logs
You can easily add JSON Protocol for debugging
I am a student building a http proxy server. I want to cache those requests that are frequently accessed. May I get any idea about this? Especially in java.
To figure out what you need to implement, read and understand the HTTP specification. Focus particularly on the sections on how a proxy is supposed to behave.
You could possibly base part of the implementation on the Apache HttpClient library, but I have a feeling that the APIs will prove to be unsuitable for the proxy server use-case.
I'd also like to point out that a more practical way to implement an HTTP proxy server would be to simply deploy an existing server like Squid.
I have a .NET web service that returns XML, and I'd like to compress this before it is sent.
There's a couple of ways that I can do this, but I'd rather not have to do it in code.
Can I set up IIS to gzip all content returned by my WebService? It's not being called from a browser.
The other question is if this web service is being consumed by a Java client - will that affect anything?
I imagine that the client proxy will still need to decompress, but there shouldn't be any problem if I use gzip - that is a universal protocol, right?
The standard way to do this kind of thing is to use gzip compression over HTTP since it's directly supported by the protocol. As long as your client supports that then you should be good to go.
If you are writing the client from scratch with more fundamental tools you may need to add handling for this yourself: a good example of this is shown here (python).
I would expect a lot of SOAP client libraries to have built-in support for this but you'll have to try yours to be sure: if they lean on a lower level HTTP library to do their work, in all likelihood it should Just Work.
you can configure metabase.xml in iis for better control over compression. you may want redefine your web application format (.asp,.asmx,...) to metabase if it is not already included.
you can see below:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true
and also
http://www.businessanyplace.net/?p=wscompress
I would like to implement a socket server that will be connected to by multiple clients. In order to make the implementation as simple as possible and not have to code management of threads and connections etc I'd like to use Tomcat. We already use tomcat as part of our solution.
I am sure that Tomcat can be used for non http servlets and socket connections - with GenericServlet. I'd like this to be confirmed and any tips that can be given about implementations.
UPDATE - using tomcat seems the wrong tactic - little is gained from the rest of tomcat infrastructure. Anyone got other implementation suggestions? For example Apache MINA has been recommended - any others?
If you want to create support for a non-HTTP server inside tomcat you will need to implement a new protocol handler (see the docs for PoolTcpEndpoint). But at that point you're mostly going to be gaining the Catalina startup and shutdown functionality and not a whole lot else.
If you do want to base your app on a servlet container, I'd suggest jetty for size, ease of use, ability to start programatically and ability to fit completely inside the debugger.