tomcat compression
If compression is setup on tomcat, will it also compress data that is uploaded by 开发者_Go百科the client - via browser/applet ?
No, it won't. It only applies on the server response. The client has to compress the request data itself. It makes no sense to send the data from the client uncompressed over network to the server first and then compress over there. It won't have any benefits (i.e. saving network bandwidth and so on).
Compression of HTTP requests is however not part of the HTTP specification since a client can't know beforehand if a server would support it. It has to fire a whole request first. It's only specified for the HTTP responses. The server can determine based on the Accept-Encoding
request header if the client supports compression or not and then handle accordingly.
In an applet, you can consider to send the data compressed using GZIPOutputStream
. You'll only need to develop a specific servlet on the server side which listens on requests from the applet only and knows that it needs to decompress the HttpServletRequest#getInputStream()
accordingly using GZIPInputStream
精彩评论