Re: Returning content as file...?

2015-11-25 Thread Dan Haywood
> On 24 November 2015 at 19:02, Kevin Meyer  wrote:
>
>> I've added the project to github on [1]. Sorry - I've not put much effort
>> into consolidating the menu/service actions, most of them are visible even
>> when not appropriate.
>>
>> I've implemented the "convert and send as file" as a service at [2].
>>
>> For convenience, I've created a fixture script.
>> After loading the fixture, go to "Reports" and use "Find First" to get a
>> report[3], then choose "Print as Html" - which fails with the exception.
>> "Print As Latex" just returns a String.
>>
>>
OK, so this is pretty obscure, but the good news is that there are easy
workarounds to the problem.

This code fails:

  public Object download() { return new Clob(...); }

but this code will work:

  public Clob download() { return new Clob(...); }

(ie specify Clob not Object as return type)

and so will:

  public Object download(String filename) { return new
Clob(...); }

(ie take at least 1 argument).



The issue is down to the way in which we set up the Wicket viewer's Ajax
handlers; downloadable objects with no-args have to be dealt with in a
certain way, and we look at the action signature to try to guess.

I've raised a ticket [6] to see if we can support all the cases, but I
don't see it as a high priority to fix.


Thx
Dan

PS: probably tangential to what you are working on, but the isisaddons has
a docx module [7] for mail merges.  And Jeroen experimented with xdocreport
[8], which looks simpler still; we will probably make a very minimal module
around that, too.



[6] https://issues.apache.org/jira/browse/ISIS-1264
[7] https://github.com/isisaddons/isis-module-docx
[8] https://github.com/opensagres/xdocreport


--
>> Kevin Meyer
>> Ljubljana, Slovenia
>>
>>
>>
>


Re: Returning content as file...?

2015-11-24 Thread Kevin Meyer
I've added the project to github on [1]. Sorry - I've not put much effort
into consolidating the menu/service actions, most of them are visible even
when not appropriate.

I've implemented the "convert and send as file" as a service at [2].

For convenience, I've created a fixture script.
After loading the fixture, go to "Reports" and use "Find First" to get a
report[3], then choose "Print as Html" - which fails with the exception.
"Print As Latex" just returns a String.

FYI, ultimately I'd like to install an editor (probably epiceditor[5]) to
use a rich markup for the "Description" field of a project[4]. That's
where I was trying to insert the @Html annotation.

Next steps are to insert transformers (like XSLT) into the ReportPrinters
to run-time select which properties of the Project to include in the
Report, but first I want to get the current ideas actually working.

Regards,
Kevin


On Mon, November 23, 2015 23:58, Dan Haywood wrote:
> OK, thanks for that Martin.  Makes me wonder why it works in other
> circumstances, though.
>
> Kevin... could you mail (the relevant bits of) the action any
> annotations, is it on a menu service, or a contribution service, or a
> domain entity or view model or mixin?  Would like to try to reproduce the
>  issue first (even though I'm sure the fix will probably be to do what
> Martin has suggested)
>
>

[1] https://github.com/kev-m/isis-project-printer
[2]
https://github.com/kev-m/isis-project-printer/blob/master/app/src/main/java/com/cosylab/reports/Html.java
[3]
https://github.com/kev-m/isis-project-printer/blob/master/dom/src/main/java/com/cosylab/dom/report/Report.java
[4]
https://github.com/kev-m/isis-project-printer/blob/master/dom/src/main/java/com/cosylab/dom/simple/Project.java
[5] http://epiceditor.com/
-- 
Kevin Meyer
Ljubljana, Slovenia




Re: Returning content as file...?

2015-11-24 Thread Kevin Meyer

On Mon, November 23, 2015 23:58, Dan Haywood wrote:
> OK, thanks for that Martin.  Makes me wonder why it works in other
> circumstances, though.
>

Yes, I'm running against 1.10.0

> Kevin... could you mail (the relevant bits of) the action any
> annotations, is it on a menu service, or a contribution service, or a
> domain entity or view model or mixin?  Would like to try to reproduce the
>  issue first (even though I'm sure the fix will probably be to do what
> Martin has suggested)


Will do. At work at the moment - will send later this evening when I look
at the code again (will probably just add the PoC to my github account -
though it's embarrasingly rough right now).

Thanks,
Kevin

>
>
> Thx
> Dan
>
>
>
>
>
> On 23 November 2015 at 16:41, Martin Grigorov 
> wrote:
>
>
>> Hi,
>>


>>>
>> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.(
>> ActionPanel.java:84)
>>
>>>
>>
>> , i.e. we are in the constructor.
>> Later it seems there is a call #getPage() but since ActionPanel is not
>> yet added to its parent there is no path to the page. Simple fix would be
>> to #buildGui() in #onInitialize().
>>
>>
 at




-- 
Kevin Meyer
Ljubljana, Slovenia




Re: Returning content as file...?

2015-11-23 Thread Dan Haywood
OK, thanks for that Martin.  Makes me wonder why it works in other
circumstances, though.

Kevin... could you mail (the relevant bits of) the action any
annotations, is it on a menu service, or a contribution service, or a
domain entity or view model or mixin?  Would like to try to reproduce the
issue first (even though I'm sure the fix will probably be to do what
Martin has suggested)

Thx
Dan




On 23 November 2015 at 16:41, Martin Grigorov  wrote:

> Hi,
>
>
> On Sun, Nov 22, 2015 at 8:25 PM, Dan Haywood  >
> wrote:
>
> > umm, ok... no clues there unfortunately.  Any Javascript errors in
> Chrome's
> > console?
> >
> > Also, which version are you running against?  I'm guessing 1.10.0 ?
> >
> >
> > On 22 November 2015 at 19:22, Kevin Meyer  wrote:
> >
> > > Let me turn off one component factory that I create, but don't use..
> > >
> > > In the mean time, heres the full stack trace:
> > >
> > > 20:10:40,374  [RequestCycleExtraqtp576936864-17 WARN ]  Handling
> the
> > > following exception
> > > org.apache.wicket.WicketRuntimeException: No Page found for component
> > > [ActionPanel [Component id = content]]
> > > at org.apache.wicket.Component.getPage(Component.java:1722)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy$3.handleResults(ActionResultResponseHandlingStrategy.java:65)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:254)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:195)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:106)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.(ActionPanel.java:84)
> >
>
> , i.e. we are in the constructor.
> Later it seems there is a call #getPage() but since ActionPanel is not yet
> added to its parent there is no path to the page.
> Simple fix would be to #buildGui() in #onInitialize().
>
>
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:128)
> > > at
> > >
> > >
> >
> org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1.onClick(ActionLinkFactoryAbstract.java:73)
> > > at
> > > org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:86)
> > > at
> > >
> > >
> >
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:146)
> > > at
> > >
> > >
> >
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:641)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > at java.lang.reflect.Method.invoke(Method.java:497)
> > > at
> > >
> > >
> >
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> > > at
> > >
> > >
> >
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> > > at
> > >
> > >
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> > > at
> > >
> > >
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> > > at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
> > > at
> > >
> > >
> >
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> > > at
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> > > at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> > > at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> > > at
> > >
> > >
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> > > at
> > >
> > >
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> > > at
> > >
> > >
> >
> 

Re: Returning content as file...?

2015-11-23 Thread Martin Grigorov
Hi,


On Sun, Nov 22, 2015 at 8:25 PM, Dan Haywood 
wrote:

> umm, ok... no clues there unfortunately.  Any Javascript errors in Chrome's
> console?
>
> Also, which version are you running against?  I'm guessing 1.10.0 ?
>
>
> On 22 November 2015 at 19:22, Kevin Meyer  wrote:
>
> > Let me turn off one component factory that I create, but don't use..
> >
> > In the mean time, heres the full stack trace:
> >
> > 20:10:40,374  [RequestCycleExtraqtp576936864-17 WARN ]  Handling the
> > following exception
> > org.apache.wicket.WicketRuntimeException: No Page found for component
> > [ActionPanel [Component id = content]]
> > at org.apache.wicket.Component.getPage(Component.java:1722)
> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy$3.handleResults(ActionResultResponseHandlingStrategy.java:65)
> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:254)
> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:195)
> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:106)
> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.(ActionPanel.java:84)
>

, i.e. we are in the constructor.
Later it seems there is a call #getPage() but since ActionPanel is not yet
added to its parent there is no path to the page.
Simple fix would be to #buildGui() in #onInitialize().


> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)
> > at
> >
> >
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:128)
> > at
> >
> >
> org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1.onClick(ActionLinkFactoryAbstract.java:73)
> > at
> > org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:86)
> > at
> >
> >
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:146)
> > at
> >
> >
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:641)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:497)
> > at
> >
> >
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> > at
> >
> >
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> > at
> >
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> > at
> >
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> > at
> >
> >
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
> > at
> >
> >
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> > at
> >
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> > at
> >
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> > at
> >
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> > at
> >
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> > at
> >
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> > at
> >
> >
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> > at
> >
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
> > at
> >
> >
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.doFilter(IsisLogOnExceptionFilter.java:52)
> > at
> >
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
> > at
> >
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
> > at
> >
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
> > at
> >
> >
> org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
> > at
> >
> >
> 

Returning content as file...?

2015-11-22 Thread Kevin Meyer
Hi,

I'm sure this has been described before, but could someone point me to
some instructions on how to have the output from a service sent back to
the user as a file? (markmail is good, but I'm struggling with what to
search for!)

For example, I want the results of "printToLatex(Report report)" to be
sent back the the user as a LaTeX file with a name derived from
report.getName().
My method signature right now is "String printToLatex(Report report)".

How does this differ from the service action "printToHtml(Report report)"
which should return only the resulting HTML to the browser? Is that
possible?

Thanks in advance,
Kevin

-- 
Kevin Meyer
Ljubljana, Slovenia




Re: Returning content as file...?

2015-11-22 Thread Dan Haywood
umm, ok... no clues there unfortunately.  Any Javascript errors in Chrome's
console?

Also, which version are you running against?  I'm guessing 1.10.0 ?


On 22 November 2015 at 19:22, Kevin Meyer  wrote:

> Let me turn off one component factory that I create, but don't use..
>
> In the mean time, heres the full stack trace:
>
> 20:10:40,374  [RequestCycleExtraqtp576936864-17 WARN ]  Handling the
> following exception
> org.apache.wicket.WicketRuntimeException: No Page found for component
> [ActionPanel [Component id = content]]
> at org.apache.wicket.Component.getPage(Component.java:1722)
> at
>
> org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy$3.handleResults(ActionResultResponseHandlingStrategy.java:65)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:254)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:195)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:106)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.(ActionPanel.java:84)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)
> at
>
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:128)
> at
>
> org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1.onClick(ActionLinkFactoryAbstract.java:73)
> at
> org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:86)
> at
>
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:146)
> at
>
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:641)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497)
> at
>
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> at
>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> at
>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> at
>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> at
>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
> at
>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> at
>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
> at
>
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.doFilter(IsisLogOnExceptionFilter.java:52)
> at
>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
> at
>
> org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
> at
>
> org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
> at
>
> org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
> at
>
> org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
> at
>
> org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
> at
>
> org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
> at
>
> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
> at
>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
> at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
> at
>
> 

Re: Returning content as file...?

2015-11-22 Thread Kevin Meyer
Hi Dan,

Thanks - nice elegant looking solution.

But I'm getting an exception, I must be missing something in the setup? :

20:10:40,374  [RequestCycleExtraqtp576936864-17 WARN ]  Handling the
following exception
org.apache.wicket.WicketRuntimeException: No Page found for component
[ActionPanel [Component id = content]]
at org.apache.wicket.Component.getPage(Component.java:1722)
at
org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy$3.handleResults(ActionResultResponseHandlingStrategy.java:65)
at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:254)
at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:195)
at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:106)
at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.(ActionPanel.java:84)
at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)



On Sun, November 22, 2015 17:37, Dan Haywood wrote:
> If you return an org.apache.isis.applib.value.Clob, where you can specify
>  the filename and media type.
>
> If you wanted to return a zip file or other binary content, use
> org.apache.isis.applib.value.Blob.
>
> For example, see [1]
>
>
> Cheers
> Dan
>
>
>
> [1]
> https://github.com/apache/isis/blob/master/core/applib/src/main/java/org/a
> pache/isis/applib/services/dto/Dto_downloadXml.java#L56
>
>
> On 22 November 2015 at 15:51, Kevin Meyer  wrote:
>
>
>> Hi,
>>
>>
>> I'm sure this has been described before, but could someone point me to
>> some instructions on how to have the output from a service sent back to
>> the user as a file? (markmail is good, but I'm struggling with what to
>> search for!)
>>
>> For example, I want the results of "printToLatex(Report report)" to be
>> sent back the the user as a LaTeX file with a name derived from
>> report.getName(). My method signature right now is "String
>> printToLatex(Report report)".
>>
>> How does this differ from the service action "printToHtml(Report
>> report)" which should return only the resulting HTML to the browser? Is
>> that possible?
>>
>> Thanks in advance,
>> Kevin
>>
>>
>> --
>> Kevin Meyer
>> Ljubljana, Slovenia
>>
>>
>>
>>
>


-- 
Kevin Meyer
Ljubljana, Slovenia




Re: Returning content as file...?

2015-11-22 Thread Dan Haywood
Probably need to see some more of the stack trace.

You could also run in debug and set a breakpoint as to when the first
exception is thrown, to provide a bit more context..

D

On 22 November 2015 at 19:13, Kevin Meyer  wrote:

> Hi Dan,
>
> Thanks - nice elegant looking solution.
>
> But I'm getting an exception, I must be missing something in the setup? :
>
> 20:10:40,374  [RequestCycleExtraqtp576936864-17 WARN ]  Handling the
> following exception
> org.apache.wicket.WicketRuntimeException: No Page found for component
> [ActionPanel [Component id = content]]
> at org.apache.wicket.Component.getPage(Component.java:1722)
> at
>
> org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy$3.handleResults(ActionResultResponseHandlingStrategy.java:65)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:254)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:195)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:106)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.(ActionPanel.java:84)
> at
>
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)
>
>
>
> On Sun, November 22, 2015 17:37, Dan Haywood wrote:
> > If you return an org.apache.isis.applib.value.Clob, where you can specify
> >  the filename and media type.
> >
> > If you wanted to return a zip file or other binary content, use
> > org.apache.isis.applib.value.Blob.
> >
> > For example, see [1]
> >
> >
> > Cheers
> > Dan
> >
> >
> >
> > [1]
> >
> https://github.com/apache/isis/blob/master/core/applib/src/main/java/org/a
> > pache/isis/applib/services/dto/Dto_downloadXml.java#L56
> >
> >
> > On 22 November 2015 at 15:51, Kevin Meyer  wrote:
> >
> >
> >> Hi,
> >>
> >>
> >> I'm sure this has been described before, but could someone point me to
> >> some instructions on how to have the output from a service sent back to
> >> the user as a file? (markmail is good, but I'm struggling with what to
> >> search for!)
> >>
> >> For example, I want the results of "printToLatex(Report report)" to be
> >> sent back the the user as a LaTeX file with a name derived from
> >> report.getName(). My method signature right now is "String
> >> printToLatex(Report report)".
> >>
> >> How does this differ from the service action "printToHtml(Report
> >> report)" which should return only the resulting HTML to the browser? Is
> >> that possible?
> >>
> >> Thanks in advance,
> >> Kevin
> >>
> >>
> >> --
> >> Kevin Meyer
> >> Ljubljana, Slovenia
> >>
> >>
> >>
> >>
> >
>
>
> --
> Kevin Meyer
> Ljubljana, Slovenia
>
>
>