Should we have an annotation? @DeleteFile? I'm not sure if deleting
the file should be teh default behavior for input or output.
On 5/12/12 1:56 PM, Jim Stafford wrote:
> I was experimenting with the File parameter and return type interface
> for JAX-RS. As expected -- it functionally worked but I did not locate
> any documentation that stated who must manage the file resource once
> my method exits.
>
> For example, in the following PUT -- the method is provided a
> temporary file that existed after the method exited and my test case
> completed. I added a manual delete within my resource method to make
> sure they did not accumulate.
>
> @PUT @Path("fromFile")
> @Consumes(MediaType.APPLICATION_OCTET_STREAM)
> public int putFromFile(File file) throws IOException, ClassNotFoundException {
> log.debug("{} {}", request.getMethod(), uriInfo.getRequestUri());
> log.debug("file={}", file.getAbsolutePath());
>
> ...
>
> file.delete(); //didn't locate any documentation on who manages this
> return count;
> }
>
> In GET case, the resource method is passing the file back to the
> provider. Does the provider assume that this file is managed by the
> resource and it is my responsibility to delete?
>
> @GET @Path("fromFile")
> @Produces(MediaType.APPLICATION_OCTET_STREAM)
> public File getFromFile() throws IOException {
> log.debug("{} {}", request.getMethod(), uriInfo.getRequestUri());
>
> File file = ...
> return file;
> }
>
> thanks for any additional insight,
> jim
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Resteasy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Resteasy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/resteasy-users