No can do. I have control over the interfaces, that I can annotate as I
want, but not over the implementations. The implementations should be
completly unaware of the infrastructure (Jersey + SpringIntegration).
Probably a "resource-specific filter" will work, if it filters not only the
request but the response as well. However a much elegant solution will be a
@ResponseHeaders("content-disposition","attachment;
filename={name}.pdf", ....)
That way my resource implementation can "intercept" that and add it to the
ResponseBuilder.
Hmmm, I think I'll try this myself.
Thanks for your very quick response :)
On Jan 22, 2009 1:44pm, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
>
> On Jan 22, 2009, at 2:36 PM, amsmota_at_gmail.com wrote:
>
>
>
>
> Hello again.
>
>
>
> I have a situation here where I have to set a Content-Disposition header
in my response and I was hoping that I can do that at a annotation, or
configuration, level.
>
>
>
> @GET
>
> @Path("/reports/{name}")
>
> @Produces("application/pdf")
>
> @SOMEANNOTATION(""content-disposition","attachment; filename={name}.pdf"
>
> byte[] executePdf(@PathParam("name")String name)
>
>
>
> Would that be possible?
>
>
>
> Of course I can do it programatically in my HttpConector, but that will
break the "abstractioness" of my infrastructure...
>
>
>
>
>
>
> You can use the Response [1] builder:
>
>
>
> @GET
>
> @Path("/reports/{name}")
>
> @Produces("application/pdf")
>
> public byte[] executePdf(@PathParam("name")String name) {
>
> byte[] stuff = ...
>
> return Response.ok(stuff).header("Content-Disposition": "....");
>
> }
>
>
>
>
>
> An alternative is to use the new resource-specific filter framework i
have recently integrated. However, i have not sent any email about that yet
because there is currently an issue with the pushing of built artifacts to
the maven repo so developers would have to build the source to try it out.
>
>
>
> Paul.
>
>
>
> [1]
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/Response.html
>
>
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/Response.ResponseBuilder.html
>
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>