7 Replies Latest reply on Mar 14, 2008 4:05 PM by FlexAgileDev

    Flex and J2EE

    FlexAgileDev
      I am using the Flex 3 SDK. On the server side, I am using Java.

      I looked at the Flex 3 SDK documentation and I found the Flex 3 compiler modules for Apache and IIS:

      http://livedocs.adobe.com/flex/3/html/help.html?content=apache_1.html

      Is there a Java servlet filter that can compile MXML files on demand?

      Thanks in advance.
        • 1. Re: Flex and J2EE
          FlexAgileDev Level 1
          To elaborate further: I am deploying my web application as a J2EE WAR file.

          If I can use a servlet filter to compile the MXML on demand, then I won't need put a SWF in my WAR. I'll just embed the MXML file (and my *.as files) and let the servlet do the compilation at runtime.

          Is this possible/feasible? I thought that this is how Flex 1.0 used to work (I haven't looked at Flex in a few years)
          • 2. Re: Flex and J2EE
            FlexAgileDev Level 1
            According to the Flex 3 Livedocs:

            "For web tier compilation, you can also use the Adobe Flex compiler module for J2EE application servers. The Flex compiler module for J2EE application servers is a ZIP file that you can deploy to most J2EE application servers that support servlets. The Flex compiler module for J2EE application servers also provides a JSP tag library that lets you write Flex applications in JSPs. It is available as a download on the Adobe web site."

            Where can I download the "Flex compiler module for J2EE application servers" ?

            • 3. Re: Flex and J2EE
              atta707 Level 2
              I'm not certain but think that it's bundled with LiveCycle Data Services and/or with BlazeDS.

              ATTA
              • 4. Re: Flex and J2EE
                FlexAgileDev Level 1
                Is the "Flex compiler module for J2EE application servers" available as open source?

                I looked in Adobe's Subversion repository but I can't find any code for the J2EE Flex compiler module:

                http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/modules/compiler/src/java/


                • 5. Flex and J2EE
                  FlexAgileDev Level 1
                  In Flex 1.5 and Flex 2, there was a FlexMxmlServlet that you could use in your application's web.xml file:

                  http://livedocs.adobe.com/flex/15/flex_docs_en/wwhelp/wwhimpl/common/html/wwhelp.htm?conte xt=Flex_Documentation&file=00000903.htm

                  http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/ wwhelp.htm?context=LiveDocs_Parts&file=services_config_7.html

                  What happened to the FlexMxmlServlet? Does Flex 3 support/provide the FlexMxmlServlet?
                  • 6. Re: Flex and J2EE
                    FlexAgileDev Level 1
                    I am still looking for information about the FlexMxmlServlet and Flex 3.

                    Did Adobe remove the FlexMxmlServlet from Flex 3?

                    • 7. Re: Flex and J2EE
                      FlexAgileDev Level 1
                      I found the FlexMxmlServlet.

                      1) visit http://opensource.adobe.com/wiki/display/flexsdk/Downloads
                      2) download: FlexModule_j2ee.zip

                      The zip file contains the FlexMxmlServlet and a Flex JSP Tag Library.

                      Curiously, I can't find the source code for the FlexMxmlServlet or the Flex JSP Tag Library. I looked in Adobe's Subversion repository but the code is not there.

                      Anyway, here is a web.xml file that shows how to use the servlet and the tag library:



                      <?xml version="1.0" encoding="UTF-8"?>
                      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" " http://java.sun.com/dtd/web-app_2_3.dtd">
                      <web-app>

                      <display-name>Flex Webtier Compiler</display-name>
                      <description>Flex SDK Webtier Compiler Template Application</description>

                      <context-param>
                      <param-name>flex.class.path</param-name>
                      <param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
                      </context-param>

                      <servlet>
                      <servlet-name>FlexMxmlServlet</servlet-name>
                      <display-name>MXML Processor</display-name>
                      <description>Servlet wrapper for the Mxml Compiler</description>
                      <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
                      <init-param>
                      <param-name>servlet.class</param-name>
                      <param-value>flex.webtier.server.j2ee.MxmlServlet</param-value>
                      </init-param>
                      <init-param>
                      <param-name>webtier.configuration.file</param-name>
                      <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value>
                      </init-param>
                      <load-on-startup>1</load-on-startup>
                      </servlet>

                      <servlet>
                      <servlet-name>FlexSwfServlet</servlet-name>
                      <display-name>SWF Retriever</display-name>
                      <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
                      <init-param>
                      <param-name>servlet.class</param-name>
                      <param-value>flex.webtier.server.j2ee.SwfServlet</param-value>
                      </init-param>
                      <!-- SwfServlet must be initialized after MxmlServlet -->
                      <load-on-startup>2</load-on-startup>
                      </servlet>

                      <servlet>
                      <servlet-name>FlexForbiddenServlet</servlet-name>
                      <display-name>Prevents access to *.as/*.swc files</display-name>
                      <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
                      <init-param>
                      <param-name>servlet.class</param-name>
                      <param-value>flex.webtier.server.j2ee.ForbiddenServlet</param-value>
                      </init-param>
                      </servlet>

                      <servlet>
                      <servlet-name>FlexInternalServlet</servlet-name>
                      <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
                      <init-param>
                      <param-name>servlet.class</param-name>
                      <param-value>flex.webtier.server.j2ee.filemanager.FileManagerServlet</param-value>
                      </init-param>
                      <load-on-startup>10</load-on-startup>
                      </servlet>

                      <servlet-mapping>
                      <servlet-name>FlexMxmlServlet</servlet-name>
                      <url-pattern>*.mxml</url-pattern>
                      </servlet-mapping>

                      <servlet-mapping>
                      <servlet-name>FlexSwfServlet</servlet-name>
                      <url-pattern>*.swf</url-pattern>
                      </servlet-mapping>

                      <servlet-mapping>
                      <servlet-name>FlexForbiddenServlet</servlet-name>
                      <url-pattern>*.as</url-pattern>
                      </servlet-mapping>

                      <servlet-mapping>
                      <servlet-name>FlexForbiddenServlet</servlet-name>
                      <url-pattern>*.swc</url-pattern>
                      </servlet-mapping>

                      <servlet-mapping>
                      <servlet-name>FlexInternalServlet</servlet-name>
                      <url-pattern>/flex-internal/*</url-pattern>
                      </servlet-mapping>

                      <welcome-file-list>
                      <welcome-file>index.html</welcome-file>
                      <welcome-file>index.htm</welcome-file>
                      </welcome-file-list>

                      <taglib>
                      <taglib-uri>FlexTagLib</taglib-uri>
                      <taglib-location>/WEB-INF/lib/flex-bootstrap-jsp.jar</taglib-location>
                      </taglib>

                      </web-app>