CVS: Tapestry/framework/src/net/sf/tapestry/engine AbstractEngine.java,1.34.2.5,1.34.2.6

Howard Lewis Ship <[email protected]>
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/engine
In directory sc8-pr-cvs1:/tmp/cvs-serv8557/framework/src/net/sf/tapestry/engine

Modified Files:
      Tag: hship-2-3
	AbstractEngine.java 
Log Message:
Change Form to record allocated element ids as a hidden field, and compare against it when the form is submitted.
Change StaleLink page to display the message from the StaleLinkException.

Index: AbstractEngine.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/engine/AbstractEngine.java,v
retrieving revision 1.34.2.5
retrieving revision 1.34.2.6
diff -C2 -d -r1.34.2.5 -r1.34.2.6
*** AbstractEngine.java	19 Dec 2002 12:27:00 -0000	1.34.2.5
--- AbstractEngine.java	21 Dec 2002 13:05:46 -0000	1.34.2.6
***************
*** 362,366 ****
              IPage exceptionPage = cycle.getPage(EXCEPTION_PAGE);
  
!             OgnlUtils.set("exception", _resolver, exceptionPage, cause);
  
              cycle.setPage(exceptionPage);
--- 362,366 ----
              IPage exceptionPage = cycle.getPage(EXCEPTION_PAGE);
  
!             setProperty(exceptionPage, "exception", cause);
  
              cycle.setPage(exceptionPage);
***************
*** 838,842 ****
       *  Invoked by {@link #service(RequestContext)} if a {@link StaleLinkException}
       *  is thrown by the {@link IEngineService service}.  This implementation
!      *  invokes 
       *  {@link #redirect(String, IRequestCycle, ResponseOutputStream, RequestCycleException)}
       *  to render the StaleLink page.
--- 838,844 ----
       *  Invoked by {@link #service(RequestContext)} if a {@link StaleLinkException}
       *  is thrown by the {@link IEngineService service}.  This implementation
!      *  sets the message property of the StaleLink page to the
!      *  message provided in the exception,
!      *  then invokes 
       *  {@link #redirect(String, IRequestCycle, ResponseOutputStream, RequestCycleException)}
       *  to render the StaleLink page.
***************
*** 844,851 ****
       *  <p>Subclasses may overide this method (without
       *  invoking this implementation).  A common practice
!      *  is to present an eror message on the application's
       *  Home page.	
       *
       *  @since 0.2.10
       **/
  
--- 846,861 ----
       *  <p>Subclasses may overide this method (without
       *  invoking this implementation).  A common practice
!      *  is to present an error message on the application's
       *  Home page.	
+      * 
+      *  <p>Alternately, the application may provide its own version of 
+      *  the StaleLink page, overriding
+      *  the framework's implementation (probably a good idea, because the
+      *  default page hints at "application errors" and isn't localized).  
+      *  The overriding StaleLink implementation must
+      *  implement a message property of type String.
       *
       *  @since 0.2.10
+      * 
       **/
  
***************
*** 853,856 ****
--- 863,871 ----
          throws IOException, ServletException, RequestCycleException
      {
+                 IPage page = cycle.getPage(STALE_LINK_PAGE);
+         
+         setProperty(page, "message", ex.getMessage());
+         
+  
          redirect(STALE_LINK_PAGE, cycle, output, ex);
      }
***************
*** 877,881 ****
          throws IOException, ServletException, RequestCycleException
      {
!         redirect(STALE_SESSION_PAGE, cycle, output, ex);
      }
  
--- 892,896 ----
          throws IOException, ServletException, RequestCycleException
      {
!        redirect(STALE_SESSION_PAGE, cycle, output, ex);
      }
  
***************
*** 1858,1861 ****
--- 1873,1887 ----
  
          return result;
+     }
+ 
+     /**
+      *  Sets a property of an object; this is used to initalize properties
+      *  of the Exception and StaleSession pages.
+      * 
+      **/
+ 
+     protected void setProperty(Object object, String propertyName, Object value)
+     {
+         OgnlUtils.set(propertyName, _resolver, object, value);
      }
  



-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.