tapestry return zone and streamresponse

293 Views Asked by At

I need return the body of a zone and streamresponse.

I want to update a zone and returns a file.

The event in java will be like this:

Object[] onActionFromGenerar() throws InstanceNotFoundException{
        /**
         * Code
         * 
         */

        try(InputStream input = new ByteArrayInputStream(cuaderno.getFichero())){
            return new Object[] {new AttachmentStreamResponse(input,"Transferencias"), tableZone.getBody()};
        }catch (IOException x){
            System.err.format("IOException: %s%n", x);
            return new Object[] { Index.class } ;
        }
    }

but return a error. Can only return tableZone.getBody();

How can I do?

1

There are 1 best solutions below

1
On

You can't return both from a single action.

You'll need two actions.

  1. First action returns the zone to update. It also uses JavaScriptSupport.addScript(...) to load the second action when the zone updates on the client (eg set window.location.location.href)
  2. Second action returns the StreamResponse.