Using Cocoon 2.2 Vadim Gritsenko - http://blog.reverycodes.com/ - http://agilepartners.com/blog/ Using Cocoon 2.2 The Classic Way Vadim Gritsenko - http://blog.reverycodes.com/ - http://agilepartners.com/blog/ If you use Cocoon 2.1: In multiple software projects Built multiple reusable, shared software modules Have standardized directory structure, build, deployment processes... If you think of Cocoon 2.2: Ant has been replaced with Maven LogKit has been replaced by Log4J Avalon is being replaced by Spring Framework ‘Real Blocks’ are almost here No downloads (so far) If you think of Cocoon 2.2: Ant has been replaced with Maven LogKit has been replaced by Log4J Avalon is being replaced by Spring Framework ‘Real Blocks’ are almost here No downloads (so far) You don’t have to start from scratch! It’s not that scary. Ant has been replaced with Maven You don’t have to use it. LogKit has been replaced by Log4J You don’t have to use it. Avalon is being replaced by Spring Framework You don’t have to use it. No downloads (so far) Oops... You’d have to use Maven for that... So how does it look? Your Application sitemap.xmap Components Sitemap cocoon.xconf Avalon Bridge Pipelines Spring Framework applicationContext.xml Web Application web.xml Building Cocoon $ svn co http://svn.apache.org/repos/ Install latest asf/cocoon/trunk cocoon maven 2 U cocoon Checked out revision 577959. Check out code from the svn $ mvn -P allblocks install java.lang.OutOfMemoryError: Java heap repository space Start maven build process Get coffee or beer (might take a while) Building Cocoon $ svn co http://svn.apache.org/repos/ Install latest asf/cocoon/trunk cocoon maven 2 U cocoon Checked out revision 577959. Check out code from the svn $ mvn -P allblocks install java.lang.OutOfMemoryError: Java heap repository space Start maven $ export MAVEN_OPTS=-Xmx256m build process $ mvn -Dmaven.test.skip=true -P allblocks install Get coffee or [INFO] BUILD SUCCESSFUL beer (might take a while) Building Cocoon ...but only if you want it! $ svn co http://svn.apache.org/repos/ Install latest asf/cocoon/trunk cocoon maven 2 U cocoon Checked out revision 577959. Check out code from the svn $ mvn -P allblocks install java.lang.OutOfMemoryError: Java heap repository space Start maven $ export MAVEN_OPTS=-Xmx256m build process $ mvn -Dmaven.test.skip=true -P allblocks install Get coffee or [INFO] BUILD SUCCESSFUL beer (might take a while) Selecting Blocks No more local.build.properties No more local.blocks.properties Use maven pom.xml file to select blocks Need to set a version for each block More typing but similar in nature Selecting Blocks <?xml version="1.0"<version>1.0.0-RC2-SNAPSHOT</version><artifactId>cocoon-fop-ng-impl</artifactId> encoding="UTF-8"?> </dependency> <version>1.0.0-SNAPSHOT</version> <project <dependency></dependency> xmlns="http://maven.apache.org/POM/4.0.0" No more <dependency> <groupId>org.apache.cocoon</groupId> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <artifactId>cocoon-forms-impl</artifactId><groupId>org.apache.cocoon</groupId> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 local.build.properties http://maven.apache.org/maven-v4_0_0.xsd <version>1.0.0-RC1-SNAPSHOT</version><artifactId>cocoon-poi-impl</artifactId>"> <modelVersion>4.0.0</modelVersion> </dependency> <version>1.0.0-SNAPSHOT</version> <groupId>org.reverycodes</groupId> </dependency> No more <artifactId>my-cocoon-webapp</artifactId> <dependency> <version>1.0.1-SNAPSHOT</version> ... <groupId>org.apache.cocoon</groupId> local.blocks.properties <packaging>war</packaging> <artifactId>cocoon-databases-impl</artifactId> <name>My </dependencies> <version>1.0.0-RC2-SNAPSHOT</version> Cocoon Webapp</name> </project> </dependency> Use maven pom.xml <build> <dependency> <finalName>my-cocoon-webapp</finalName> <groupId>org.apache.cocoon</groupId> </build> <artifactId>cocoon-repository-impl</artifactId> file to select blocks <version>1.0.0-SNAPSHOT</version> <dependencies> </dependency> <dependency> Need to set a version <dependency> <groupId>org.apache.cocoon</groupId> <artifactId>cocoon-core</artifactId><groupId>org.apache.cocoon</groupId> for each block <version>2.2.0-RC2-SNAPSHOT</version><artifactId>cocoon-batik-impl</artifactId> </dependency> <version>1.0.0-RC2-SNAPSHOT</version> <dependency></dependency> More typing but <dependency> <groupId>org.apache.cocoon</groupId> <artifactId>cocoon-template-impl</artifactId><groupId>org.apache.cocoon</groupId> similar in nature Assembling Cocoon $ ls pom.xml Install latest maven 2 $ export MAVEN_OPTS=-Xmx256m Start maven $ mvn war:war build process [INFO] BUILD SUCCESSFUL Get coffee or $ ls target beer (might take my-cocoon-webapp/ my-cocoon-webapp.war a while) Gets faster on subsequent runs Assembling Cocoon $ lsfind . -type f pom.xml./pom.xml Install latest ./src/main/webapp/WEB-INF/web.xml maven 2 $ export MAVEN_OPTS=-Xmx256m Start maven $ mvn war:war build process [INFO] BUILD SUCCESSFUL Get coffee or $ ls target beer (might take my-cocoon-webapp/ my-cocoon-webapp.war a while) Gets faster on subsequent runs Updating Webapp web.xml applicationContext.xml core.xml cocoon.xconf sitemap.xmap WEB-INF/lib Updating web.xml <!-- Servlet 2.4 - Web application configuration. --> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"> Updating web.xml <!-- Servlet 2.4 - WebDeclare application a filter configuration. for multipart MIME handling --> MIME Multipart <web-app<filter> xmlns="http://java.sun.com/xml/ns/j2ee" <description> version="2.4"> Servlet Filter Multipart MIME handling filter for Cocoon </description> <display-name> Cocoon multipart filter </display-name> <filter-name>CocoonMultipartFilter</filter-name> <filter-class> org.apache.cocoon.servlet.multipart.MultipartFilter </filter-class> </filter> Updating web.xml <!-- Servlet 2.4 - WebDeclareUse applicationthe aCocoon filter multipartconfiguration. for multipart filter MIME together handling with the --> Cocoon servlet MIME Multipart <web-app<filter> --> xmlns="http://java.sun.com/xml/ns/j2ee" <filter-mapping> <description> version="2.4"> Servlet Filter <filter-name>CocoonMultipartFilter</filter-name> Multipart MIME handling filter for Cocoon </description><servlet-name>Cocoon</servlet-name> </filter-mapping> <display-name> Filter Mapping Cocoon multipart filter </display-name> <filter-name>CocoonMultipartFilter</filter-name> <filter-class> org.apache.cocoon.servlet.multipart.MultipartFilter </filter-class> </filter> Updating web.xml <!-- Servlet 2.4 - WebDeclareUseSpring applicationthe requestaCocoon filter multipartlistenerconfiguration. for multipart ...filter MIME together handling with the --> Cocoon servlet MIME Multipart <web-app<filter> <listener> --> xmlns="http://java.sun.com/xml/ns/j2ee" <filter-mapping> <description><listener-class> version="2.4"> Servlet Filter org.springframework.web.context.request.RequestConte <filter-name>CocoonMultipartFilter</filter-name> Multipart MIME handling filter for Cocoon xtListener </description><servlet-name>Cocoon</servlet-name> </filter-mapping> <display-name></listener-class> Filter Mapping </listener> Cocoon multipart filter </display-name> Context <!-- <filter-name>CocoonMultipartFilter</filter-name> <filter-class>- Spring context listener ... Listeners org.apache.cocoon.servlet.multipart.MultipartFilter --> <listener> </filter-class> </filter> <listener-class> org.springframework.web.context.ContextLoaderListene r </listener-class> Updating web.xml <!-- Servlet 2.4 - WebDeclareUseSpring applicationthe requestaCocoonClassic filter multipartlistenerconfiguration. Cocoonfor multipart servlet ...filter MIME together handling with the --> Cocoon servlet MIME Multipart <web-app<filter> <listener><servlet> --> xmlns="http://java.sun.com/xml/ns/j2ee" <filter-mapping> <description><listener-class><servlet-name>Cocoon</servlet-name> version="2.4"> Servlet Filter org.springframework.web.context.request.RequestConte <filter-name>CocoonMultipartFilter</filter-name><display-name>Cocoon</display-name> Multipart MIME handling filter for Cocoon xtListener </description><servlet-name>Cocoon</servlet-name><description>Classic Cocoon Servlet</description> </filter-mapping> <display-name></listener-class><servlet-class> Filter Mapping </listener>org.apache.cocoon.servlet.SitemapServlet Cocoon multipart filter </display-name></servlet-class> Context <!-- <filter-name>CocoonMultipartFilter</filter-name><load-on-startup>5</load-on-startup> </servlet> <filter-class>- Spring context listener ... Listeners org.apache.cocoon.servlet.multipart.MultipartFilter --> <listener> </filter-class> and Cocoon </filter> <listener-class> org.springframework.web.context.ContextLoaderListene Servlet! r </listener-class> Complete web.xml <!-- - Web application configuration. --> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"> <!-- - Declare a filter for multipart MIME handling --> <filter> <description>Multipart MIME handling filter for Cocoon</description> <display-name>Cocoon multipart filter</display-name> <filter-name>CocoonMultipartFilter</filter-name> <filter-class>org.apache.cocoon.servlet.multipart.MultipartFilter</filter-class> </filter> <!-- - Declare a filter for debugging incoming request --> <filter> Debug filter <description>Log debug information about each request</description> <display-name>Cocoon debug filter</display-name> <filter-name>CocoonDebugFilter</filter-name> <filter-class>org.apache.cocoon.servlet.DebugFilter</filter-class> </filter> <!-- - Use the Cocoon multipart filter together with the Cocoon servlet --> <filter-mapping>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages36 Page
-
File Size-