How to combine apache requests?

Posted by Bruce on Stack Overflow See other posts from Stack Overflow or by Bruce
Published on 2010-04-05T02:57:14Z Indexed on 2010/04/05 3:03 UTC
Read the original article Hit count: 229

Filed under:

To give you the situation in abstract:

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 out of about 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 so change over time.

It seems messy to me to have to make 10 ajax requests for 10 separate documents.

My first thought was to write a jsp that could use the include action. ie in pseudo code

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

But it turns out the tomcat doesn't just include the html resource, it recompiles it, generating a class file every time, which also seems wasteful.

Does any one know of a neat solution for combining apache requests to static files to make one request, rather than several, but without the overhead of, for example, tomcat generating extra class files for each static file and regenerating them each time the static file changes?

Thanks! Hopefully my question is clear - it's a bit long-winded.

© Stack Overflow or respective owner

Related posts about apache