java - Modify JSTL import tag to show gzipped text in JSP -
in jsps using jstl show contents of simple text files reside on server follows:
c:import url="http://www.mysite.com/texts/name_id.txt" charencoding="utf-8"/>
these text files can quite long , there many of them want compress them , serve compressed version import tag. can give me suggestions on how modify jstl import tag, or create own tag achieves same result when text file compressed? suspect should use apache commons codec, or java.util.zip enough?
for reference, source jstl 1.2 import tag can seen at:
regards
create servlet mapped on url pattern of /texts/* , following job in doget().
string path = request.getrequesturi().substring(request.getcontextpath().length()); inputstream input = new gzipinputstream(getservletcontext().getresourceasstream(path)); outputstream output = response.getoutputstream(); // write input output. note url based on question , can keep urls in jsp unchanged way.
Comments
Post a Comment