Hi Resteasy players,
I just wrote a JAX-RS Webservice that produces application/octet-stream
flow to allow download of a file.
When I access the service through firefox, I would like that the Save as
dialog box proposes the name of the file as the default filename.
Any idea on how to do this with RestEasy ?
Here is my code snippet:
@GET
@Path("/{repositoryName}/{workspaceName}/items{path:.*}/download")
@Produces("application/octet-stream")
public InputStream getItem(@Context HttpServletRequest request,
@PathParam("repositoryName") String rawRepositoryName,
@PathParam("workspaceName") String rawWorkspaceName,
@PathParam("path") String path) throws JSONException,
UnauthorizedException, RepositoryException {
Repository repository =
RepositoryUtils.getRepository(rawRepositoryName);
Session session = repository.login(rawWorkspaceName);
Node fileNode = session.getNode(path);
Node jcrContent = fileNode.getNode("jcr:content");
String fileName = fileNode.getName();
logger.info("Downloading file {}", fileName);
return jcrContent.getProperty("jcr:data").getBinary().getStream();
}
Greetings
Akram
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Resteasy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/resteasy-users