To provide you with the problem in abstract:

I've an ajax client that frequently must retrieve 3-10 static documents in the server. Individuals 3-10 documents are selected through the client from about 100 documents as a whole. I've not a way of knowing ahead of time which 3-10 documents the customer will need.

Furthermore, individuals 100 documents are produced from database content, and thus change with time.

It appears untidy in my experience to need to make 10 ajax demands for 10 separate documents.

My first thought ended up being to write a jsp that may make use of the include action. ie in pseudo code

for (param in params){
    jsp:include page="[param]"
}  

However it works out the tomcat does not just range from the html resource, it recompiles it, producing a category file each time, that also appears inefficient.

Does anyone are conscious of a neat solution for mixing apache demands to static files to create one request, instead of several, but with no overhead of, for instance, tomcat producing extra class files for every static file and regenerating them every time the static file changes?

Thanks! Hopefully my real question is obvious - it's a little lengthy-winded.

You are able to certainly write a Servlet (or JSP if you are really insistent on doing this) that will serve the items in some documents.

However, doing this would encounter a few of the following issues

  • How can you delimit the documents to ensure that the clients know that is which
  • How you can steer clear of the clients from asking for something they do not have permission to (that one is tricky)