tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/form Form.java
Date Fri, 03 Dec 2004 22:28:10 GMT
hlship      2004/12/03 14:28:10

  Modified:    framework/src/scripts TestLocalization.xml TestBlock.xml
                        TestTemplateEncoding.xml TestOutputEncoding.xml
                        TestAutoLongParameter.xml TestValidate.xml
                        TestPersistentProperties.xml TestSpecDelegate.xml
                        TestSimple.xml TestStaleSessionException.xml
                        TestLibrary.xml TestWMLStaleSession.xml
                        TestLinkRenderers.xml TestRedirect.xml
                        TestProtectedLink.xml TestReset.xml
                        TestAutoParameters.xml TestListenerBinding.xml
                        TestPropertySpecification.xml TestExternal.xml
               framework/src/test/org/apache/tapestry/junit
                        TestEngineServiceLink.java
               framework/src/java/org/apache/tapestry/engine ILink.java
                        EngineServiceLink.java
               framework/src/java/org/apache/tapestry/services/impl
                        LinkFactoryImpl.java
               framework build.xml
               .        .classpath
               framework/src/java/org/apache/tapestry/form Form.java
  Log:
  More refactoring of EngineServiceLink; parameters are now more uniformly treated (and encoded).
  
  Revision  Changes    Path
  1.2       +3 -3      jakarta-tapestry/framework/src/scripts/TestLocalization.xml
  
  Index: TestLocalization.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestLocalization.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestLocalization.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestLocalization.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -76,7 +76,7 @@
   		
   		<assert-output name="DirectLink switch URL">
   <![CDATA[		
  -href="/mock/app?service=direct/0/Assets/switch"
  +href="/mock/app?service=direct%2F0%2FAssets%2Fswitch"
   ]]>
   		</assert-output>	
   	</request>
  @@ -96,7 +96,7 @@
   		
   		<assert-output name="DirectLink switch URL still stateless">
   <![CDATA[		
  -href="/mock/app?service=direct/0/Assets/switch"
  +href="/mock/app?service=direct%2F0%2FAssets%2Fswitch"
   ]]>
   		</assert-output>							
   	</request>	
  @@ -118,7 +118,7 @@
   
   		<assert-output name="DirectLink switch URL still stateless">
   <![CDATA[		
  -href="/mock/app?service=direct/0/Home/link&amp;sp=2&amp;sp=d3.5&amp;sp=SHello"
  +href="/mock/app?service=direct%2F0%2FHome%2Flink&amp;sp=2&amp;sp=d3.5&amp;sp=SHello"
   ]]>
   		</assert-output>			
   	</request>
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/scripts/TestBlock.xml
  
  Index: TestBlock.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestBlock.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestBlock.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestBlock.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -45,13 +45,13 @@
   		
   		<assert-output name="Direct URL">
   <![CDATA[
  -href="/c5/app?service=direct/1/Home/DirectLinkHolder/$DirectLink"
  +href="/c5/app?service=direct%2F1%2FHome%2FDirectLinkHolder%2F%24DirectLink"
   ]]>
   		</assert-output>		
   
   		<assert-output name="Action URL">
   <![CDATA[
  -href="/c5/app?service=action/1/Home/0/ActionLinkHolder/$ActionLink"
  +href="/c5/app?service=action%2F1%2FHome%2F0%2FActionLinkHolder%2F%24ActionLink"
   ]]>
   		</assert-output>
   			
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestTemplateEncoding.xml
  
  Index: TestTemplateEncoding.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestTemplateEncoding.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestTemplateEncoding.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestTemplateEncoding.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -38,7 +38,7 @@
   
   		<assert-output name="External Link">
   <![CDATA[
  -<a href="/c28/app?service=external/Two&amp;sp=SFran%C3%A7ais">
  +<a href="/c28/app?service=external%2FTwo&amp;sp=SFran%C3%A7ais">
   ]]>
   		</assert-output>
   	</request>
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestOutputEncoding.xml
  
  Index: TestOutputEncoding.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestOutputEncoding.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestOutputEncoding.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestOutputEncoding.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -71,7 +71,7 @@
   
   		<assert-output name="External Link">
   <![CDATA[
  -<a href="/c28/latin1?service=external/Two&amp;sp=SFran%E7ais">
  +<a href="/c28/latin1?service=external%2FTwo&amp;sp=SFran%E7ais">
   ]]>
   		</assert-output>
   	</request>
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestAutoLongParameter.xml
  
  Index: TestAutoLongParameter.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestAutoLongParameter.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestAutoLongParameter.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestAutoLongParameter.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -27,7 +27,7 @@
       </assert-output>	
     	
     	<assert-output name="Link">
  -			href="/c35/app?service=direct/0/Home/c.l"
  +			href="/c35/app?service=direct%2F0%2FHome%2Fc.l"
     	</assert-output>
     	
     </request>
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestValidate.xml
  
  Index: TestValidate.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestValidate.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestValidate.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestValidate.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -38,7 +38,7 @@
   		
   		<assert-output name="Link URL">
   <![CDATA[
  -href="/mock/app?service=direct/1/Guard/link"
  +href="/mock/app?service=direct%2F1%2FGuard%2Flink"
   ]]>
   		</assert-output>
   		
  
  
  
  1.2       +3 -3      jakarta-tapestry/framework/src/scripts/TestPersistentProperties.xml
  
  Index: TestPersistentProperties.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestPersistentProperties.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPersistentProperties.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestPersistentProperties.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -40,7 +40,7 @@
   			
   		<assert-output name="Change Message Link">
   <![CDATA[		
  -/c6/app?service=direct/0/Home/$DirectLink		
  +/c6/app?service=direct%2F0%2FHome%2F%24DirectLink	
   ]]>
   		</assert-output>				
   		
  @@ -130,7 +130,7 @@
   			
   		<assert-output name="Change Message Link">
   <![CDATA[		
  -/c6/app?service=direct/1/Two/$Nested.$DirectLink		
  +/c6/app?service=direct%2F1%2FTwo%2F%24Nested.%24DirectLink	
   ]]>
   		</assert-output>				
   
  @@ -256,7 +256,7 @@
    		
    		<assert-output name="Create Link">
   <![CDATA[
  -/c6/app?service=direct/1/Four/$DirectLink
  +/c6/app?service=direct%2F1%2FFour%2F%24DirectLink
   ]]>	
   		</assert-output>
   		
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestSpecDelegate.xml
  
  Index: TestSpecDelegate.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestSpecDelegate.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSpecDelegate.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestSpecDelegate.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -28,7 +28,7 @@
   		</assert-output>
   		
   		<assert-output name="Link">
  -href="/c22/app?service=direct/0/Home/start"
  +href="/c22/app?service=direct%2F0%2FHome%2Fstart"
   		</assert-output>	
   		
   	</request>
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/scripts/TestSimple.xml
  
  Index: TestSimple.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestSimple.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSimple.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestSimple.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -64,7 +64,7 @@
     
     	 <assert-output name="Link to page Two">
   <![CDATA[
  -	<a href="/junit/simple?service=page/Two">to page Two</a>
  +	<a href="/junit/simple?service=page%2FTwo">to page Two</a>
   ]]>
     	 </assert-output>
     
  @@ -99,7 +99,7 @@
   	
   	<assert-output name="Page Two: DirectLink">
   <![CDATA[
  -	DirectLink: <a href="/junit/simple?service=direct/0/Two/link">click it</a>
  +	DirectLink: <a href="/junit/simple?service=direct%2F0%2FTwo%2Flink">click it</a>
   ]]>	
   	</assert-output>	
   
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/scripts/TestStaleSessionException.xml
  
  Index: TestStaleSessionException.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestStaleSessionException.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestStaleSessionException.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestStaleSessionException.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -39,14 +39,14 @@
   		
   		<assert-output name="DirectLink URL">
   <![CDATA[
  -href="/mock/app?service=direct/0/Stale/directLink"
  +href="/mock/app?service=direct%2F0%2FStale%2FdirectLink"
   ]]>		
   		</assert-output>
   		
   
   		<assert-output name="ActionLink URL">
   <![CDATA[
  -href="/mock/app?service=action/0/Stale/0/actionLink"
  +href="/mock/app?service=action%2F0%2FStale%2F0%2FactionLink"
   ]]>		
   		</assert-output>		
   		
  
  
  
  1.2       +3 -3      jakarta-tapestry/framework/src/scripts/TestLibrary.xml
  
  Index: TestLibrary.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestLibrary.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestLibrary.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestLibrary.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -33,7 +33,7 @@
     	  	  	
     	  <assert-output name="DirectLink with parameters">
   <![CDATA[  	  
  -  	  <a href="/junit/mock?service=direct/0/Home/link&amp;sp=2&amp;sp=d3.5&amp;sp=SHello">
  +  	  <a href="/junit/mock?service=direct%2F0%2FHome%2Flink&amp;sp=2&amp;sp=d3.5&amp;sp=SHello">
   ]]>
     	  </assert-output>
     	  	  	
  @@ -97,7 +97,7 @@
   	
     	  <assert-output name="PageLink (for library page).">
   <![CDATA[  	  
  -  	  <a href="/junit/mock?service=page/lib:Dumper">
  +  	  <a href="/junit/mock?service=page%2Flib%3ADumper">
   ]]>
     	  </assert-output>	
   	
  @@ -145,7 +145,7 @@
   	
     	  <assert-output name="DirectLink with parameters">
   <![CDATA[  	  
  -  	  <a href="/junit/mock?service=direct/1/Home/link&amp;sp=2&amp;sp=d3.5&amp;sp=SHello">
  +  	  <a href="/junit/mock?service=direct%2F1%2FHome%2Flink&amp;sp=2&amp;sp=d3.5&amp;sp=SHello">
   ]]>
     	  </assert-output>
     </request>
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/scripts/TestWMLStaleSession.xml
  
  Index: TestWMLStaleSession.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestWMLStaleSession.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestWMLStaleSession.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestWMLStaleSession.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -41,14 +41,14 @@
   
           <assert-output name="DirectLink URL">
               <![CDATA[
  -            href="/mock/app?service=direct/0/Stale/directLink"
  +            href="/mock/app?service=direct%2F0%2FStale%2FdirectLink"
               ]]>
           </assert-output>
   
   
           <assert-output name="ActionLink URL">
               <![CDATA[
  -            href="/mock/app?service=action/0/Stale/0/actionLink"
  +            href="/mock/app?service=action%2F0%2FStale%2F0%2FactionLink"
               ]]>
           </assert-output>
   
  
  
  
  1.2       +4 -4      jakarta-tapestry/framework/src/scripts/TestLinkRenderers.xml
  
  Index: TestLinkRenderers.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestLinkRenderers.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestLinkRenderers.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestLinkRenderers.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -29,14 +29,14 @@
     		
     		<assert-output name="First Link">
   <![CDATA[
  -<a href="/c10/app?service=direct/0/Home/first">First</a>
  +<a href="/c10/app?service=direct%2F0%2FHome%2Ffirst">First</a>
   ]]>  		
     		</assert-output>
     	
   	
     		<assert-output name="Second Link">
   <![CDATA[
  -<a href="http://junit-test/c10/app?service=direct/0/Home/second">Second</a>
  +<a href="http://junit-test/c10/app?service=direct%2F0%2FHome%2Fsecond">Second</a>
   ]]>  		
     		</assert-output>	  	  		
     		
  @@ -48,7 +48,7 @@
     		
     		<assert-output name="Third Link">
   <![CDATA[
  -<a href="https://myserver:8080/c10/app?service=direct/0/Home/third#myanchor">Third</a>
  +<a href="https://myserver:8080/c10/app?service=direct%2F0%2FHome%2Fthird#myanchor">Third</a>
   ]]>  		
     		</assert-output>	
     	  
  @@ -113,7 +113,7 @@
   		
   		<assert-output name="Link">
   <![CDATA[
  -<a href="/c10/app?service=direct/0/Four/link" onClick="javascript:onClick_Link();">
  +<a href="/c10/app?service=direct%2F0%2FFour%2Flink" onClick="javascript:onClick_Link();">
   ]]>	
   		</assert-output>
     		  			
  
  
  
  1.2       +7 -7      jakarta-tapestry/framework/src/scripts/TestRedirect.xml
  
  Index: TestRedirect.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestRedirect.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestRedirect.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestRedirect.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -32,44 +32,44 @@
   	
   		<assert-output name="Internal Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/internal"
  +href="/mock/app?service=direct%2F0%2FHome%2Finternal"
   ]]>	
   		</assert-output>	
   		
   		<assert-output name="External Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/external"
  +href="/mock/app?service=direct%2F0%2FHome%2Fexternal"
   ]]>	
   		</assert-output>	
   	
   		<assert-output name="Null Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/null"
  +href="/mock/app?service=direct%2F0%2FHome%2Fnull"
   ]]>	
   		</assert-output>	
   		
   		<assert-output name="Servlet Exception Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/servletException"
  +href="/mock/app?service=direct%2F0%2FHome%2FservletException"
   ]]>	
   		</assert-output>	
   		
   		
   		<assert-output name="Missing Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/missing"
  +href="/mock/app?service=direct%2F0%2FHome%2Fmissing"
   ]]>	
   		</assert-output>	
   
   		<assert-output name="Index Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/index"
  +href="/mock/app?service=direct%2F0%2FHome%2Findex"
   ]]>	
   		</assert-output>	
   		
   		<assert-output name="Fail External Redirect Link">
   <![CDATA[
  -href="/mock/app?service=direct/0/Home/failExternal"
  +href="/mock/app?service=direct%2F0%2FHome%2FfailExternal"
   ]]>	
   		</assert-output>	
   				
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/scripts/TestProtectedLink.xml
  
  Index: TestProtectedLink.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestProtectedLink.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestProtectedLink.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestProtectedLink.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -39,7 +39,7 @@
   		
   		<assert-output name="Link URL">
   <![CDATA[
  -href="/mock/app?service=direct/0/ProtectedLink/link&amp;sp=6&amp;sp=13&amp;sp=1999"
  +href="/mock/app?service=direct%2F0%2FProtectedLink%2Flink&amp;sp=6&amp;sp=13&amp;sp=1999"
   ]]>
   		</assert-output>
     		
  @@ -61,7 +61,7 @@
   		
   		<assert-output name="Link URL">
   <![CDATA[
  -href="/mock/app?service=direct/1/Guard/link"
  +href="/mock/app?service=direct%2F1%2FGuard%2Flink"
   ]]>
   		</assert-output>
   		
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestReset.xml
  
  Index: TestReset.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestReset.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestReset.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestReset.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -51,7 +51,7 @@
   	
   		<assert-output name="Reset Link">
   <![CDATA[		
  -<a href="/mock/app?service=reset/Two">reset caching</a>
  +<a href="/mock/app?service=reset%2FTwo">reset caching</a>
   ]]>
   		</assert-output>
   		  		
  
  
  
  1.3       +1 -1      jakarta-tapestry/framework/src/scripts/TestAutoParameters.xml
  
  Index: TestAutoParameters.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestAutoParameters.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestAutoParameters.xml	31 Oct 2004 22:57:45 -0000	1.2
  +++ TestAutoParameters.xml	3 Dec 2004 22:28:09 -0000	1.3
  @@ -47,7 +47,7 @@
   		</assert-output>
   		
   		<assert-output name="link">
  -		href="/c23/assets?service=direct/0/Home/flicker.update"
  +		href="/c23/assets?service=direct%2F0%2FHome%2Fflicker.update"
   		</assert-output>
   	</request>
   	
  
  
  
  1.2       +3 -3      jakarta-tapestry/framework/src/scripts/TestListenerBinding.xml
  
  Index: TestListenerBinding.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestListenerBinding.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestListenerBinding.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestListenerBinding.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -35,7 +35,7 @@
   	
   		<assert-output name="Link">
   <![CDATA[		
  -/c7/lb?service=direct/0/Two/link
  +/c7/lb?service=direct%2F0%2FTwo%2Flink
   ]]>
   		</assert-output>
    
  @@ -84,13 +84,13 @@
   		
   		<assert-output name="invalidScriptLink URL">
   <![CDATA[
  -/c7/lb?service=direct/0/Two/invalidScriptLink
  +/c7/lb?service=direct%2F0%2FTwo%2FinvalidScriptLink
   ]]>
   		</assert-output>
   		
   		<assert-output name="unknownLanguageLink URL">
   <![CDATA[
  -/c7/lb?service=direct/0/Two/unknownLanguageLink
  +/c7/lb?service=direct%2F0%2FTwo%2FunknownLanguageLink
   ]]>
   		</assert-output>	
   				
  
  
  
  1.3       +2 -2      jakarta-tapestry/framework/src/scripts/TestPropertySpecification.xml
  
  Index: TestPropertySpecification.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestPropertySpecification.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestPropertySpecification.xml	31 Oct 2004 22:57:45 -0000	1.2
  +++ TestPropertySpecification.xml	3 Dec 2004 22:28:09 -0000	1.3
  @@ -216,7 +216,7 @@
   		
   		<assert-output name="Link">
   <![CDATA[
  -/c9/app?service=direct/0/Seven/$DirectLink		
  +/c9/app?service=direct%2F0%2FSeven%2F%24DirectLink	
   ]]>
   		</assert-output>
   	</request>	
  @@ -250,7 +250,7 @@
   		
   		<assert-output name="Link">
   <![CDATA[
  -/c9/app?service=direct/1/Seven/$DirectLink		
  +/c9/app?service=direct%2F1%2FSeven%2F%24DirectLink		
   ]]>
   		</assert-output>	
   		
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/scripts/TestExternal.xml
  
  Index: TestExternal.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestExternal.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestExternal.xml	29 Oct 2004 17:13:48 -0000	1.1
  +++ TestExternal.xml	3 Dec 2004 22:28:09 -0000	1.2
  @@ -35,7 +35,7 @@
     	  	  	
     	  <assert-output name="ServiceLink with parameters">
   <![CDATA[  	  
  -  	  <a href="/junit/mock?service=external/ServiceTest&amp;sp=SSopranos&amp;sp=20705&amp;sp=d3.142857142857143">
  +  	  <a href="/junit/mock?service=external%2FServiceTest&amp;sp=SSopranos&amp;sp=20705&amp;sp=d3.142857142857143">
   ]]>
     	  </assert-output>
     	  	  	
  
  
  
  1.2       +134 -361  jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/TestEngineServiceLink.java
  
  Index: TestEngineServiceLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/TestEngineServiceLink.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestEngineServiceLink.java	29 Oct 2004 17:13:38 -0000	1.1
  +++ TestEngineServiceLink.java	3 Dec 2004 22:28:10 -0000	1.2
  @@ -14,417 +14,190 @@
   
   package org.apache.tapestry.junit;
   
  -import java.io.BufferedReader;
  -import java.io.IOException;
  -import java.io.UnsupportedEncodingException;
  -import java.security.Principal;
  -import java.util.Enumeration;
  -import java.util.Locale;
  -import java.util.Map;
  -
  -import javax.servlet.RequestDispatcher;
  -import javax.servlet.ServletInputStream;
  -import javax.servlet.http.Cookie;
  -import javax.servlet.http.HttpServletRequest;
  -import javax.servlet.http.HttpSession;
  -
  -import org.apache.tapestry.ApplicationServlet;
  +import org.apache.commons.codec.net.URLCodec;
  +import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.engine.EngineServiceLink;
   import org.apache.tapestry.request.RequestContext;
  -import org.apache.tapestry.spec.ApplicationSpecification;
  -import org.apache.tapestry.test.mock.MockContext;
  -import org.apache.tapestry.test.mock.MockServletConfig;
  +import org.easymock.MockControl;
  +import org.easymock.classextension.MockClassControl;
   
  +/**
  + * Tests for {@link org.apache.tapestry.engine.EngineServiceLink}.
  + * 
  + * @author Howard Lewis Ship
  + * @since 3.0
  + */
   public class TestEngineServiceLink extends TapestryTestCase
   {
  -    private class TestRequest implements HttpServletRequest
  +    private URLCodec _urlCodec = new URLCodec();
  +
  +    private static final String ENCODING = "utf-8";
  +
  +    /** @since 3.1 */
  +    public void testGetURLWithParameters()
       {
  -        public String getAuthType()
  -        {
  -            return null;
  -        }
  -
  -        public String getContextPath()
  -        {
  -            return null;
  -        }
  -
  -        public Cookie[] getCookies()
  -        {
  -            return null;
  -        }
  -
  -        public long getDateHeader(String arg0)
  -        {
  -            return 0;
  -        }
  -
  -        public String getHeader(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public Enumeration getHeaderNames()
  -        {
  -            return null;
  -        }
  -
  -        public Enumeration getHeaders(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public int getIntHeader(String arg0)
  -        {
  -            return 0;
  -        }
  -
  -        public String getMethod()
  -        {
  -            return null;
  -        }
  -
  -        public String getPathInfo()
  -        {
  -            return null;
  -        }
  -
  -        public String getPathTranslated()
  -        {
  -            return null;
  -        }
  -
  -        public String getQueryString()
  -        {
  -            return null;
  -        }
  -
  -        public String getRemoteUser()
  -        {
  -            return null;
  -        }
  -
  -        public String getRequestedSessionId()
  -        {
  -            return null;
  -        }
  -
  -        public String getRequestURI()
  -        {
  -            return null;
  -        }
  -
  -        public StringBuffer getRequestURL()
  -        {
  -            return null;
  -        }
  -
  -        public String getServletPath()
  -        {
  -            return null;
  -        }
  -
  -        public HttpSession getSession()
  -        {
  -            return null;
  -        }
  -
  -        public HttpSession getSession(boolean arg0)
  -        {
  -            return null;
  -        }
  -
  -        public Principal getUserPrincipal()
  -        {
  -            return null;
  -        }
  -
  -        public boolean isRequestedSessionIdFromCookie()
  -        {
  -            return false;
  -        }
  -
  -        public boolean isRequestedSessionIdFromUrl()
  -        {
  -            return false;
  -        }
  -
  -        public boolean isRequestedSessionIdFromURL()
  -        {
  -            return false;
  -        }
  -
  -        public boolean isRequestedSessionIdValid()
  -        {
  -            return false;
  -        }
  -
  -        public boolean isUserInRole(String arg0)
  -        {
  -            return false;
  -        }
  -
  -        public Object getAttribute(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public Enumeration getAttributeNames()
  -        {
  -            return null;
  -        }
  -
  -        public String getCharacterEncoding()
  -        {
  -            return null;
  -        }
  -
  -        public int getContentLength()
  -        {
  -            return 0;
  -        }
  -
  -        public String getContentType()
  -        {
  -            return null;
  -        }
  -
  -        public ServletInputStream getInputStream() throws IOException
  -        {
  -            return null;
  -        }
  -
  -        public Locale getLocale()
  -        {
  -            return null;
  -        }
  -
  -        public Enumeration getLocales()
  -        {
  -            return null;
  -        }
  -
  -        public String getParameter(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public Map getParameterMap()
  -        {
  -            return null;
  -        }
  -
  -        public Enumeration getParameterNames()
  -        {
  -            return null;
  -        }
  -
  -        public String[] getParameterValues(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public String getProtocol()
  -        {
  -            return null;
  -        }
  -
  -        public BufferedReader getReader() throws IOException
  -        {
  -            return null;
  -        }
  -
  -        public String getRealPath(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public String getRemoteAddr()
  -        {
  -            return null;
  -        }
  -
  -        public String getRemoteHost()
  -        {
  -            return null;
  -        }
  -
  -        public RequestDispatcher getRequestDispatcher(String arg0)
  -        {
  -            return null;
  -        }
  -
  -        public String getScheme()
  -        {
  -            return "http";
  -        }
  -
  -        public String getServerName()
  -        {
  -            return "testserver";
  -        }
  -
  -        public int getServerPort()
  -        {
  -            return 80;
  -        }
  -
  -        public boolean isSecure()
  -        {
  -            return false;
  -        }
  -
  -        public void removeAttribute(String arg0)
  -        {
  -        }
  -
  -        public void setAttribute(String arg0, Object arg1)
  -        {
  -        }
  -
  -        public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException
  -        {
  -        }
  -
  -        public int getRemotePort()
  -        {
  -            return 0;
  -        }
  -
  -        public String getLocalName()
  -        {
  -            return null;
  -        }
  -
  -        public String getLocalAddr()
  -        {
  -            return null;
  -        }
  -
  -        public int getLocalPort()
  -        {
  -            return 0;
  -        }
  +        MockControl control = newControl(IRequestCycle.class);
  +        IRequestCycle rc = (IRequestCycle) control.getMock();
  +
  +        rc.encodeURL("/context/servlet?service=myservice");
  +        control.setReturnValue("/context/servlet?service=myservice;encoded");
  +
  +        EngineServiceLink l = new EngineServiceLink(rc, "/context/servlet", ENCODING, _urlCodec,
  +                "myservice", null, null, true);
  +
  +        replayControls();
  +
  +        assertEquals("/context/servlet?service=myservice;encoded", l.getURL());
  +
  +        verifyControls();
  +
  +        checkList("parameterNames", new String[]
  +        { Tapestry.SERVICE_QUERY_PARAMETER_NAME, Tapestry.PARAMETERS_QUERY_PARAMETER_NAME }, l
  +                .getParameterNames());
   
       }
   
  -    private MockRequestCycle create(String servletPath) throws Exception
  +    public void testGetURLWithServiceContext()
       {
  -        MockContext servletContext = new MockContext();
  -        MockServletConfig config = new MockServletConfig("servlet", servletContext);
  -        ApplicationServlet servlet = new ApplicationServlet();
  +        IRequestCycle rc = (IRequestCycle) newMock(IRequestCycle.class);
  +
  +        EngineServiceLink l = new EngineServiceLink(rc, "/context/servlet", ENCODING, _urlCodec,
  +                "myservice", new String[]
  +                { "alpha", "bravo" }, null, false);
   
  -        servlet.init(config);
  +        replayControls();
   
  -        MockEngine engine = new MockEngine();
  -        engine.setServletPath(servletPath);
  +        assertEquals("/context/servlet?service=myservice%2Falpha%2Fbravo", l.getURL());
   
  -        HttpServletRequest request = new TestRequest();
  -        RequestContext context = new RequestContext(servlet, request, null,
  -                new ApplicationSpecification());
  +        verifyControls();
   
  -        return new MockRequestCycle(engine, context);
  +        assertEquals("myservice/alpha/bravo", l
  +                .getParameterValues(Tapestry.SERVICE_QUERY_PARAMETER_NAME)[0]);
       }
   
  -    public void testGetURL() throws Exception
  +    public void testGetURLWithServiceParameters()
       {
  -        MockRequestCycle c = create("/context/servlet");
  +        IRequestCycle rc = (IRequestCycle) newMock(IRequestCycle.class);
   
  -        EngineServiceLink l = new EngineServiceLink(c, "myservice", null, null, true);
  +        EngineServiceLink l = new EngineServiceLink(rc, "/ctx/app", ENCODING, _urlCodec, "foo",
  +                null, new String[]
  +                { "godzilla", "frodo" }, false);
   
  -        assertEquals("/context/servlet?service=myservice", l.getURL());
  +        replayControls();
   
  -        assertEquals("/context/servlet?service=myservice", c.getLastEncodedURL());
  +        assertEquals("/ctx/app?service=foo&sp=godzilla&sp=frodo", l.getURL());
   
  -        assertEquals("/context/servlet", l.getURL(null, false));
  +        verifyControls();
  +    }
   
  -        assertEquals("/context/servlet#anchor", l.getURL("anchor", false));
  +    /** @since 3.1 */
   
  -        assertEquals("/context/servlet?service=myservice#anchor", l.getURL("anchor", true));
  +    public void testGetURLSansParameters()
  +    {
  +        MockControl control = newControl(IRequestCycle.class);
  +        IRequestCycle rc = (IRequestCycle) control.getMock();
   
  -        checkList("parameterNames", new String[]
  -        { Tapestry.SERVICE_QUERY_PARAMETER_NAME }, l.getParameterNames());
  +        EngineServiceLink l = new EngineServiceLink(rc, "/context/servlet", ENCODING, _urlCodec,
  +                "myservice", null, null, true);
  +
  +        rc.encodeURL("/context/servlet");
  +        control.setReturnValue("/context/servlet;encoded");
  +
  +        replayControls();
  +
  +        assertEquals("/context/servlet;encoded", l.getURL(null, false));
  +
  +        verifyControls();
       }
   
  -    public void testGetAbsoluteURL() throws Exception
  +    /** @since 3.1 */
  +
  +    public void testGetURLWithAnchor()
       {
  -        MockRequestCycle c = create("/context/servlet");
  +        IRequestCycle rc = (IRequestCycle) newMock(IRequestCycle.class);
   
  -        EngineServiceLink l = new EngineServiceLink(c, "myservice", null, null, true);
  +        EngineServiceLink l = new EngineServiceLink(rc, "/context/servlet", ENCODING, _urlCodec,
  +                "myservice", null, null, false);
   
  -        assertEquals("http://testserver/context/servlet?service=myservice", l.getAbsoluteURL());
  +        replayControls();
   
  -        assertEquals("http://testserver/context/servlet?service=myservice", c.getLastEncodedURL());
  +        assertEquals("/context/servlet#anchor", l.getURL("anchor", false));
   
  -        assertEquals("http://testserver/context/servlet#anchor", l.getAbsoluteURL(
  -                null,
  -                null,
  -                0,
  -                "anchor",
  -                false));
  -
  -        assertEquals("http://testserver/context/servlet?service=myservice#anchor", l
  -                .getAbsoluteURL(null, null, 0, "anchor", true));
  -
  -        assertEquals("frob://magic:77/context/servlet?service=myservice", l.getAbsoluteURL(
  -                "frob",
  -                "magic",
  -                77,
  -                null,
  -                true));
  +        verifyControls();
       }
   
  -    public void testContext() throws Exception
  +    public void testGetURLWithAnchorAndParameters() throws Exception
       {
  -        MockRequestCycle c = create("/alpha/bravo");
  +        IRequestCycle rc = (IRequestCycle) newMock(IRequestCycle.class);
   
  -        EngineServiceLink l = new EngineServiceLink(c, "myservice", new String[]
  -        { "Alpha", "Bravo", "Tango" }, null, true);
  +        EngineServiceLink l = new EngineServiceLink(rc, "/context/servlet", ENCODING, _urlCodec,
  +                "myservice", null, null, false);
   
  -        checkList("parameterNames", new String[]
  -        { Tapestry.SERVICE_QUERY_PARAMETER_NAME }, l.getParameterNames());
  -
  -        checkList("service parameters values", new String[]
  -        { "myservice/Alpha/Bravo/Tango" }, l
  -                .getParameterValues(Tapestry.SERVICE_QUERY_PARAMETER_NAME));
  +        replayControls();
   
  -        assertEquals("/alpha/bravo?service=myservice/Alpha/Bravo/Tango", l.getURL());
  +        assertEquals("/context/servlet?service=myservice#anchor", l.getURL("anchor", true));
   
  +        verifyControls();
       }
   
  -    public void testServiceParameters() throws Exception
  +    public void testGetAbsoluteURL() throws Exception
       {
  -        MockRequestCycle c = create("/alpha/bravo");
  +        MockControl control = newControl(IRequestCycle.class);
  +        IRequestCycle rc = (IRequestCycle) control.getMock();
   
  -        EngineServiceLink l = new EngineServiceLink(c, "myservice", null, new String[]
  -        { "One Two", "Three Four" }, true);
  +        MockControl contextc = MockClassControl.createStrictControl(RequestContext.class);
  +        addControl(contextc);
   
  -        assertEquals("/alpha/bravo?service=myservice&sp=One+Two&sp=Three+Four", l.getURL());
  +        RequestContext context = (RequestContext) contextc.getMock();
   
  -        checkList("parameterNames", new String[]
  -        { Tapestry.SERVICE_QUERY_PARAMETER_NAME, Tapestry.PARAMETERS_QUERY_PARAMETER_NAME }, l
  -                .getParameterNames());
  +        rc.getRequestContext();
  +        control.setReturnValue(context);
  +
  +        EngineServiceLink l = new EngineServiceLink(rc, "/ctx/app", ENCODING, _urlCodec,
  +                "myservice", null, null, false);
  +
  +        context.getScheme();
  +        contextc.setReturnValue("HTTP");
   
  -        checkList("service parameters values", new String[]
  -        { "One Two", "Three Four" }, l.getParameterValues(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME));
  +        context.getServerName();
  +        contextc.setReturnValue("TESTSERVER.COM");
  +
  +        context.getServerPort();
  +        contextc.setReturnValue(9187);
  +
  +        replayControls();
  +
  +        assertEquals("HTTP://TESTSERVER.COM:9187/ctx/app?service=myservice", l.getAbsoluteURL());
  +
  +        verifyControls();
       }
   
  -    public void testUnknownParameter() throws Exception
  +    public void testGetAbsoluteURLWithOverrides() throws Exception
       {
  -        MockRequestCycle c = create("/context/servlet");
  +        MockControl control = newControl(IRequestCycle.class);
  +        IRequestCycle rc = (IRequestCycle) control.getMock();
   
  -        EngineServiceLink l = new EngineServiceLink(c, "myservice", null, null, true);
  +        MockControl contextc = MockClassControl.createStrictControl(RequestContext.class);
  +        addControl(contextc);
   
  -        try
  -        {
  -            l.getParameterValues("unknown");
  -
  -            unreachable();
  -        }
  -        catch (IllegalArgumentException ex)
  -        {
  -        }
  -    }
  +        RequestContext context = (RequestContext) contextc.getMock();
  +
  +        rc.getRequestContext();
  +        control.setReturnValue(context);
   
  +        EngineServiceLink l = new EngineServiceLink(rc, "/ctx/app", ENCODING, _urlCodec,
  +                "myservice", null, null, false);
  +
  +        replayControls();
  +
  +        assertEquals("https://myserver.net:9100/ctx/app?service=myservice", l.getAbsoluteURL(
  +                "https",
  +                "myserver.net",
  +                9100,
  +                null,
  +                true));
  +
  +        verifyControls();
  +    }
   }
  
  
  
  1.3       +53 -70    jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ILink.java
  
  Index: ILink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ILink.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ILink.java	16 Sep 2004 00:26:25 -0000	1.2
  +++ ILink.java	3 Dec 2004 22:28:10 -0000	1.3
  @@ -15,96 +15,79 @@
   package org.apache.tapestry.engine;
   
   /**
  - *  Define a link that may be generated as part of a page render.  The vast majority
  - *  of links are tied to {@link IEngineService services} and are, in
  - *  fact, callbacks.  A small number, such as those generated by
  - *  {@link org.apache.tapestry.link.GenericLink} component, are to arbitrary locations.
  - *  In addition, ILink differentiates between the path portion of the link, and any
  - *  query parameters encoded into a link, primarily to benefit {@link org.apache.tapestry.form.Form},
  - *  which needs to encode the query parameters as hidden form fields.
  - *
  - *  <p>
  - *  In addition, an ILink is responsible for
  - *  passing constructed URLs through
  - *  {@link org.apache.tapestry.IRequestCycle#encodeURL(String)}
  - *  as needed.
  + * Define a link that may be generated as part of a page render. The vast majority of links are tied
  + * to {@link IEngineService services}and are, in fact, callbacks. A small number, such as those
  + * generated by {@link org.apache.tapestry.link.GenericLink}component, are to arbitrary locations.
  + * In addition, ILink differentiates between the path portion of the link, and any query parameters
  + * encoded into a link, primarily to benefit {@link org.apache.tapestry.form.Form}, which needs to
  + * encode the query parameters as hidden form fields.
  + * <p>
  + * In addition, an ILink is responsible for passing constructed URLs through
  + * {@link org.apache.tapestry.IRequestCycle#encodeURL(String)}as needed.
    * 
  - *  @author Howard Lewis Ship
  - *  @since 3.0
  - * 
  - **/
  + * @author Howard Lewis Ship
  + * @since 3.0
  + */
   
   public interface ILink
   {
  -	/**
  -	 *  Returns the relative URL as a String.  A relative
  -	 *  URL may include a leading slash, but omits
  -	 *  the scheme, host and port portions of a full URL.
  -	 *  
  -	 *  @return the relative URL, with no anchor, but including
  -	 *  query parameters.
  -	 * 
  -	 **/
  -	
  -	public String getURL();
  -	
       /**
  -     *  Returns the relative URL as a String.  This is used
  -     *  for most links.
  +     * Returns the relative URL as a String. A relative URL may include a leading slash, but omits
  +     * the scheme, host and port portions of a full URL.
        * 
  -     *  @param anchor if not null, appended to the URL
  -     *  @param includeParameters if true, parameters are included
  +     * @return the relative URL, with no anchor, but including query parameters.
  +     */
  +
  +    public String getURL();
  +
  +    /**
  +     * Returns the relative URL as a String. This is used for most links.
        * 
  -     **/
  +     * @param anchor
  +     *            if not null, appended to the URL
  +     * @param includeParameters
  +     *            if true, parameters are included
  +     */
   
       public String getURL(String anchor, boolean includeParameters);
   
  -	/**
  -	 *  Returns the absolute URL as a String, using
  -	 *  default scheme, server and port, including
  -	 *  parameters, and no anchor.
  -	 * 
  -	 **/
  -	
  -	public String getAbsoluteURL();
  +    /**
  +     * Returns the absolute URL as a String, using default scheme, server and port, including
  +     * parameters, and no anchor.
  +     */
  +
  +    public String getAbsoluteURL();
   
       /**
  -     *  Returns the absolute URL as a String.  
  -     * 
  -     *  @param scheme if not null, overrides the default scheme.
  -     *  @param server if not null, overrides the default server
  -     *  @param port if non-zero, overrides the default port
  -     *  @param anchor if not null, appended to the URL
  -     *  @param includeParameters if true, parameters are included
  +     * Returns the absolute URL as a String.
        * 
  -     **/
  +     * @param scheme
  +     *            if not null, overrides the default scheme.
  +     * @param server
  +     *            if not null, overrides the default server
  +     * @param port
  +     *            if non-zero, overrides the default port
  +     * @param anchor
  +     *            if not null, appended to the URL
  +     * @param includeParameters
  +     *            if true, parameters are included
  +     */
   
  -    public String getAbsoluteURL(
  -        String scheme,
  -        String server,
  -        int port,
  -        String anchor,
  -        boolean includeParameters);
  +    public String getAbsoluteURL(String scheme, String server, int port, String anchor,
  +            boolean includeParameters);
   
       /**
  +     * Returns an array of parameters names (in no alphabetical order).
        * 
  -     *  Returns an array of parameters names (in
  -     *  no specified order).
  -     * 
  -     *  @see #getParameterValues(String)
  -     * 
  -     **/
  +     * @see #getParameterValues(String)
  +     */
   
       public String[] getParameterNames();
   
       /**
  -     *  Returns the values for the named parameter.
  -     *  
  -     *  @throws IllegalArgumentException if the
  -     *  link does not define values for the
  -     *  specified name.
  -     * 
  -     **/
  +     * Returns the values for the named parameter. Will return null if the no value is defined for
  +     * the parameter.
  +     */
   
       public String[] getParameterValues(String name);
  -}
  +}
  \ No newline at end of file
  
  
  
  1.3       +109 -105  jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/EngineServiceLink.java
  
  Index: EngineServiceLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/EngineServiceLink.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EngineServiceLink.java	16 Sep 2004 00:26:25 -0000	1.2
  +++ EngineServiceLink.java	3 Dec 2004 22:28:10 -0000	1.3
  @@ -16,75 +16,96 @@
   
   import java.io.UnsupportedEncodingException;
   import java.util.ArrayList;
  +import java.util.Collections;
  +import java.util.HashMap;
   import java.util.List;
  +import java.util.Map;
   
   import org.apache.commons.codec.net.URLCodec;
  -import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.request.RequestContext;
   
   /**
  - *  A EngineServiceLink represents a possible action within the client web browser;
  - *  either clicking a link or submitting a form, which is constructed primarily
  - *  from the {@link org.apache.tapestry.IEngine#getServletPath() servlet path},
  - *  with some additional query parameters.  A full URL for the EngineServiceLink
  - *  can be generated, or the query parameters for the EngineServiceLink can be extracted
  - *  (separately from the servlet path).  The latter case is used when submitting
  - *  constructing {@link org.apache.tapestry.form.Form forms}.
  - *
  - *  @author Howard Lewis Ship
  - *  @since 3.0
  + * A EngineServiceLink represents a possible action within the client web browser; either clicking a
  + * link or submitting a form, which is constructed primarily from the
  + * {@link org.apache.tapestry.IEngine#getServletPath() servlet path}, with some additional query
  + * parameters. A full URL for the EngineServiceLink can be generated, or the query parameters for
  + * the EngineServiceLink can be extracted (separately from the servlet path). The latter case is
  + * used when submitting constructing {@link org.apache.tapestry.form.Form forms}.
    * 
  - **/
  + * @author Howard Lewis Ship
  + * @since 3.0
  + */
   
   public class EngineServiceLink implements ILink
   {
       private static final int DEFAULT_HTTP_PORT = 80;
  -    private static final URLCodec _urlCodec = new URLCodec();
   
       private IRequestCycle _cycle;
  -    private String _service;
  -    private String[] _parameters;
  +
  +    private String _servletPath;
  +
  +    private URLCodec _codec;
  +
  +    private String _encoding;
  +
       private boolean _stateful;
   
  +    private Map _parameters = new HashMap(3);
  +
       /**
  -     *  Creates a new EngineServiceLink.  A EngineServiceLink always names a service to be activated
  -     *  by the link, has an optional list of service context strings,
  -     *  an optional list of service parameter strings and may be stateful
  -     *  or stateless.
  +     * Creates a new EngineServiceLink. A EngineServiceLink always names a service to be activated
  +     * by the link, has an optional list of service context strings, an optional list of service
  +     * parameter strings and may be stateful or stateless.
  +     * <p>
  +     * ServiceLink parameter strings may contain any characters.
  +     * <p>
  +     * ServiceLink context strings must be URL safe, and may not contain slash ('/') characters.
  +     * Typically, only letters, numbers and simple punctuation ('.', '-', '_', ':') is recommended
  +     * (no checks are currently made, however). Context strings are generally built from page names
  +     * and component ids, which are limited to safe characters.
        * 
  -     *  <p>ServiceLink parameter strings may contain any characters.
  -     * 
  -     *  <p>ServiceLink context strings must be URL safe, and may not contain
  -     *  slash ('/') characters.  Typically, only letters, numbers and simple
  -     *  punctuation ('.', '-', '_', ':') is recommended (no checks are currently made,
  -     *  however).  Context strings are generally built from page names
  -     *  and component ids, which are limited to safe characters.
  -     *  
  -     *  @param cycle The {@link IRequestCycle} the EngineServiceLink is to be created for.
  -     *  @param serviceName The name of the service to be invoked by the EngineServiceLink.
  -     *  @param serviceContext an optional array of strings to be provided
  -     *  to the service to provide a context for executing the service.  May be null
  -     *  or empty.  <b>Note: copied, not retained.</b>
  -     *  @param serviceParameters An array of parameters, may be 
  -     *  null or empty. <b>Note: retained, not copied.</b>
  -     *  @param stateful if true, the service which generated the EngineServiceLink
  -     *  is stateful and expects that the final URL will be passed through
  -     *  {@link IRequestCycle#encodeURL(String)}.
  -     **/
  -
  -    public EngineServiceLink(
  -        IRequestCycle cycle,
  -        String serviceName,
  -        String[] serviceContext,
  -        String[] serviceParameters,
  -        boolean stateful)
  -    {
  +     * @param cycle
  +     *            The {@link IRequestCycle}&nbsp; the EngineServiceLink is to be created for.
  +     * @param servletPath
  +     * @param codec
  +     * @param encoding
  +     * @param serviceName
  +     *            The name of the service to be invoked by the EngineServiceLink.
  +     * @param serviceContext
  +     *            an optional array of strings to be provided to the service to provide a context
  +     *            for executing the service. May be null or empty. <b>Note: copied, not retained.
  +     *            </b>
  +     * @param serviceParameters
  +     *            An array of parameters, may be null or empty. <b>Note: retained, not copied. </b>
  +     * @param stateful
  +     *            if true, the service which generated the EngineServiceLink is stateful and expects
  +     *            that the final URL will be passed through {@link IRequestCycle#encodeURL(String)}.
  +     */
  +
  +    public EngineServiceLink(IRequestCycle cycle, String servletPath, String encoding,
  +            URLCodec codec, String serviceName, String[] serviceContext,
  +            String[] serviceParameters, boolean stateful)
  +    {
  +        Defense.notNull(cycle, "cycle");
  +        Defense.notNull(servletPath, "servletPath");
  +        Defense.notNull(encoding, "encoding");
  +        Defense.notNull(codec, "codec");
  +        Defense.notNull(serviceName, "serviceName");
  +
           _cycle = cycle;
  -        _service = constructServiceValue(serviceName, serviceContext);
  -        _parameters = serviceParameters;
  +        _servletPath = servletPath;
  +        _encoding = encoding;
  +        _codec = codec;
  +
  +        _parameters.put(Tapestry.SERVICE_QUERY_PARAMETER_NAME, new String[]
  +        { constructServiceValue(serviceName, serviceContext) });
  +
  +        _parameters.put(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME, serviceParameters);
  +
           _stateful = stateful;
       }
   
  @@ -122,12 +143,8 @@
           return getAbsoluteURL(null, null, 0, null, true);
       }
   
  -    public String getAbsoluteURL(
  -        String scheme,
  -        String server,
  -        int port,
  -        String anchor,
  -        boolean includeParameters)
  +    public String getAbsoluteURL(String scheme, String server, int port, String anchor,
  +            boolean includeParameters)
       {
           StringBuffer buffer = new StringBuffer();
           RequestContext context = _cycle.getRequestContext();
  @@ -160,38 +177,10 @@
   
       private String constructURL(StringBuffer buffer, String anchor, boolean includeParameters)
       {
  -        buffer.append(_cycle.getEngine().getServletPath());
  +        buffer.append(_servletPath);
   
           if (includeParameters)
  -        {
  -            buffer.append('?');
  -            buffer.append(Tapestry.SERVICE_QUERY_PARAMETER_NAME);
  -            buffer.append('=');
  -            buffer.append(_service);
  -
  -            int count = Tapestry.size(_parameters);
  -
  -            for (int i = 0; i < count; i++)
  -            {
  -                buffer.append('&');
  -
  -                buffer.append(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME);
  -                buffer.append('=');
  -
  -                String encoding = _cycle.getEngine().getOutputEncoding();
  -                try
  -                {
  -                    String encoded = _urlCodec.encode(_parameters[i], encoding);
  -                    buffer.append(encoded);
  -                }
  -                catch (UnsupportedEncodingException e)
  -                {
  -                    throw new ApplicationRuntimeException(
  -                        Tapestry.format("illegal-encoding", encoding),
  -                        e);
  -                }
  -            }
  -        }
  +            addParameters(buffer);
   
           if (anchor != null)
           {
  @@ -207,43 +196,58 @@
           return result;
       }
   
  -    public String[] getParameterNames()
  +    private void addParameters(StringBuffer buffer)
       {
  -        List list = new ArrayList();
  +        String[] names = getParameterNames();
   
  -        list.add(Tapestry.SERVICE_QUERY_PARAMETER_NAME);
  +        String sep = "?";
   
  -        if (Tapestry.size(_parameters) != 0)
  -            list.add(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME);
  +        for (int i = 0; i < names.length; i++)
  +        {
  +            String name = names[i];
  +            String[] values = getParameterValues(name);
   
  -        return (String[]) list.toArray(new String[list.size()]);
  +            if (values == null)
  +                continue;
  +
  +            for (int j = 0; j < values.length; j++)
  +            {
  +                buffer.append(sep);
  +                buffer.append(name);
  +                buffer.append("=");
  +                buffer.append(encode(values[j]));
  +
  +                sep = "&";
  +            }
  +
  +        }
       }
   
  -    public String[] getParameterValues(String name)
  +    private String encode(String value)
       {
  -        if (name.equals(Tapestry.SERVICE_QUERY_PARAMETER_NAME))
  +        try
           {
  -            return new String[] { _service };
  +            return _codec.encode(value, _encoding);
           }
  -
  -        if (name.equals(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME))
  +        catch (UnsupportedEncodingException ex)
           {
  -            return _parameters;
  +            throw new ApplicationRuntimeException(Tapestry.format("illegal-encoding", _encoding),
  +                    ex);
           }
  -
  -        throw new IllegalArgumentException(
  -            Tapestry.format("EngineServiceLink.unknown-parameter-name", name));
       }
   
  -    public String toString()
  +    public String[] getParameterNames()
       {
  -        ToStringBuilder builder = new ToStringBuilder(this);
  +        List list = new ArrayList(_parameters.keySet());
   
  -        builder.append("service", _service);
  -        builder.append("parameters", _parameters);
  -        builder.append("stateful", _stateful);
  +        Collections.sort(list);
   
  -        return builder.toString();
  +        return (String[]) list.toArray(new String[list.size()]);
  +    }
  +
  +    public String[] getParameterValues(String name)
  +    {
  +        return (String[]) _parameters.get(name);
       }
   
   }
  
  
  
  1.2       +8 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/LinkFactoryImpl.java
  
  Index: LinkFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/LinkFactoryImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LinkFactoryImpl.java	3 Dec 2004 16:56:08 -0000	1.1
  +++ LinkFactoryImpl.java	3 Dec 2004 22:28:10 -0000	1.2
  @@ -16,8 +16,10 @@
   
   import java.io.IOException;
   
  +import org.apache.commons.codec.net.URLCodec;
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.Defense;
  +import org.apache.tapestry.IEngine;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.engine.EngineServiceLink;
  @@ -36,6 +38,8 @@
   
       private final Object[] EMPTY = new Object[0];
   
  +    private URLCodec _codec = new URLCodec();
  +
       public ILink constructLink(IRequestCycle cycle, String serviceName, String[] context,
               Object[] serviceParameters, boolean stateful)
       {
  @@ -44,7 +48,10 @@
   
           String[] squeezed = squeeze(serviceParameters);
   
  -        return new EngineServiceLink(cycle, serviceName, context, squeezed, stateful);
  +        IEngine engine = cycle.getEngine();
  +
  +        return new EngineServiceLink(cycle, engine.getServletPath(), engine.getOutputEncoding(),
  +                _codec, serviceName, context, squeezed, stateful);
       }
   
       public Object[] extractServiceParameters(IRequestCycle cycle)
  
  
  
  1.43      +2 -0      jakarta-tapestry/framework/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/build.xml,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- build.xml	2 Nov 2004 22:34:23 -0000	1.42
  +++ build.xml	3 Dec 2004 22:28:10 -0000	1.43
  @@ -45,6 +45,8 @@
       
   		<ibiblio-dependency artifact="log4j"              version="1.2.7"               group="log4j"    use="test"/>
   		<ibiblio-dependency artifact="easymock"           version="1.1"                 group="easymock" use="test"/>
  +		<ibiblio-dependency artifact="easymockclassextension" version="1.1"             group="easymock" use="test"/>
  +		<ibiblio-dependency artifact="cglib-full"         version="2.0.1"               group="cglib"    use="test"/>
       <ibiblio-dependency artifact="jdom"               version="b8"                  group="jdom"     use="test"/>
       <ibiblio-dependency artifact="jython"             version="2.1"                 group="jython"   use="test"/>
   		
  
  
  
  1.63      +2 -0      jakarta-tapestry/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.classpath,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- .classpath	19 Nov 2004 16:44:05 -0000	1.62
  +++ .classpath	3 Dec 2004 22:28:10 -0000	1.63
  @@ -28,5 +28,7 @@
   	<classpathentry kind="lib" path="ext-package/lib/jCharts-0.6.0.jar"/>
   	<classpathentry sourcepath="C:/workspace/jakarta-hivemind/framework/src/java" kind="lib" path="ext-package/lib/hivemind-1.1-alpha-1.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.1-alpha-1.jar"/>
  +	<classpathentry kind="lib" path="ext-package/lib/cglib-full-2.0.1.jar"/>
  +	<classpathentry kind="lib" path="ext-package/lib/easymockclassextension-1.1.jar"/>
   	<classpathentry kind="output" path="bin"/>
   </classpath>
  
  
  
  1.6       +8 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.java
  
  Index: Form.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Form.java	3 Dec 2004 15:18:39 -0000	1.5
  +++ Form.java	3 Dec 2004 22:28:10 -0000	1.6
  @@ -22,6 +22,7 @@
   
   import org.apache.tapestry.AbstractComponent;
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.HiveMind;
   import org.apache.tapestry.IActionListener;
   import org.apache.tapestry.IBinding;
   import org.apache.tapestry.IDirect;
  @@ -567,7 +568,7 @@
   
           IEngine engine = cycle.getEngine();
           IEngineService service = engine.getService(serviceName);
  -        
  +
           return service.getLink(cycle, parameter);
       }
   
  @@ -604,7 +605,7 @@
           writer.attribute("type", "hidden");
           writer.attribute("name", name);
   
  -        if (id != null && id.length() != 0)
  +        if (HiveMind.isNonBlank(id))
               writer.attribute("id", id);
   
           writer.attribute("value", value);
  @@ -619,6 +620,11 @@
               String parameterName)
       {
           String[] values = link.getParameterValues(parameterName);
  +
  +        // In some cases, there are no values, but a space is "reserved" for the provided name.
  +
  +        if (values == null)
  +            return;
   
           for (int i = 0; i < values.length; i++)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message