Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.
The "Tapestry5HowToCreateAComponentEventResultProcessor" page has been changed by NeemePraks: http://wiki.apache.org/tapestry/Tapestry5HowToCreateAComponentEventResultProcessor?action=diff&rev1=2&rev2=3 Comment: minor fixes import java.io.IOException; import java.io.OutputStream; + import org.apache.tapestry5.StreamResponse; import org.apache.tapestry5.services.Response; /** * Callback for directly writing to the outputstream from an action method - * This class was inspired by {@link OutputStreamResponse} + * This class was inspired by {@link StreamResponse} - * + * * @author [email protected] * */ @@ -31, +32 @@ String getContentType(); /** - * Implements a callback to directly write to the output stream. + * Implements a callback to directly write to the output stream. - * The stream will be closed after the callback was called. + * The stream will be closed after this method returns. - * The provided stream will be wrapped in a {@link BufferedOutputStream} for efficiency. + * The provided stream is wrapped in a {@link BufferedOutputStream} for efficiency. */ public void writeToStream(OutputStream out) throws IOException; - /** * Prepares the response before it is sent to the client. This is the place to set any response headers (e.g. @@ -45, +45 @@ * @param response Response that will be sent. */ void prepareResponse(Response response); + } }}} @@ -65, +66 @@ import org.apache.tapestry5.services.Response; /** - * ComponentEventResultProcessor that enables EventHandlers to return Callbacks + * ComponentEventResultProcessor that enables EventHandlers to return Callbacks * that can stream arbitrary data to the client. - * + * * The class was inspired by {@link StreamResponseResultProcessor} - * + * * @author [email protected] */ - public class OutputStreamResponseResulProcessor implements + public class OutputStreamResponseResultProcessor implements ComponentEventResultProcessor<OutputStreamResponse> { - + private static final int BUFFER_SIZE = 5000; private final Response response; - public OutputStreamResponseResulProcessor(Response response) { + public OutputStreamResponseResultProcessor(Response response) { this.response = response; } /** * Handles OutputStreamResponse - * + * - * @param Callback for streaming arbitray data to the client using the response's OutputStream + * @param Callback for streaming arbitrary data to the client using the response {@link OutputStream} - * + * * @see ComponentEventResultProcessor#processResultValue(Object) */ - @Override public void processResultValue(OutputStreamResponse streamResponse) throws IOException { @@ -112, +112 @@ } } } + } }}} - == 3) Register the newly created ComponentEventResultProcessor == + == 3) Register the newly created ComponentEventResultProcessor in your Module (e.g. AppModule) == {{{ /** * Adds ComponentEventResultProcessors - * + * * @param configuration the configuration where new ComponentEventResultProcessors are registered by the type they are processing * @param response the response that the event result processor handles */ public void contributeComponentEventResultProcessor(MappedConfiguration<Class<?>, ComponentEventResultProcessor<?>> configuration, Response response) { - configuration.add(OutputStreamResponse.class, new OutputStreamResponseResulProcessor(response)); + configuration.add(OutputStreamResponse.class, new OutputStreamResponseResultProcessor(response)); } }}} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
