On Jul 15, 2009, at 1:31 PM, António Mota wrote:
> I don't think there is a best practice for that,
I tried to allude to what such a best practice might be by utilizing a
TemplateProcessor, but without understanding a little more about how
Jasper Reports works i cannot really say if this fits well.
Paul.
> you have to write the code to produce the report as usual using the
> ouptut format you want, and wrap that in a Jersey annotated method.
> At least that how we did it, but please note that we aren't using
> the full Jersey stack, so maybe there are cleaner ways?
>
> @GET
> @Path("/reports/{name}")
> @Produces("application/pdf")
> byte[] executePdf(@PathParam("name")String name,
> @MatrixParam("queryparams")Map<String, String> params,
> @QueryParam("locale")Locale locale);
>
>
>
>
> Paul Sandoz wrote:
>> Hi,
>>
>> I am not familiar with the Jasper Report...
>>
>> Is there an API to generate reports ? If so you might be able to
>> use that directly in a resource method.
>>
>> If you can do that what you might find is that you start
>> reproducing code in the resource method that might be more
>> appropriate else where, hence the separation of model and view.
>>
>> You might be able to easily integrate such functionality as a
>> TemplateProcessor e.g. See Bill's integration of StringTemplate
>>
>> http://github.com/dehora/jersey-stringtemplate <http://github.com/dehora/jersey-stringtemplate/
>> >
>>
>>
>> Thus you could potentially do:
>>
>> @Produces("application/pdf")
>> public Viewable getReport() {
>> Model model = ...
>> return new Viewable(
>> "myreport.jr", // reference to a Jasper Report template
>> model);
>> }
>>
>> Paul.
>>
>> On Jul 14, 2009, at 10:05 AM, aloleary wrote:
>>
>>>
>>> Hello,
>>> Has/Is anyone @Produce-ing JasperReports from Jersey/JAX-RS ?
>>> What is
>>> the best practice or suggested approach. All the Jasper examples I
>>> see
>>> typically involve a web view layer - something I'm trying to avoid
>>>
>>> Any pointers appreciated
>>>
>>> -A-
>>> --
>>> View this message in context: http://n2.nabble.com/Jaser-Reports---PDF-tp3254543p3254543.html
>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net <mailto:users-unsubscribe_at_jersey.dev.java.net
>>> >
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net <mailto:users-help_at_jersey.dev.java.net
>>> >
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>