Hi Torsten,

and welcome to the users list.  We do our best to be friendly here :-)

Although I'm not sure what why your exact error is occurring, you are in
fact going about this the wrong way.  Apache Isis works at a higher level
of abstraction than Wicket.  For this particular use case we provide a
couple of value types, o.a.i.applib.value.Blob [1] and
o.a.i.applib.value.Clob [2]

What you need to do in this case is to simply define an action that returns
either type.

You can find an example in the applib itself... as you can see the
Dto_downloadXml mixin [3] (which contributes the downloadXml action for any
JAXB-annotated view models that implements the Dto marker interface)
returns a Clob.

There are similar examples in the Isis addons devutils module, eg [4].

Also worth saying: if Blob or Clob is used as a parameter, then this
provides an upload capability.  Blob/Clob can also be used a property, eg
in the isisaddons todoapp [5].

HTH

Dan


[1]
https://github.com/apache/isis/blob/master/core/applib/src/main/java/org/apache/isis/applib/value/Blob.java

[2]
https://github.com/apache/isis/blob/master/core/applib/src/main/java/org/apache/isis/applib/value/Clob.java

[3]
https://github.com/apache/isis/blob/master/core/applib/src/main/java/org/apache/isis/applib/services/dto/Dto_downloadXml.java#L56

[4]
https://github.com/isisaddons/isis-module-devutils/blob/master/dom/src/main/java/org/isisaddons/module/devutils/dom/DeveloperUtilitiesServiceMenu.java#L62

[5]
https://github.com/isisaddons/isis-app-todoapp/blob/master/dom/src/main/java/todoapp/dom/todoitem/ToDoItem.java#L470


On 11 Jan 2016 6:01 pm, "Torsten Wullschleger" <[email protected]>
wrote:

> Hey folks,
> I am new to Apache Isis and this Community, so please don't be too harsh
> with me.
>
> I want to create a button, which downloads a file. I already implemented
> it for Apache Wicket, now I wanted to know if there is a chance using it
> with Isis.
>
> I'm trying to use the org.apache.wicket.request packages for that, which
> are in the org.apache.isis.viewer.
> But as soon as I import those classes I get this error:
>
> javax.servlet.ServletException: Filtered request failed.
>
> org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:384)
>
> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
> io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
>
> io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
>
> io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
>
> io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
>
> io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
>
> org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>
> io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
>
> io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>
> io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
>
> io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
>
> io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
>
> io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
>
> io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
>
> io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>
> org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
>
> io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
>
> io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
>
> io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
>
> io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
> io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
> io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> java.lang.Thread.run(Thread.java:745)
>
>
> This is the button that I try to make:
>
> public Car generateTxt(){
>         getRequestCycle().scheduleRequestHandlerAfterCurrent(
>                         new ResourceStreamRequestHandler(new
> AbstractResourceStreamWriter() {
>
>                             @Override
>                             public void write(OutputStream output) throws
> IOException {
>                                 try {
>
>                                     fileCreator.generate(output, "login",
> "password", Car.this);
>                                 } catch (IOException |
> KeyManagementException ex) {
>
>                                 }
>                             }
>                         })
>                         .setFileName("car.txt")
>
> .setContentDisposition(ContentDisposition.ATTACHMENT)
>                     );
>         return this;
> }
>
> Is there any way how I can get an OutputStream like this?
>
> Best Regards,
> Torsten
>

Reply via email to