added Content-Disposition header to diff

This commit is contained in:
Sebastian Sdorra
2011-09-18 17:13:30 +02:00
parent 5792a78c40
commit 95fca0a762

View File

@@ -314,7 +314,8 @@ public class RepositoryResource
{
output = new BrowserStreamingOutput(browser, revision, path);
String contentDispositionName = getContentDispositionName(path);
String contentDispositionName =
getContentDispositionNameFromPath(path);
response = Response.ok(output).header("Content-Disposition",
contentDispositionName).build();
@@ -372,8 +373,13 @@ public class RepositoryResource
if (diffViewer != null)
{
String name =
repository.getName().concat("-").concat(revision).concat(".diff");
String contentDispositionName = getContentDispositionName(name);
response = Response.ok(new DiffStreamingOutput(diffViewer, revision,
path)).build();
path)).header("Content-Disposition",
contentDispositionName).build();
}
else
{
@@ -519,6 +525,20 @@ public class RepositoryResource
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
*
* @param name
*
* @return
*/
private String getContentDispositionName(String name)
{
return "attachment; filename=\"".concat(name).concat("\"");
}
/**
* Method description
*
@@ -527,7 +547,7 @@ public class RepositoryResource
*
* @return
*/
private String getContentDispositionName(String path)
private String getContentDispositionNameFromPath(String path)
{
String name = path;
int index = path.lastIndexOf("/");
@@ -537,7 +557,7 @@ public class RepositoryResource
name = path.substring(0, index);
}
return "attachment; filename=\"".concat(name).concat("\"");
return getContentDispositionName(name);
}
/**