firefox cuts files, whose name contains spaces, struts application
i am controlling unbroken category (simplified effect understandability) download images struts web application.
it operative glorious each browser nonetheless firefox, cuts names containing spaces. say: file spaces.pdf gets downloaded firefox as: file while chrome, ie7 ie6 downloaded file spaces.pdf.
public category download extends movement {
private stationary final int buffer_size = 4096;
open actionforward execute(actionmapping mapping,
actionform form,
httpservletrequest request,
httpservletresponse response) throws difference {
twine filename = "file spaces.pdf";
record file = ... // non-static containing file;
response.setstatus(httpservletresponse.sc_ok);
response.setcontenttype(getmimetype(request, file));
response.setheader("content-type", getmimetype(request, file));
response.setheader("content-disposition","attachment; filename="+ filename);
inputstream = new fileinputstream(file);
sendfile(is, response);
relapse null;
}
stable twine getmimetype(httpservletrequest request, record file) {
servletcontext concentration = super.servlet.getservletcontext();
relapse application.getmimetype(file.getname());
}
stable vacant sendfile(inputstream is, httpservletresponse response) throws ioexception {
bufferedinputstream = null;
try {
int count;
byte[] aegis = new byte[buffer_size];
= new bufferedinputstream(is);
servletoutputstream out = response.getoutputstream();
while(-1 != (count = in.read(buffer)))
out.write(buffer, 0, count);
out.flush();
} locate (ioexception ioe) {
system.err.println("ioexception download::sendfile");
ioe.printstacktrace();
} finally {
(in != null) {
try {
in.close();
} locate (ioexception ioe) { ioe.printstacktrace(); }
}
}
}
}
does anyone know going here? note i am controlling firefox 3.0.3 underneath windows vista.
Comments
Post a Comment