- Revision
- 161
- Author
- mauro
- Date
- 2007-06-19 10:04:32 -0500 (Tue, 19 Jun 2007)
Log Message
Fixed XSite generation errors.
Modified Paths
- trunk/distribution2/src/content/action-methods.html
- trunk/distribution2/src/content/examples.html
- trunk/distribution2/src/content/simple-calculator.html
- trunk/distribution2/src/content/website.xml
Property Changed
- trunk/distribution2/
Diff
Property changes: trunk/distribution2
Name: svn:ignore
+ target
Modified: trunk/distribution2/src/content/action-methods.html (160 => 161)
--- trunk/distribution2/src/content/action-methods.html 2007-06-19 13:26:23 UTC (rev 160) +++ trunk/distribution2/src/content/action-methods.html 2007-06-19 15:04:32 UTC (rev 161) @@ -1,14 +1,5 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - - - - - - - - <html> <head> <title>Waffle - ActionMethods</title> @@ -32,8 +23,10 @@ public void removeFromCart(long itemId, int quantity) { cart.remove(itemId, quantity); } -}</pre></div><div class="section"><h3>Pragma-driven ActionMethod argument resolution</h3><p>Waffle can automatically convert the String values received into their correct type (i.e. String => Integer). However, this does <b>not</b> mean that ActionMethod can only be passed simple types like Strings, Numbers and Booleans. Many times a developer wants, or needs, to have access to either the <i>javax.servlet.http.HttpServletRequest</i>, <i>javax.servlet.http.HttpServletResponse</i> or <i>javax.servlet.http.HttpSession</i>. Waffle provides a simple way to handle this, if your ActionMethods have any of these type as a dependency they will <b>automatically</b> be injected.</p><p>And it does not stop there! Waffle allows you to directly reference parameters and attributes by name, in either the <b>HttpServletRequest</b> (parameter or attribute), <b>HttpSession</b> or <b>ServletContext</b>. So imagine we want to call the <b>addToCart(long, int)</b> ActionMethod in the ShoppingCartController class above. We could pass the values directly or let Waffle try and resolve them by name. Take a look at html snippet below, it demonstrates 3 simple ways to pragmatically invoke the same ActionMethod:</p><div class="source"><pre><a href="" football</a> +}</pre></div> + <div class="section"><h3>Pragma-driven ActionMethod argument resolution</h3><p>Waffle can automatically convert the String values received into their correct type (i.e. String => Integer). However, this does <b>not</b> mean that ActionMethod can only be passed simple types like Strings, Numbers and Booleans. Many times a developer wants, or needs, to have access to either the <i>javax.servlet.http.HttpServletRequest</i>, <i>javax.servlet.http.HttpServletResponse</i> or <i>javax.servlet.http.HttpSession</i>. Waffle provides a simple way to handle this, if your ActionMethods have any of these type as a dependency they will <b>automatically</b> be injected.</p><p>And it does not stop there! Waffle allows you to directly reference parameters and attributes by name, in either the <b>HttpServletRequest</b> (parameter or attribute), <b>HttpSession</b> or <b>ServletContext</b>. So imagine we want to call the <b>addToCart(long, int)</b> ActionMethod in the ShoppingCartController class above. We could pass the values directly or let Waffle try and resolve them by name. Take a look at html snippet below, it demonstrates 3 simple ways to pragmatically invoke the same ActionMethod:</p><div class="source"><pre><a href="" football</a> + <input type="button" value="Buy football" <a href="" football</a></pre></div><p>Notice that the second argument <b>{quantity}</b> is wrapped between curly brackets which signals that Waffle will need to resolve its actual value. Waffle will search each each of the following (in order) until the value is found, otherwise <i>null</i> will be returned:</p><ol type="1"><li>HttpServletRequest Parameter (HttpServletRequest.getParameter("quantity"))</li><li>HttpServletRequest Attribute (HttpServletRequest.getAttribute("quantity"))</li><li>HttpSession Attribute (HttpSession.getAttribute("quantity"))</li><li>ServletContext Attribute (ServletContext.getAttribute("quantity"))</li><li>return null</li></ol><p>The first value <b>54</b> is not wrapped in curly brackets so Waffle will use that value directly with ActionMethod. Waffle attempts to automatically convert String values when applicable, so the first argument passed to the method will be converted to a primitive <i>Long</i>.</p><dl><dt>Note:</dt><dd>Use this _javascript_ to dynamically add a "method" parameter to your form before submitting the form.<div class="source"><pre>function fireMethod(methodName) { @@ -90,7 +83,7 @@ } ... -}</pre></div><dl><dt>Note:</dt><dd>DefaultActionMethod annotations are also used when utilizing ParaNamer. They are needed so Waffle can handle requests when no ActionMethod has been signalled.</dd></dl></div><div class="section"><h3>ActionMethod return types</h3><p>Waffle will react differently depending on what is returned, or thrown, from an <b>ActionMethod</b> after it has been invoked. Below we define define how each case is handled in the Waffle framework:</p><ul><li><b>View</b> - An ActionMethod which returns an instance of <i>org.codehaus.waffle.view.View</i> or <i>org.codehaus.waffle.view.RedirectView</i> will forward or redirect, respectively. By default Waffle assumes that each View defines the full URL the user is to be sent to. This behavior can be altered by definning a different implementation of the <i>org.codehaus.waffle.view.ViewResolver</i>. Waffle was built to be pluggable this is the first example of how Waffle components can be customized and configured. Read the section on <a href="" pluggability</a> for further details.</li><li><b>null or void</b> - When an ActionMethod has a return type of <i>void</i> or when your ActionMethod returns a <i>null</i> Waffle will simply redirect back to the referring page.</li><li><b>Exception</b> - When an exception is thrown Waffle will set the response status to 400 (BAD REQUEST) and then send the contents of the message directly to the requestor. This functionality is especially useful when handling Ajax type of requests.</li><li><b>Other</b> - All other objects will have their toString() method called and the resulting value will be sent back to the requestor. This is similar to how Exceptions are handled, without the response status being set to an error code. This is useful for Ajax type of requests. Imagine these type of ActionMethod returning HTML or JSON messages directly.</li></ul></div><div class="section"><h3>Caveat: Ambiguous methods</h3><p>Waffle determines which ActionMethod to invoke by examining the Controller with reflection. If your Controller contains an overloaded method (same name and same number of arguments) Waffle may not be able to determine which ActionMethod should be fired. For example assume you have the following two methods defined in an Controller:</p><div class="source"><pre>public void save(String name, Object object); +}</pre></div><dl><dt>Note:</dt><dd>DefaultActionMethod annotations are also used when utilizing ParaNamer. They are needed so Waffle can handle requests when no ActionMethod has been signalled.</dd></dl></div><div class="section"><h3>ActionMethod return types</h3><p>Waffle will react differently depending on what is returned, or thrown, from an <b>ActionMethod</b> after it has been invoked. Below we define define how each case is handled in the Waffle framework:</p><ul><li><b>View</b> - An ActionMethod which returns an instance of <i>org.codehaus.waffle.view.View</i> or <i>org.codehaus.waffle.view.RedirectView</i> will forward or redirect, respectively. By default Waffle assumes that each View defines the full URL the user is to be sent to. This behavior can be altered by definning a different implementation of the <i>org.codehaus.waffle.view.ViewResolver</i>. Waffle was built to be pluggable this is the first example of how Waffle components can be customized and configured. Read the section on <a href="" pluggability</a> for further details.</li><li><b>null or void</b> - When an ActionMethod has a return type of <i>void</i> or when your ActionMethod returns a <i>null</i> Waffle will simply redirect back to the referring page.</li><li><b>Exception</b> - When an exception is thrown Waffle will set the response status to 400 (BAD REQUEST) and then send the contents of the message directly to the requestor. This functionality is especially useful when handling Ajax type of requests.</li><li><b>Other</b> - All other objects will have their toString() method called and the resulting value will be sent back to the requestor. This is similar to how Exceptions are handled, without the response status being set to an error code. This is useful for Ajax type of requests. Imagine these type of ActionMethod returning HTML or JSON messages directly.</li></ul></div><div class="section"><h3>Caveat: Ambiguous methods</h3><p>Waffle determines which ActionMethod to invoke by examining the Controller with reflection. If your Controller contains an overloaded method (same name and same number of arguments) Waffle may not be able to determine which ActionMethod should be fired. For example assume you have the following two methods defined in an Controller:</p><div class="source"><pre>public void save(String name, Object object); public void save(String color, Map dictionary);</pre></div><p>Attempting to invoke the ActionMethod <b>method=save|hello|{dictionary}</b> will cause an <i>AmbiguousMethodSignatureException</i> to be thrown because Waffle will not be able to determine which of the <i>save</i> methods should be invoked. However, the ActionMethod <b>method=save|foo|bar</b> will invoke the first <i>save</i> method, <b>void save(String, Object)</b>, without incident. Why? Because the String value "bar" is not assignable (and cannot be automatically converted) to the <i>Map</i> class, so no ambiguity will exist.</p></div><div class="section"><h3>Method Interceptor</h3><p>Waffle also allows you to implement custom <i>MethodInterceptor</i>s that can "intercept" calls to ActionMethods. This allows you to do pre and post processing on ActionMethods (allowing for simple AOP type of functionality). MethodInterceptor can also be chained together cleanly and easily. See the <a href="" Interceptors</a> for further details.</p></div></div> </div> </div>
Modified: trunk/distribution2/src/content/examples.html (160 => 161)
--- trunk/distribution2/src/content/examples.html 2007-06-19 13:26:23 UTC (rev 160) +++ trunk/distribution2/src/content/examples.html 2007-06-19 15:04:32 UTC (rev 161) @@ -6,7 +6,7 @@ <body class="composite"> <div id="bodyColumn"> <div id="contentBox"> - <div class="section"><h2>We have three examples:</h2><div class="section"><h3>Simple</h3><p>Source: <a href="" example has four built in mini-apps:</p><p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p><p>Waffle, for this example, uses a 'pragma' style of method encoding (the way web methods are mapped to Java ones).</p></div><div class="section"><h3>Paranamer</h3><p>Source: <a href="" example has four built in mini-apps:</p><p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p><p>Waffle, for this example, uses a 'Paranamer' for method encoding, resulting in smaller URLs, and more 'convention-based' design</p></div><div class="section"><h3>Paranamer + FreeMarker + Sitemesh</h3><p>Source: <a href="" only contains the People app that the Paranamer example above had.</p><p>It renders the page with <a href="" rather than JSP.</p><p>This allows for us to edit the pages in Adobe's Dreamweaver without additional plugins in a WYSIWYG way.</p><p>It also decorates everything with <a href="" though (0 lines of additional Java)</p><p>This allows us to separate the site's styling and navigation from content.</p></div></div> + <div class="section"><h2>We have three examples:</h2><div class="section"><h3>Simple</h3><p>Source: <a href="" example has four built in mini-apps:</p><p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p><p>Waffle, for this example, uses a 'pragma' style of method encoding (the way web methods are mapped to Java ones).</p></div><div class="section"><h3>Paranamer</h3><p>Source: <a href="" example has four built in mini-apps:</p><p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p><p>Waffle, for this example, uses a 'Paranamer' for method encoding, resulting in smaller URLs, and more 'convention-based' design</p></div><div class="section"><h3>Paranamer + FreeMarker + Sitemesh</h3><p>Source: <a href="" only contains the People app that the Paranamer example above had.</p><p>It renders the page with <a href="" rather than JSP.</p><p>This allows for us to edit the pages in Adobe's Dreamweaver without additional plugins in a WYSIWYG way.</p><p>It also decorates everything with <a href="" though (0 lines of additional Java)</p><p>This allows us to separate the site's styling and navigation from content.</p></div></div> </div> </div>
Modified: trunk/distribution2/src/content/simple-calculator.html (160 => 161)
--- trunk/distribution2/src/content/simple-calculator.html 2007-06-19 13:26:23 UTC (rev 160) +++ trunk/distribution2/src/content/simple-calculator.html 2007-06-19 15:04:32 UTC (rev 161) @@ -33,7 +33,7 @@ public void session() { register("calculator", CalculatorController.class); } -}</pre></div></div><div class="section"><h3>View: calculator.jspx</h3><p>The jspx code below is not very exciting however notice lines <b>43 - 45</b>. These 3 lines demonstrate different ways to invoke an ActionMethod. Line 43 <b>add|<a name="firstNumber">firstNumber</a>|<a name="secondNumber">secondNumber</a></b> pragmatically defines how the method arguments should be resolved. See the <a href="" documentation">action-methods.html}ActionMethod documentation</a> for complete details.</p><div class="source"><pre><?xml version="1.0" encoding="UTF-8"?> +}</pre></div></div><div class="section"><h3>View: calculator.jspx</h3><p>The jspx code below is not very exciting however notice lines <b>43 - 45</b>. These 3 lines demonstrate different ways to invoke an ActionMethod. Line 43 <b>add|<a name="firstNumber">firstNumber</a>|<a name="secondNumber">secondNumber</a></b> pragmatically defines how the method arguments should be resolved. See the <a href="" documentation</a> for complete details.</p><div class="source"><pre><?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core">
Modified: trunk/distribution2/src/content/website.xml (160 => 161)
--- trunk/distribution2/src/content/website.xml 2007-06-19 13:26:23 UTC (rev 160) +++ trunk/distribution2/src/content/website.xml 2007-06-19 15:04:32 UTC (rev 161) @@ -8,9 +8,11 @@ <section> <name>About Waffle</name> <page>list-dev.html</page> - <page>team.html</page> - <page>repository.html</page> + <page>team-list.html</page> + <page>source-repository.html</page> </section> + <section> + <name>Developing with Waffle</name> <page>action-controllers.html</page> <page>action-methods.html</page> <page>interceptors.html</page> @@ -40,7 +42,7 @@ </section> <section> <name>Misc...</name> - <link title="Javadoc">javadoc/index.html</page> + <link title="Javadoc">javadoc/index.html</link> <page>testing.html</page> <page>best-practices.html</page> </section>
To unsubscribe from this list please visit:
