Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
public Object onAction(){
    return new StreamResponse() {
        @Override
        public String getContentType() {
            return "application/pdf";
        }
        @Override
        public InputStream getStream() throws IOException {
            return new ByteArrayInputStream(getMyPdfByteArray());
        }
        @Override
        public void prepareResponse(Response response) {
            response.setHeader("Content-Disposition", "attachment; filename=\"" + myFileName + "\"");
        }
    };
}

 


A java.net.URL response is handled as a client redirect to an external URL. (In Tapestry 5.3.x and earlier this only works for non-Ajax requests.)

...

Info

Note: If you are using the tapestry-hibernate integration library and your passivate context is a Hibernate entity, then you can just use the entity itself, not its id. Tapestry will automatically extract the entity's id into the URL, and convert it back for the "activate" event handler method.

...

When a page render request arrives, the page is activated before it is rendered.

Wiki Markup
{float:right|background=#eee|padding=0 1em}
    *JumpStart Demos:*
    [onActivate and onPassivate|

...

https://tapestry-jumpstart.

...

org/jumpstart/examples/navigation/onactivateandonpassivate/3]
    [Handling A Bad Context|

...

https://tapestry-jumpstart.

...

org/jumpstart/examples/infrastructure/handlingabadcontext/1]
{float}

Activation serves two purposes:

...

At some point, persistent values make more sense. Tapestry has several persistence strategies available, including one that stores data in URL query parameters. See Persistent Page Data for details.

Scrollbar