set the file name to assist manual download

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17236 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-04-17 15:27:20 +00:00
1 parent db463e4c92
commit c30ccd6bb3
1 file changed
+3
@@ -345,6 +345,9 @@ public abstract class Slave extends Node implements Serializable {
public void doIndex( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
URLConnection con = connect();
// since we end up redirecting users to jnlpJars/foo.jar/, set the content disposition
// so that browsers can download them in the right file name.
rsp.setHeader("Content-Disposition", "inline; filename=" + fileName);
InputStream in = con.getInputStream();
rsp.serveFile(req, in, con.getLastModified(), con.getContentLength(), "*.jar" );
in.close();