You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2011/10/30 22:13:59 UTC
[Tapestry Wiki] Update of "Tapestry5HowToCreateAComponentEventResultProcessor" by NeemePraks
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 robert.binna@uibk.ac.at
*
*/
@@ -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 robert.binna@uibk.ac.at
*/
- 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: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org