Combining apache requests?
I have an ajax client that often needs to retrieve 3-10 static documents from the server. Those 3-10 documents are selected by the client from roughly 100 documents in total. I have no way of knowing in advance which 3-10 documents the client will require.
Additionally, those 100 documents are generated from database content, and are dynamic. It does not seem logical thou开发者_如何学JAVAgh to make a single ajax requests per document.
My first thought was to write a JSP that makes use of the include action.
ie in pseudo code:
for (param in params){
jsp:include page="[param]"
}
Tomcat can't support this as it doesn't just include the html resource, it re-compiles it, generating a class file each time, which also seems costly .
Can the community provide a solution for combining apache requests to static files to make use of single requests, rather than several, but without the overhead of extra class files for each of the static files and in way that avoids the regeneration each time the static file changes?
You can certainly write a Servlet (or JSP if you're really insistent on doing so) which will serve the contents of a set of documents.
However, doing so would encounter some of the following issues
- How do you delimit the documents so that the clients know which is which
- How to stop the clients from requesting something they don't have permission to (this one is tricky)
精彩评论