Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplate.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplate.java?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplate.java (original) +++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplate.java Mon Jan 31 20:47:19 2005 @@ -50,13 +50,15 @@ /** * Create a URLTemplate from a url-template-config template. - * <p/> - * Allow clients to define a set of required and known tokens for the + * + * <p> Allow clients to define a set of required and known tokens for the * template verification. Tokens are expected to be qualified - * in braces. E.g. {url:path} - * <p/> - * The template verification will ensure the URL template conforms to - * a valid format for known tokens and contains the required tokens. + * in braces. E.g. {url:path} </p> + * + * <p> The template verification will ensure the URL template conforms to + * a valid format for known tokens and contains the required tokens. </p> + * + * <p> Should call verify after creating a new template. </p> * * @param template the string form of the template from url-template-config. * @param knownTokens The set of known tokens for a valid template. @@ -75,7 +77,7 @@ * <p> Note that this is not truly a complete copy because the Map * of the replacement values for the given tokens is not copied. * This copy will just have an empty map of token values so that - * it is "cleared" and ready to format another URL. + * it is "cleared" and ready to format another URL. </p> * * @param template the URLTemplate to copy. */ @@ -89,7 +91,9 @@ } /** - * Set the String form of the template. + * Reset the String form of the template. + * + * <p> Should call verify after setting a new template. </p> * * @param template the string form of the template from url-template-config. */ @@ -138,7 +142,7 @@ if ( index != -1 ) { if ( _template.charAt( index - 1 ) != BEGIN_TOKEN_QUALIFIER - && _template.charAt( index + token.length() ) != END_TOKEN_QUALIFIER ) + || _template.charAt( index + token.length() ) != END_TOKEN_QUALIFIER ) { throw new IllegalStateException( "Template token, " + token + ", is not correctly enclosed with braces in template: " + _template );
Added: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplateDescriptor.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplateDescriptor.java?view=auto&rev=149370 ============================================================================== --- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplateDescriptor.java (added) +++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplateDescriptor.java Mon Jan 31 20:47:19 2005 @@ -0,0 +1,145 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package org.apache.beehive.netui.core.urltemplates; + +import org.apache.beehive.netui.util.logging.Logger; + +import javax.servlet.ServletContext; +import java.util.Arrays; +import java.util.List; + +/** + * Maintains optional deployment information about templates and the + * URL template config file. + */ +public class URLTemplateDescriptor +{ + // App descriptor + private static final String DESCRIPTOR_PATH = "/WEB-INF/url-template-config.xml"; + + // Logger + private static final Logger _log = new Logger( URLTemplateDescriptor.class ); + + // Singleton instance + private static URLTemplateDescriptor instance = new URLTemplateDescriptor(); + + // Constants for URL template types + public static final String DEFAULT_TEMPLATE = "default"; + public static final String SECURE_DEFAULT_TEMPLATE = "secure-default"; + public static final String ACTION_TEMPLATE = "action"; + public static final String SECURE_ACTION_TEMPLATE = "secure-action"; + public static final String RESOURCE_TEMPLATE = "resource"; + public static final String SECURE_RESOURCE_TEMPLATE = "secure-resource"; + public static final String RENDER_TEMPLATE = "render"; + public static final String SECURE_RENDER_TEMPLATE = "secure-render"; + + // Tokens + public static final String SCHEME_TOKEN = "{url:scheme}"; + public static final String DOMAIN_TOKEN = "{url:domain}"; + public static final String PORT_TOKEN = "{url:port}"; + public static final String PATH_TOKEN = "{url:path}"; + public static final String QUERY_STRING_TOKEN = "{url:queryString}"; + + private static final List<String> KNOWN_TEMPLATE_TOKENS = + Arrays.asList( SCHEME_TOKEN, DOMAIN_TOKEN, PORT_TOKEN ); + + private static final List<String> REQUIRED_TEMPLATE_TOKENS = + Arrays.asList( PATH_TOKEN, QUERY_STRING_TOKEN ); + + // URL templates + private URLTemplates _urlTemplates = new URLTemplates(); + + private boolean _loaded = false; + + /** + * Constructs an instance. + */ + protected URLTemplateDescriptor() + { + } + + /** + * Returns URL template given the name of the template. + * + * @param name name of the template + * @return template + */ + public URLTemplate getURLTemplate( String name ) + { + return _urlTemplates.getTemplate( name ); + } + + /** + * Returns URL template name of the given type (by key). + * + * @param refGroupName name of a group of templates from the config file. + * @param key type of the template + * @return template name + */ + public String getURLTemplateRef( String refGroupName, String key ) + { + String ref = _urlTemplates.getTemplateNameByRef( refGroupName, key ); + if ( ref == null ) + { + // If the template is a secure template, look for the secure default + // before resolving to the default + if ( key.equals( SECURE_RENDER_TEMPLATE ) || + key.equals( SECURE_ACTION_TEMPLATE ) || + key.equals( SECURE_RESOURCE_TEMPLATE ) ) + { + ref = _urlTemplates.getTemplateNameByRef( refGroupName, SECURE_DEFAULT_TEMPLATE ); + } + } + + return ref; + } + + /** + * Returns an instance of <code>URLTemplateDescriptor</code>. + * + * @return portal app descriptor + */ + public static URLTemplateDescriptor getInstance() + { + return instance; + } + + public synchronized void load( ServletContext servletContext ) + { + if ( _loaded ) + { + return; + } + + try + { + URLTemplatesFactory.setKnownTokens( KNOWN_TEMPLATE_TOKENS ); + URLTemplatesFactory.setRequiredTokens( REQUIRED_TEMPLATE_TOKENS ); + _urlTemplates = URLTemplatesFactory.getTemplates( servletContext ); + } + catch ( Exception e ) + { + // Bad descriptor + _log.error( "Exception while loading URL templates, " + DESCRIPTOR_PATH, e ); + } + + _loaded = true; + } +} + + Propchange: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplateDescriptor.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplates.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplates.java?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplates.java (original) +++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplates.java Mon Jan 31 20:47:19 2005 @@ -31,6 +31,9 @@ /** * Add a template from url-template-config by name. + * + * @param templateName the name of the template. + * @param template the template to add. */ public void addTemplate( String templateName, URLTemplate template ) { @@ -56,6 +59,7 @@ * the same parsed template structure, without requiring * it to be parsed for each request. * + * @param templateName the name of the template. * @return a URLTemplate copy with its own empty map for storing * token replacement values. */ @@ -69,6 +73,9 @@ /** * Add a template reference group from url-template-config by name. + * + * @param refGroupName the name of the template reference group. + * @param templateRefGroup the template reference group. */ public void addTemplateRefGroup( String refGroupName, Map< String, String > templateRefGroup ) { @@ -87,6 +94,10 @@ /** * Retrieve a template name from a reference group in url-template-config. + * + * @param refGroupName the name of the template reference group. + * @param key the key to the particular template reference in the group. + * @return a template name from the reference group. */ public String getTemplateNameByRef( String refGroupName, String key ) { Modified: incubator/beehive/trunk/netui/test/ant/junitCore.xml URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/ant/junitCore.xml?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/ant/junitCore.xml (original) +++ incubator/beehive/trunk/netui/test/ant/junitCore.xml Mon Jan 31 20:47:19 2005 @@ -41,7 +41,11 @@ <sysproperty key="netuidrt.logdir" path="${testout.dir}"/> <test name="org.apache.beehive.netui.test.util.type.TypeUtilsTest" todir="${testout.dir}"/> <test name="org.apache.beehive.netui.test.util.config.ConfigTest" todir="${testout.dir}"/> - <test name="org.apache.beehive.netui.test.core.urls.MutableURITest" todir="${testout.dir}"/> + <batchtest fork="yes" todir="${testout.dir}"> + <fileset dir="${test.classes.dir}/junitTests"> + <include name="org/apache/beehive/netui/test/core/**/*Test.class"/> + </fileset> + </batchtest> <test name="org.apache.beehive.netui.test.databinding.expression.IndexedNameTest" todir="${testout.dir}"/> <test name="org.apache.beehive.netui.test.script.simpleaction.InternalExpressionUtilsTest" todir="${testout.dir}"/> <batchtest fork="yes" todir="${testout.dir}"> Added: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/FreezableMutableURITest.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/FreezableMutableURITest.java?view=auto&rev=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/FreezableMutableURITest.java (added) +++ incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/FreezableMutableURITest.java Mon Jan 31 20:47:19 2005 @@ -0,0 +1,465 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package org.apache.beehive.netui.test.core.urls; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.apache.beehive.netui.core.urls.FreezableMutableURI; +import org.apache.beehive.netui.core.urls.MutableURI; + +/** + * FreezableMutableURI JUnit TestCase. + */ +public class FreezableMutableURITest extends TestCase +{ + // + // Strings for tests. Elements are... + // encoding, scheme, user info, host, port, path, query, fragment, result + // + private String[][] _tests = + { + // test for relative path + query + { null, null, null, null, + "../test/start.jsp", "skip=true", null, + "../test/start.jsp?skip=true" }, + + // test for path + query + { null, null, null, null, + "/portal/MockPortal.jsp", + "smokeTestAaltAction=goNested&smokeTestA_submit=true", null, + "/portal/MockPortal.jsp?smokeTestAaltAction=goNested&smokeTestA_submit=true" }, + + // test for scheme + host + path + { "https", null, "localhost", null, + "/tomcat-docs/jasper/docs/api/index.html", null, null, + "https://localhost/tomcat-docs/jasper/docs/api/index.html" }, + + // test for scheme + host + path + fragment + { "http", null, "localhost", "8080", "/", + null, "myFragment", "http://localhost:8080/#myFragment" }, + + // test for query parameter names without values and multiple + // instances of the same parameter name + { "http", null, "localhost", "8080", + "/test-servlet/TestServlet", "param1¶m1=¶m2", null, + "http://localhost:8080/test-servlet/TestServlet?param1¶m1=¶m2" }, + + // test for query with escaped characters + { "http", null, "localhost", "8080", + "/test-servlet/TestServlet", + "textId=%C4%F3%BD%D0%BA%D1%A4%DF&spacesAmpQuotes=%22text%20space1%20%26%20space2%22&tags=%3CsomeTag%3E&percent=100%25tilda=%7Etilda", null, + "http://localhost:8080/test-servlet/TestServlet?textId=%C4%F3%BD%D0%BA%D1%A4%DF&spacesAmpQuotes=%22text%20space1%20%26%20space2%22&tags=%3CsomeTag%3E&percent=100%25tilda=%7Etilda" } + }; + + public FreezableMutableURITest( String name ) + { + super( name ); + } + + public static void main( String[] args ) + { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() + { + return new TestSuite( FreezableMutableURITest.class ); + } + + protected void setUp() + { + } + + protected void tearDown() + { + } + + public void testConstructors() + { + for ( int i = 0; i < _tests.length; i++ ) + { + String scheme = _tests[i][0]; + String userInfo = _tests[i][1]; + String host = _tests[i][2]; + int port = FreezableMutableURI.UNDEFINED_PORT; + String integer = _tests[i][3]; + if ( integer != null && integer.trim().length() > 0 ) + { + port = Integer.parseInt( integer ); + } + String path = _tests[i][4]; + String query = _tests[i][5]; + String fragment = _tests[i][6]; + String uriString = _tests[i][7]; + + try + { + FreezableMutableURI uri = new FreezableMutableURI( scheme, userInfo, host, port, + path, query, fragment ); + assertEquals( uriString, uri.getURIString() ); + FreezableMutableURI other = new FreezableMutableURI( uriString ); + assertEquals( uri, other ); + other = new FreezableMutableURI( new URI( uriString ) ); + assertEquals( uri, other ); + } + catch ( URISyntaxException e ) + { + fail( "Test failed for URI, \"" + uriString + "\", with a URISyntaxException: " + e.getMessage() ); + } + } + } + + public void testSetters() + { + for ( int i = 0; i < _tests.length; i++ ) + { + String scheme = _tests[i][0]; + String userInfo = _tests[i][1]; + String host = _tests[i][2]; + int port = FreezableMutableURI.UNDEFINED_PORT; + String integer = _tests[i][3]; + if ( integer != null && integer.trim().length() > 0 ) + { + port = Integer.parseInt( integer ); + } + String path = _tests[i][4]; + String query = _tests[i][5]; + String fragment = _tests[i][6]; + String uriString = _tests[i][7]; + + try + { + FreezableMutableURI uri = new FreezableMutableURI(); + uri.setScheme( scheme ); + uri.setHost( host ); + uri.setUserInfo( userInfo ); + uri.setPort( port ); + uri.setPath( path ); + uri.setQuery( query ); + uri.setFragment( fragment ); + assertEquals( uriString, uri.getURIString() ); + + FreezableMutableURI other = new FreezableMutableURI( uriString ); + assertEquals( uri, other ); + } + catch ( URISyntaxException e ) + { + fail( "Test failed for URI, \"" + uriString + "\", with a URISyntaxException: " + e.getMessage() ); + } + } + } + + public void testSettersWhenFrozen() + { + String uriString = "http://localhost:8080/test-servlet/TestServlet?param1¶m2"; + FreezableMutableURI uri = null; + try + { + uri = new FreezableMutableURI( uriString ); + } + catch ( URISyntaxException e ) + { + fail( "Test failed for URI, \"" + uriString + "\", with a URISyntaxException: " + e.getMessage() ); + } + + assertEquals( uriString, uri.getURIString() ); + assertFalse( uri.isFrozen() ); + uri.setFrozen( true ); + assertTrue( uri.isFrozen() ); + + boolean threw = false; + try + { + uri.setScheme( "https" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.setHost( "localhost" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.setUserInfo( "userInfo" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.setPort( 8443 ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.setPath( "/servlets/TestServlet" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.setQuery( "foo=bar" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.setFragment( "fragment" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.addParameter( "name", "value", true ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + uri.removeParameter( "param1" ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + HashMap map = new HashMap(); + uri.addParameters( map, true ); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + } + + public void testGettersWhenFrozen() + { + for ( int i = 0; i < _tests.length; i++ ) + { + String scheme = _tests[i][0]; + String userInfo = _tests[i][1]; + String host = _tests[i][2]; + int port = FreezableMutableURI.UNDEFINED_PORT; + String integer = _tests[i][3]; + if ( integer != null && integer.trim().length() > 0 ) + { + port = Integer.parseInt( integer ); + } + String path = _tests[i][4]; + String query = _tests[i][5]; + String fragment = _tests[i][6]; + String uriString = _tests[i][7]; + + try + { + FreezableMutableURI uri = new FreezableMutableURI( uriString ); + assertFalse( uri.isFrozen() ); + uri.setFrozen( true ); + assertTrue( uri.isFrozen() ); + assertEquals( uriString, uri.getURIString() ); + assertEquals( uri.getScheme(), scheme ); + assertEquals( uri.getHost(), host ); + assertEquals( uri.getUserInfo(), userInfo ); + assertEquals( uri.getPort(), port ); + assertEquals( uri.getPath(), path ); + assertEquals( uri.getQuery(), query ); + assertEquals( uri.getFragment(), fragment ); + } + catch ( URISyntaxException e ) + { + fail( "Test failed for URI, \"" + uriString + "\", with a URISyntaxException: " + e.getMessage() ); + } + } + } + + public void testgetURIStringForXML() + { + FreezableMutableURI uri = new FreezableMutableURI(); + uri.setScheme( "https" ); + uri.setHost( "localhost" ); + uri.setPort( 443 ); + uri.setPath( "/test" ); + uri.setQuery( "param1¶m2¶m3=¶m3=true¶m4=true" ); + String xmlString = "https://localhost:443/test?param1&param2&param3=&param3=true&param4=true"; + assertEquals( uri.getURIStringForXML(), xmlString ); + } + + public void testEquals() + { + // + // Note that the current implementation MutableURI, with query + // parameters stored in a LinkedHashMap of Lists, has the + // potential to change order of params in the query... such + // as this example. So the resulting string has params in a + // different order. However equality should still hold true. + // + String uriString = "https://localhost:443/test?param1¶m1=¶m1=true¶m2¶m3=true"; + + try + { + FreezableMutableURI uriA = new FreezableMutableURI(); + uriA.setScheme( "https" ); + uriA.setHost( "localhost" ); + uriA.setPort( 443 ); + uriA.setPath( "/test" ); + uriA.setQuery( "param1¶m2¶m1=¶m3=true¶m1=true" ); + + FreezableMutableURI uriB = new FreezableMutableURI( uriString ); + assertEquals( uriA.getURIString(), uriString ); + assertEquals( uriA.getURIString(), uriB.getURIString() ); + + FreezableMutableURI uriC = new FreezableMutableURI( new URI( uriString ) ); + + // Test all properties of equality... + // 1. hashCodes are equal + assertEquals( uriA.hashCode(), uriB.hashCode() ); + + // 2. reflexive + assertTrue( uriA.equals( uriA ) ); + + // 3. symmetric + assertTrue( uriA.equals( uriB ) ); + assertTrue( uriB.equals( uriA ) ); + + // 4. transitive + assertTrue( uriA.equals( uriB ) ); + assertTrue( uriB.equals( uriC ) ); + assertTrue( uriC.equals( uriA ) ); + + // 5. consistent + uriC.setPath( "/differentPath" ); + assertFalse( uriC.equals( uriA ) ); + + // 6. x.equals(null) should return false. + assertFalse( uriA.equals( null ) ); + + // and subclasses return false as not to break the symmetric property + class AnotherMutableURI extends FreezableMutableURI + { + boolean reference = true; + + AnotherMutableURI( URI uri ) + { + super( uri ); + } + + void setReference( boolean ref ) + { + reference = ref; + } + + boolean isReference() + { + return reference; + } + } + + AnotherMutableURI another = new AnotherMutableURI( new URI( uriString ) ); + assertFalse( uriA.equals( another ) ); + + // and superclasses return false as not to break the symmetric property + MutableURI mutableURI = new MutableURI( new URI( uriString ) ); + assertFalse( uriA.equals( mutableURI ) ); + + // test the frozen attribute + assertTrue( uriA.equals( uriB ) ); + uriA.setFrozen( true ); + assertFalse( uriA.equals( uriB ) ); + } + catch ( URISyntaxException e ) + { + fail( "Test failed for URI, \"" + uriString + "\", with a URISyntaxException: " + e.getMessage() ); + } + } + + // basic diagnostic utility when writing tests + private void dumpURI( FreezableMutableURI uri ) + { + if ( uri == null ) + { + System.out.println( "uri == null" ); + } + else + { + System.out.println( "uri: " + uri.getURIString() ); + System.out.println( "uri - XML: " + uri.getURIStringForXML() ); + System.out.println( "scheme: " + uri.getScheme() ); + System.out.println( "user info: " + uri.getUserInfo() ); + System.out.println( "host: " + uri.getHost() ); + System.out.println( "port: " + uri.getPort() ); + System.out.println( "path: " + uri.getPath() ); + System.out.println( "query: " + uri.getQuery() ); + System.out.println( "query XML: " + uri.getQueryForXML() ); + System.out.println( "fragment: " + uri.getFragment() ); + System.out.println( "encoding: " + uri.getEncoding() ); + } + } +} Propchange: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/FreezableMutableURITest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java (original) +++ incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java Mon Jan 31 20:47:19 2005 @@ -149,7 +149,7 @@ { MutableURI uri = new MutableURI( scheme, userInfo, host, port, path, query, fragment ); - assertEquals( uriString, uri.toString() ); + assertEquals( uriString, uri.getURIString() ); MutableURI other = new MutableURI( uriString ); assertEquals( uri, other ); other = new MutableURI( new URI( uriString ) ); @@ -190,7 +190,7 @@ uri.setPath( path ); uri.setQuery( query ); uri.setFragment( fragment ); - assertEquals( uriString, uri.toString() ); + assertEquals( uriString, uri.getURIString() ); MutableURI other = new MutableURI( uriString ); assertEquals( uri, other ); @@ -223,13 +223,13 @@ try { MutableURI uri = new MutableURI( uriString ); - assertEquals( uriString, uri.toString() ); + assertEquals( uriString, uri.getURIString() ); assertEquals( uri.getScheme(), scheme ); assertEquals( uri.getHost(), host ); assertEquals( uri.getUserInfo(), userInfo ); assertEquals( uri.getPort(), port ); assertEquals( uri.getPath(), path ); - assertEquals( uri.getQuery( "&" ), query ); + assertEquals( uri.getQuery(), query ); assertEquals( uri.getFragment(), fragment ); } catch ( URISyntaxException e ) @@ -368,8 +368,8 @@ String mark = "hyph-un_per.ex!tilda~ast*ap'lp(rp)"; utf8EncodedUri.addParameter( reserved, mark, false ); eucJPEncodedUri.addParameter( reserved, mark, false ); - assertEquals( utf8EncodedUri.toString(), eucJPEncodedUri.toString() ); - assertEquals( utf8EncodedUri.getQuery( "&" ), + assertEquals( utf8EncodedUri.getURIString(), eucJPEncodedUri.getURIString() ); + assertEquals( utf8EncodedUri.getQuery(), "semi%3Bslash%2Fquest%3Fcolon%3Aat%40and%26equ%3Dplus%2Bdoller%24comm%2C" + "=" + "hyph-un_per.ex%21tilda%7East*ap%27lp%28rp%29" ); @@ -380,8 +380,8 @@ String excluded = "space " + delims; utf8EncodedUri.addParameter( unwise, excluded, false ); eucJPEncodedUri.addParameter( unwise, excluded, false ); - assertEquals( utf8EncodedUri.toString(), eucJPEncodedUri.toString() ); - assertEquals( utf8EncodedUri.getQuery( "&" ), + assertEquals( utf8EncodedUri.getURIString(), eucJPEncodedUri.getURIString() ); + assertEquals( utf8EncodedUri.getQuery(), "lcb%7Brcb%7Dbar%7Cbs%5Cctr%5Elb%5Brb%5Dlq%60" + "=" + "space+lt%3Cgt%3Elb%23perc%25%22quotes%22" ); @@ -392,14 +392,14 @@ String japaneseUnicode = "\u63d0\u51fa\u6e08\u307f"; utf8EncodedUri.addParameter( name, japaneseUnicode, false ); eucJPEncodedUri.addParameter( name, japaneseUnicode, false ); - assertFalse( utf8EncodedUri.toString().equals( eucJPEncodedUri.toString() ) ); - assertEquals( utf8EncodedUri.getQuery( "&" ), + assertFalse( utf8EncodedUri.getURIString().equals( eucJPEncodedUri.getURIString() ) ); + assertEquals( utf8EncodedUri.getQuery(), name + "=" + "%E6%8F%90%E5%87%BA%E6%B8%88%E3%81%BF" ); - assertEquals( eucJPEncodedUri.getQuery( "&" ), + assertEquals( eucJPEncodedUri.getQuery(), name + "=" + "%C4%F3%BD%D0%BA%D1%A4%DF" ); } - public void testToXMLString() + public void testgetURIStringForXML() { MutableURI uri = new MutableURI(); uri.setScheme( "https" ); @@ -408,7 +408,7 @@ uri.setPath( "/test" ); uri.setQuery( "param1¶m2¶m3=¶m3=true¶m4=true" ); String xmlString = "https://localhost:443/test?param1&param2&param3=&param3=true&param4=true"; - assertEquals( uri.toXMLString(), xmlString ); + assertEquals( uri.getURIStringForXML(), xmlString ); } public void testEquals() @@ -432,14 +432,14 @@ uriA.setQuery( "param1¶m2¶m1=¶m3=true¶m1=true" ); MutableURI uriB = new MutableURI( uriString ); - assertEquals( uriA.toString(), uriString ); - assertEquals( uriA.toString(), uriB.toString() ); + assertEquals( uriA.getURIString(), uriString ); + assertEquals( uriA.getURIString(), uriB.getURIString() ); MutableURI uriC = new MutableURI( new URI( uriString ) ); // Test all properties of equality... // 1. hashCodes are equal - assertEquals( uriA.hashCode(), uriA.hashCode() ); + assertEquals( uriA.hashCode(), uriB.hashCode() ); // 2. reflexive assertTrue( uriA.equals( uriA ) ); @@ -491,14 +491,15 @@ } else { - System.out.println( "string: " + uri.toString() ); - System.out.println( "XML string: " + uri.toXMLString() ); + System.out.println( "uri: " + uri.getURIString() ); + System.out.println( "uri - XML: " + uri.getURIStringForXML() ); System.out.println( "scheme: " + uri.getScheme() ); System.out.println( "user info: " + uri.getUserInfo() ); System.out.println( "host: " + uri.getHost() ); System.out.println( "port: " + uri.getPort() ); System.out.println( "path: " + uri.getPath() ); - System.out.println( "query: " + uri.getQuery( "&" ) ); + System.out.println( "query: " + uri.getQuery() ); + System.out.println( "query XML: " + uri.getQueryForXML() ); System.out.println( "fragment: " + uri.getFragment() ); System.out.println( "encoding: " + uri.getEncoding() ); } Added: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplateTest.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplateTest.java?view=auto&rev=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplateTest.java (added) +++ incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplateTest.java Mon Jan 31 20:47:19 2005 @@ -0,0 +1,142 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package org.apache.beehive.netui.test.core.urltemplates; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.apache.beehive.netui.core.urltemplates.URLTemplate; +import org.apache.beehive.netui.core.urltemplates.URLTemplateDescriptor; + +/** + * URLTemplate JUnit TestCase. + */ +public class URLTemplateTest extends TestCase +{ + + private static final List<String> KNOWN_TEMPLATE_TOKENS = + Arrays.asList( URLTemplateDescriptor.SCHEME_TOKEN, URLTemplateDescriptor.DOMAIN_TOKEN, + URLTemplateDescriptor.PORT_TOKEN ); + + private static final List<String> REQUIRED_TEMPLATE_TOKENS = + Arrays.asList( URLTemplateDescriptor.PATH_TOKEN, URLTemplateDescriptor.QUERY_STRING_TOKEN ); + + public URLTemplateTest( String name ) + { + super( name ); + } + + public static void main( String[] args ) + { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() + { + return new TestSuite( URLTemplateTest.class ); + } + + protected void setUp() + { + } + + protected void tearDown() + { + } + + public void testVerifyTemplate() + { + String name = "test-template"; + String temp = "{url:scheme}://{url:domain}:{url:port}/{url:path}?{url:queryString}"; + URLTemplate urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + urlTemplate.verify(); + assertEquals( temp, urlTemplate.getTemplate() ); + assertEquals( temp, urlTemplate.toString() ); + } + + public void testVerifyBadTemplate() + { + // badly formatted known token, {uri:domain} + String name = "test-bad-template"; + String temp = "{url:scheme}://url:domain}:{url:port}/{url:path}?{url:queryString}"; + URLTemplate urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + boolean threw = false; + try + { + urlTemplate.verify(); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + // missing required token + temp = "{url:scheme}://{url:domain}:{url:port}/{url:path}"; + urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + threw = false; + try + { + urlTemplate.verify(); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + + // another missing required token + temp = "{url:scheme}://{url:domain}:{url:port}/?{url:queryString}"; + urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + threw = false; + try + { + urlTemplate.verify(); + } + catch ( IllegalStateException e ) + { + threw = true; + } + assertTrue( threw ); + } + + public void testSubstitute() + { + String name = "test-template"; + String temp = "{url:scheme}://{url:domain}:{url:port}/{url:path}?{url:queryString}{url:currentPage}"; + String intermediateResult = "https://myhost.com:8443/my/path?param1=true&foo{url:currentPage}"; + String result = "https://myhost.com:8443/my/path?param1=true&foo"; + URLTemplate urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + urlTemplate.verify(); + urlTemplate.substitute( "{url:domain}", "myhost.com" ); + urlTemplate.substitute( "{url:port}", 8443 ); + HashMap< String, String > tokensAndValues = new HashMap< String, String >(); + tokensAndValues.put( "{url:scheme}", "https" ); + tokensAndValues.put( "{url:path}", "/my/path" ); + tokensAndValues.put( "{url:queryString}", "param1=true&foo" ); + urlTemplate.substitute( tokensAndValues ); + assertEquals( intermediateResult, urlTemplate.toString() ); + urlTemplate.substitute( "{url:currentPage}", "" ); + assertEquals( result, urlTemplate.toString() ); + } +} Propchange: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplateTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplatesTest.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplatesTest.java?view=auto&rev=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplatesTest.java (added) +++ incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplatesTest.java Mon Jan 31 20:47:19 2005 @@ -0,0 +1,258 @@ +/* + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Header:$ + */ +package org.apache.beehive.netui.test.core.urltemplates; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.apache.beehive.netui.core.urltemplates.URLTemplate; +import org.apache.beehive.netui.core.urltemplates.URLTemplateDescriptor; +import org.apache.beehive.netui.core.urltemplates.URLTemplates; + +/** + * URLTemplates JUnit TestCase. + */ +public class URLTemplatesTest extends TestCase +{ + // Strings to test templates... + private static String[][] _templateStrings = + { + { "default", "{url:scheme}://{url:domain}:{url:port}/{url:path}?{url:queryString}{url:currentPage}" }, + { "jpf-action", "http://{url:domain}:{url:port}/{url:path}?jpf=action&{url:queryString}" }, + { "jpf-secure-action", "https://{url:domain}:{url:port}/{url:path}?jpf=action&{url:queryString}" }, + { "jpf-resource", "http://{url:domain}:{url:port}/{url:path}?jpf=resource&{url:queryString}" }, + { "jpf-secure-resource", "https://{url:domain}:{url:port}/{url:path}?jpf=resource&{url:queryString}" }, + { "jpf-resource", "http://{url:domain}:{url:port}/{url:path}?jpf=resource&{url:queryString}" }, + { "jpf-secure-resource", "https://{url:domain}:{url:port}/{url:path}?jpf=resource&{url:queryString}" }, + { "wsrp-action", "http://{url:domain}:{url:port}/{url:path}?wsrp=action&{url:queryString}" }, + { "wsrp-secure-action", "https://{url:domain}:{url:port}/{url:path}?wsrp=action&{url:queryString}" }, + { "wsrp-resource", "http://{url:domain}:{url:port}/{url:path}?wsrp=resource&{url:queryString}" }, + { "wsrp-secure-resource", "https://{url:domain}:{url:port}/{url:path}?wsrp=resource&{url:queryString}" }, + { "wsrp-resource", "http://{url:domain}:{url:port}/{url:path}?wsrp=resource&{url:queryString}" }, + { "wsrp-secure-resource", "https://{url:domain}:{url:port}/{url:path}?wsrp=resource&{url:queryString}" }, + { "wsrp-render", "http://{url:domain}:{url:port}/{url:path}?wsrp=render&{url:queryString}" }, + { "wsrp-secure-render", "https://{url:domain}:{url:port}/{url:path}?wsrp=render&{url:queryString}" }, + { "extraVarTemplate", "{url:scheme}://{url:domain}:{url:port}/{url:path}?{url:queryString}{url:currentPage}&{foo:bar}" } + }; + + // Strings to test template reference groups... + // refGroupName, then template names for action, secure-action, resource. and secure-resource key's + private static String[][] _refGroups = + { + { "default-url-templates", "jpf-action", "jpf-secure-action", "jpf-resource", "jpf-secure-resource" }, + { "wsrp-url-templates", "wsrp-action", "wsrp-secure-action", "wsrp-resource", "wsrp-secure-resource" } + }; + + private static final List<String> KNOWN_TEMPLATE_TOKENS = + Arrays.asList( URLTemplateDescriptor.SCHEME_TOKEN, URLTemplateDescriptor.DOMAIN_TOKEN, + URLTemplateDescriptor.PORT_TOKEN ); + + private static final List<String> REQUIRED_TEMPLATE_TOKENS = + Arrays.asList( URLTemplateDescriptor.PATH_TOKEN, URLTemplateDescriptor.QUERY_STRING_TOKEN ); + + private URLTemplates _urlTemplates = new URLTemplates(); + + public URLTemplatesTest( String name ) + { + super( name ); + } + + public static void main( String[] args ) + { + junit.textui.TestRunner.run( suite() ); + } + + public static Test suite() + { + return new TestSuite( URLTemplatesTest.class ); + } + + protected void setUp() + { + for (int i = 0; i < _templateStrings.length; i++) + { + String name = _templateStrings[i][0]; + String temp = _templateStrings[i][1]; + URLTemplate urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + urlTemplate.verify(); + _urlTemplates.addTemplate( name, urlTemplate ); + } + } + + protected void tearDown() + { + } + + public void testAddAndGetTemplate() + { + String name = "test-template"; + String temp = "{url:scheme}://{url:domain}:{url:port}/{url:path}?{url:queryString}"; + URLTemplate urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + urlTemplate.verify(); + _urlTemplates.addTemplate( name, urlTemplate ); + + // Note that getTemplate() returns a copy so a test on should fail. + URLTemplate returnedTemplate = _urlTemplates.getTemplate( name ); + assertFalse( urlTemplate == returnedTemplate ); + assertEquals( temp, returnedTemplate.getTemplate() ); + + for (int i = 0; i < _templateStrings.length; i++) + { + name = _templateStrings[i][0]; + temp = _templateStrings[i][1]; + urlTemplate = _urlTemplates.getTemplate( name ); + assertTrue( urlTemplate != null ); + assertEquals( temp, urlTemplate.getTemplate() ); + } + } + + public void testAddBadTemplate() + { + String name = "test-bad-template"; + String temp = "{url:scheme}://{url:domain}:{url:port}/{url:path}?{url:queryString}"; + URLTemplate urlTemplate = new URLTemplate( temp, KNOWN_TEMPLATE_TOKENS, REQUIRED_TEMPLATE_TOKENS ); + urlTemplate.verify(); + + boolean threw = false; + try + { + _urlTemplates.addTemplate( "", urlTemplate ); + } + catch ( IllegalArgumentException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + _urlTemplates.addTemplate( name, null ); + } + catch ( IllegalArgumentException e ) + { + threw = true; + } + assertTrue( threw ); + } + + public void testAddAndGetTemplateRefGroup() + { + for (int i = 0; i < _refGroups.length; i++) + { + String name = _refGroups[i][0]; + HashMap< String, String > refGroup = new HashMap< String, String >(); + refGroup.put( URLTemplateDescriptor.ACTION_TEMPLATE, _refGroups[i][1] ); + refGroup.put( URLTemplateDescriptor.SECURE_ACTION_TEMPLATE, _refGroups[i][2] ); + refGroup.put( URLTemplateDescriptor.RESOURCE_TEMPLATE, _refGroups[i][3] ); + refGroup.put( URLTemplateDescriptor.SECURE_RESOURCE_TEMPLATE, _refGroups[i][4] ); + _urlTemplates.addTemplateRefGroup( name, refGroup ); + } + + for (int i = 0; i < _refGroups.length; i++) + { + String group = _refGroups[i][0]; + String key = URLTemplateDescriptor.ACTION_TEMPLATE; + String name = _urlTemplates.getTemplateNameByRef( group, key ); + assertEquals( _refGroups[i][1], name ); + URLTemplate urlTemplate = _urlTemplates.getTemplate( name ); + assertTrue( urlTemplate != null ); + + key = URLTemplateDescriptor.SECURE_ACTION_TEMPLATE; + name = _urlTemplates.getTemplateNameByRef( group, key ); + assertEquals( _refGroups[i][2], name ); + urlTemplate = _urlTemplates.getTemplate( name ); + assertTrue( urlTemplate != null ); + + key = URLTemplateDescriptor.RESOURCE_TEMPLATE; + name = _urlTemplates.getTemplateNameByRef( group, key ); + assertEquals( _refGroups[i][3], name ); + urlTemplate = _urlTemplates.getTemplate( name ); + assertTrue( urlTemplate != null ); + + key = URLTemplateDescriptor.SECURE_RESOURCE_TEMPLATE; + name = _urlTemplates.getTemplateNameByRef( group, key ); + assertEquals( _refGroups[i][4], name ); + urlTemplate = _urlTemplates.getTemplate( name ); + assertTrue( urlTemplate != null ); + } + + } + + public void testAddBadTemplateRefGroup() + { + HashMap< String, String > refGroup = new HashMap< String, String >(); + + // null ref group + boolean threw = false; + try + { + _urlTemplates.addTemplateRefGroup( "refGroupName", null ); + } + catch ( IllegalArgumentException e ) + { + threw = true; + } + assertTrue( threw ); + + // empty ref group + threw = false; + try + { + _urlTemplates.addTemplateRefGroup( "refGroupName", refGroup ); + } + catch ( IllegalArgumentException e ) + { + threw = true; + } + assertTrue( threw ); + + String name = _refGroups[0][0]; + refGroup.put( URLTemplateDescriptor.ACTION_TEMPLATE, _refGroups[0][1] ); + refGroup.put( URLTemplateDescriptor.SECURE_ACTION_TEMPLATE, _refGroups[0][2] ); + refGroup.put( URLTemplateDescriptor.RESOURCE_TEMPLATE, _refGroups[0][3] ); + refGroup.put( URLTemplateDescriptor.SECURE_RESOURCE_TEMPLATE, _refGroups[0][4] ); + + threw = false; + try + { + _urlTemplates.addTemplateRefGroup( null, refGroup ); + } + catch ( IllegalArgumentException e ) + { + threw = true; + } + assertTrue( threw ); + + threw = false; + try + { + _urlTemplates.addTemplateRefGroup( "", refGroup ); + } + catch ( IllegalArgumentException e ) + { + threw = true; + } + assertTrue( threw ); + } +} Propchange: incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/URLTemplatesTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/pageFlowUtils/index.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/pageFlowUtils/index.jsp?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/pageFlowUtils/index.jsp (original) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/pageFlowUtils/index.jsp Mon Jan 31 20:47:19 2005 @@ -139,7 +139,7 @@ <%= PageFlowUtils.getActionOutput( "bar", request ) %><br> <code>getActionURI( cxt, request, response, "begin" )</code>: - <%= PageFlowUtils.getActionURI( cxt, request, response, "begin" ) %><br> + <%= PageFlowUtils.getActionURI( cxt, request, response, "begin" ).getURIString() %><br> <% java.util.HashMap params = new java.util.HashMap(); params.put( "foo", "bar" ); %> <code>PageFlowUtils.getRewrittenActionURI( cxt, request, response, "begin", params, "frag", true )</code>: Modified: incubator/beehive/trunk/netui/test/webapps/urlTemplates/testRecorder/tests/UrlTemplates.xml URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/urlTemplates/testRecorder/tests/UrlTemplates.xml?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/urlTemplates/testRecorder/tests/UrlTemplates.xml (original) +++ incubator/beehive/trunk/netui/test/webapps/urlTemplates/testRecorder/tests/UrlTemplates.xml Mon Jan 31 20:47:19 2005 @@ -90,18 +90,18 @@ <title>URL Templates Test</title> </head> <body> - <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/begin.do?URLTEMPLATE=action"><i>begin action</i></a><br> - <a href="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secure.do?URLTEMPLATE=secure-action"><i>secure action</i></a><br> - <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/unsecure.do?URLTEMPLATE=action"><i>unsecure action</i></a><br> - <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/index.jsp?URLTEMPLATE=action">index.jsp</a><br> - <a href="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secure.jsp?URLTEMPLATE=secure-action">secure.jsp</a><br> - <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/index.jsp?URLTEMPLATE=action&foo=bar">/urlTemplates/testUrlTemplates/index.jsp?foo=bar</a><br> - <a href="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secure.jsp?URLTEMPLATE=secure-action">/urlTemplates/testUrlTemplates/secure.jsp?foo=bar</a><br> + <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/begin.do?URLTEMPLATE=action&"><i>begin action</i></a><br> + <a href="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secure.do?URLTEMPLATE=secure-action&"><i>secure action</i></a><br> + <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/unsecure.do?URLTEMPLATE=action&"><i>unsecure action</i></a><br> + <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/index.jsp?URLTEMPLATE=action&">index.jsp</a><br> + <a href="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secure.jsp?URLTEMPLATE=secure-action&">secure.jsp</a><br> + <a href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/index.jsp?URLTEMPLATE=action&foo=bar">/urlTemplates/testUrlTemplates/index.jsp?foo=bar</a><br> + <a href="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secure.jsp?URLTEMPLATE=secure-action&foo=bar">/urlTemplates/testUrlTemplates/secure.jsp?foo=bar</a><br> <a href="http://www.bea.com?foo=bar">http://www.bea.com?foo=bar</a><br> - image.gif: <img src="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/image.gif?URLTEMPLATE=resource"><br> - /urlTemplates/testUrlTemplates/image.gif: <img src="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/image.gif?URLTEMPLATE=resource"><br> - secureImage.gif: <img src="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secureImage.gif?URLTEMPLATE=secure-resource"><br> - /urlTemplates/testUrlTemplates/secureImage.gif: <img src="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secureImage.gif?URLTEMPLATE=secure-resource"><br> + image.gif: <img src="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/image.gif?URLTEMPLATE=resource&"><br> + /urlTemplates/testUrlTemplates/image.gif: <img src="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/urlTemplates/testUrlTemplates/image.gif?URLTEMPLATE=resource&"><br> + secureImage.gif: <img src="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secureImage.gif?URLTEMPLATE=secure-resource&"><br> + /urlTemplates/testUrlTemplates/secureImage.gif: <img src="https://@NON_UNIQUE_HOST@:8443/urlTemplates/testUrlTemplates/secureImage.gif?URLTEMPLATE=secure-resource&"><br> http://www.bea.com/content/images/bea_logo.gif?foo=bar: <img src="http://www.bea.com/content/images/bea_logo.gif?foo=bar"><br> </body> Modified: incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/WEB-INF/url-template-config.xml URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/WEB-INF/url-template-config.xml?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/WEB-INF/url-template-config.xml (original) +++ incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/WEB-INF/url-template-config.xml Mon Jan 31 20:47:19 2005 @@ -16,7 +16,7 @@ <url-template name="jpf-secure-resource"> https://{url:domain}:8443/{url:path}?URLTEMPLATE=secure-resource&{url:queryString} </url-template> - <url-template-ref-group name="jpf-url-templates"> + <url-template-ref-group name="default-url-templates"> <url-template-ref key="action" template-name="jpf-action"/> <url-template-ref key="secure-action" template-name="jpf-secure-action"/> <url-template-ref key="resource" template-name="jpf-resource"/> Modified: incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/testUrlTemplates/index.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/testUrlTemplates/index.jsp?view=diff&r1=149369&r2=149370 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/testUrlTemplates/index.jsp (original) +++ incubator/beehive/trunk/netui/test/webapps/urlTemplates/urlTemplates/testUrlTemplates/index.jsp Mon Jan 31 20:47:19 2005 @@ -11,7 +11,7 @@ <netui:anchor href="index.jsp">index.jsp</netui:anchor><br> <netui:anchor href="secure.jsp">secure.jsp</netui:anchor><br> <netui:anchor href="/urlTemplates/testUrlTemplates/index.jsp?foo=bar">/urlTemplates/testUrlTemplates/index.jsp?foo=bar</netui:anchor><br> - <netui:anchor href="/urlTemplates/testUrlTemplates/secure.jsp">/urlTemplates/testUrlTemplates/secure.jsp?foo=bar</netui:anchor><br> + <netui:anchor href="/urlTemplates/testUrlTemplates/secure.jsp?foo=bar">/urlTemplates/testUrlTemplates/secure.jsp?foo=bar</netui:anchor><br> <netui:anchor href="http://www.bea.com"> http://www.bea.com?foo=bar <netui:parameter name="foo" value="bar"/>
