tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Pereira <khep...@portugalmail.pt>
Subject File writing performance
Date Tue, 21 Oct 2003 19:10:09 GMT
I want to make a servlet which catches all accesses to *.swf files (with a mapping) and only
retrieves them if the permissions for the user allow it.
That can be done simply with:

<code>
// check user permissions and redirect to error page if needed
// else:
response.setContentType("application/x-shockwave-flash");
DataInputStream dis = new DataInputStream(
  getServletContext().getResourceAsStream(filename)
);
OutputStream out = response.getOutputStream();
int b = -1;
while((b = dis.read()) != -1) {
  out.write(b);
}
out.close();
</code>

My question: is this approach more expensive than simply retrieving the file? If so, is it
significative?

Best regards,
Carlos Pereira

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message