problems with flash-integration
"Roberto Saccon" <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.devel |
|---|---|
| Message-ID | <003501c28d7d$87a98f20$7322dccb@laptop> |
Hello Howard and community
First, thanks for all the efforts put into this great Web-Framework.
Second, I try to add a new dimension to it by creating a general flash-component. You might ask, what is that good for. Well, I have created a Flash-Texteditor with may features (for weblog-application). This is much easier to do in Flash than in DHTML/Flashscript and with FlashRemoting (propietary) or Apache XML-RPC the Editor can talk to a servlet and even do things lilke spell-checking. But here comes my problem. After studying for two days the Tapestry RequestCycle, my Flashcomponent was neither capable to store the URL nor to initialize propperly a ActionListener.
To handle that stuff in a simple servlet would be very easy, because the FlashClient simple puts an attributes into the HttpServletRequest, which is used as argument for invoking serverside-functions, and then puts the result back in the HttpServletRequest. So I created a very simple FlashComponent which just handles the HTML-Tage for embeding the flash-object and I put all the Logic into the servlet by overiding the doService-Method in the ApplicationServlet, see my codefragments commented es flash-ugly-hack-1 and flash-ugly-hack-2.
Obviously, this is NOT how components should be created. But how can I create a real Component with a listener which is triggered when I "submit" form the flashclient ? I tried to modify the Link- and Form-Componentts, but without success. Any help is highly appreciated.
regards
Roberto
abstract public class FlashApplicationServlet extends ApplicationServlet
{
...
...
protected void doService(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
//flash-ugly-hack-1
boolean flashRequest = false;
String flashParameter0 = null;
Object o = request.getAttribute("FLASH.PARAMS");
if ( o != null)
{
flashRequest = true;
List args = (List) o;
flashParameter0 = (String) args.get(0);
}
RequestContext context = null;
try
{
// Create a context from the various bits and pieces.
context = new RequestContext(((ApplicationServlet) this), request, response);
// The subclass provides the engine.
IEngine engine = getEngine(context);
// flash-ugly-hack-2
if (flashRequest)
{
String result = flashParameter0 + ((Visit) engine.getVisit()).getUser().getEmail();
request.setAttribute("FLASH.RESULT", result);
}
.......