gatein SVN: r4028 - components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2.
by do-not-reply@jboss.org
Author: mvanco(a)redhat.com
Date: 2010-09-02 09:02:07 -0400 (Thu, 02 Sep 2010)
New Revision: 4028
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
Log:
WSRP2 Sample portlets
- added new tests for prp, portlet modes (default + custom) - all of them are passing now
- edited test for events with object to have same structure as test for simple events
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2010-09-02 12:55:51 UTC (rev 4027)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2010-09-02 13:02:07 UTC (rev 4028)
@@ -766,10 +766,30 @@
List<NamedString> formParameters = action.getInteractionParams().getFormParameters();
formParameters.add(namedString);
BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
+
+ // check events
+ List<Event> events = actionResponse.getUpdateResponse().getEvents();
+ assertNotNull(events);
+ assertEquals(1, events.size());
+ Event event = events.get(0);
+ assertEquals(new QName("urn:jboss:gatein:samples:event:object", "eventObject"), event.getName());
+ assertEquals(new QName("org.gatein.wsrp.portlet.utils.TestObject"), event.getType());
+ assertEquals("Prabhat", ((TestObject) PayloadUtils.getPayloadAsSerializable(event.getType(), event.getPayload())).getFirstName());
+
+ // send event
+ HandleEvents handleEvents = WSRPTypeFactory.createHandleEvents(null,
+ WSRPTypeFactory.createPortletContext(consumerHandle), WSRPTypeFactory.createDefaultRuntimeContext(), null,
+ WSRPTypeFactory.createDefaultMarkupParams(), WSRPTypeFactory.createEventParams(events, StateChange.READ_ONLY));
+ HandleEventsResponse handleEventsResponse = producer.handleEvents(handleEvents);
+
+ // no failed events
+ List<HandleEventsFailed> failedEvents = handleEventsResponse.getFailedEvents();
+ assertEquals(0, failedEvents.size());
+
GetMarkup markupRequestConsumer = createMarkupRequest(consumerHandle);
- markupRequestConsumer.getMarkupParams().setNavigationalContext(actionResponse.getUpdateResponse().getNavigationalContext());
+ markupRequestConsumer.getMarkupParams().setNavigationalContext(handleEventsResponse.getUpdateResponse().getNavigationalContext());
MarkupResponse response = producer.getMarkup(markupRequestConsumer);
- checkMarkupResponse(response, "Prabhat");
+ checkMarkupResponse(response, "Prabhat", false, true);
}
finally
{
@@ -837,6 +857,95 @@
}
@Test
+ public void testGetMarkupWithPublicRenderParameter() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-prp-portlet.war";
+ deploy(archive);
+
+ NamedString namedString = createNamedString("parameter", "param-value-prp");
+ try
+ {
+ List<String> handles = getHandlesForCurrentlyDeployedArchive();
+ String generatorHandle = null;
+ String consumerHandle = null;
+ for (String portletHandle : handles)
+ {
+ if (portletHandle.contains("Generator"))
+ {
+ generatorHandle = portletHandle;
+ }
+ else if (portletHandle.contains("Consumer"))
+ {
+ consumerHandle = portletHandle;
+ }
+ }
+ PerformBlockingInteraction action = WSRPTypeFactory.createDefaultPerformBlockingInteraction(generatorHandle);
+ List<NamedString> formParameters = action.getInteractionParams().getFormParameters();
+ formParameters.add(namedString);
+ BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
+
+ GetMarkup markupRequestConsumer = createMarkupRequest(consumerHandle);
+ markupRequestConsumer.getMarkupParams().setNavigationalContext(actionResponse.getUpdateResponse().getNavigationalContext());
+ MarkupResponse response = producer.getMarkup(markupRequestConsumer);
+ checkMarkupResponse(response, "param-value-prp", false, true);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithDefaultPortletModes() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-portletmodes-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ GetMarkup getMarkup = createMarkupRequest();
+
+ getMarkup.getMarkupParams().setMode(WSRPConstants.EDIT_MODE);
+ MarkupResponse responseEdit = producer.getMarkup(getMarkup);
+ checkMarkupResponse(responseEdit, "This is EDIT MODE.", false, true);
+
+ getMarkup.getMarkupParams().setMode(WSRPConstants.VIEW_MODE);
+ MarkupResponse responseView = producer.getMarkup(getMarkup);
+ checkMarkupResponse(responseView, "This is VIEW MODE.", false, true);
+
+ getMarkup.getMarkupParams().setMode(WSRPConstants.HELP_MODE);
+ MarkupResponse responseHelp = producer.getMarkup(getMarkup);
+ checkMarkupResponse(responseHelp, "This is HELP MODE.", false, true);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithCustomPortletMode() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-portletmodes-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setMode("test_mode");
+ MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "This is TEST MODE.", false, true);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
public void testGetMarkupNoRegistrationWhenRegistrationRequired() throws Exception
{
configureRegistrationSettings(true, false);
14 years, 3 months
gatein SVN: r4027 - in portal/branches/navcontroller/component/web/controller/src: main/java/org/exoplatform/web/controller/metadata and 3 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-02 08:55:51 -0400 (Thu, 02 Sep 2010)
New Revision: 4027
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
Log:
remov need for multivalued value
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -40,21 +40,21 @@
final String path;
/** The current parameters. */
- final Map<QualifiedName, String[]> parameters;
+ final Map<QualifiedName, String> parameters;
public ControllerContext(String path)
{
this.path = path;
- this.parameters = new HashMap<QualifiedName, String[]>();
+ this.parameters = new HashMap<QualifiedName, String>();
}
- public ControllerContext(String path, Map<QualifiedName, String[]> parameters)
+ public ControllerContext(String path, Map<QualifiedName, String> parameters)
{
this.path = path;
this.parameters = parameters;
}
- public Map<QualifiedName, String[]> getParameters()
+ public Map<QualifiedName, String> getParameters()
{
return parameters;
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -32,28 +32,25 @@
{
/** . */
- private final Map<QualifiedName, String[]> parameters;
+ private final Map<QualifiedName, String> parameters;
public ControllerRefMetaData()
{
- this.parameters = new HashMap<QualifiedName, String[]>();
+ this.parameters = new HashMap<QualifiedName, String>();
}
- public ControllerRefMetaData addParameter(QualifiedName name, String first, String... rest)
+ public ControllerRefMetaData addParameter(QualifiedName name, String value)
{
- String[] value = new String[1 + rest.length];
- value[0] = first;
- System.arraycopy(rest, 0, value, 1, rest.length);
parameters.put(name, value);
return this;
}
- public ControllerRefMetaData addParameter(String name, String first, String... rest)
+ public ControllerRefMetaData addParameter(String name, String value)
{
- return addParameter(new QualifiedName(name), first, rest);
+ return addParameter(new QualifiedName(name), value);
}
- public Map<QualifiedName, String[]> getParameters()
+ public Map<QualifiedName, String> getParameters()
{
return parameters;
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -35,24 +35,24 @@
private final String path;
/** . */
- private final Map<QualifiedName, String[]> parameters;
+ private final Map<QualifiedName, String> parameters;
public ProcessResponse()
{
- this(null, Collections.<QualifiedName, String[]>emptyMap());
+ this(null, Collections.<QualifiedName, String>emptyMap());
}
public ProcessResponse(String path)
{
- this(path, Collections.<QualifiedName, String[]>emptyMap());
+ this(path, Collections.<QualifiedName, String>emptyMap());
}
- public ProcessResponse(Map<QualifiedName, String[]> parameters)
+ public ProcessResponse(Map<QualifiedName, String> parameters)
{
this(null, parameters);
}
- public ProcessResponse(String path, Map<QualifiedName, String[]> parameters)
+ public ProcessResponse(String path, Map<QualifiedName, String> parameters)
{
if (parameters == null)
{
@@ -67,7 +67,7 @@
return path;
}
- public Map<QualifiedName, String[]> getParameters()
+ public Map<QualifiedName, String> getParameters()
{
return parameters;
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -24,7 +24,6 @@
import org.exoplatform.web.controller.protocol.ProcessResponse;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -54,7 +53,7 @@
final List<PatternRoute> patternRoutes;
/** . */
- final Map<QualifiedName, String[]> routeParameters;
+ final Map<QualifiedName, String> routeParameters;
protected Route(Route parent)
{
@@ -68,7 +67,7 @@
this.terminal = false;
this.simpleRoutes = new LinkedHashMap<String, SimpleRoute>();
this.patternRoutes = new ArrayList<PatternRoute>();
- this.routeParameters = new HashMap<QualifiedName, String[]>();
+ this.routeParameters = new HashMap<QualifiedName, String>();
}
Route()
@@ -77,14 +76,14 @@
this.terminal = false;
this.simpleRoutes = new LinkedHashMap<String, SimpleRoute>();
this.patternRoutes = new ArrayList<PatternRoute>();
- this.routeParameters = new HashMap<QualifiedName, String[]>();
+ this.routeParameters = new HashMap<QualifiedName, String>();
}
/**
* Ok, so this is not the fastest way to do it, but for now it's OK, it's what is needed, we'll find
* a way to optimize it later with some precompilation.
*/
- final String render(Map<QualifiedName, String[]> blah)
+ final String render(Map<QualifiedName, String> blah)
{
Route r = find(blah);
if (r == null)
@@ -106,7 +105,7 @@
}
}
- private void render(Map<QualifiedName, String[]> blah, StringBuilder sb)
+ private void render(Map<QualifiedName, String> blah, StringBuilder sb)
{
if (parent != null)
{
@@ -127,31 +126,31 @@
while (i < pr.parameterNames.size())
{
sb.append(pr.chunks.get(i));
- String[] value = blah.get(pr.parameterNames.get(i));
- sb.append(value[0]);
+ String value = blah.get(pr.parameterNames.get(i));
+ sb.append(value);
i++;
}
sb.append(pr.chunks.get(i));
}
}
- final Route find(Map<QualifiedName, String[]> blah)
+ final Route find(Map<QualifiedName, String> blah)
{
// Remove what is matched
- Map<QualifiedName, String[]> abc = new HashMap<QualifiedName, String[]>(blah);
+ Map<QualifiedName, String> abc = new HashMap<QualifiedName, String>(blah);
// Match first the static parameteters
- for (Map.Entry<QualifiedName, String[]> a : routeParameters.entrySet())
+ for (Map.Entry<QualifiedName, String> a : routeParameters.entrySet())
{
- String[] s = blah.get(a.getKey());
- if (s == null || !Arrays.equals(a.getValue(), s))
+ String s = blah.get(a.getKey());
+ if (a.getValue().equals(s))
{
- return null;
+ abc.remove(a.getKey());
}
else
{
- abc.remove(a.getKey());
+ return null;
}
}
@@ -162,14 +161,14 @@
for (int i = 0;i < prt.parameterNames.size();i++)
{
QualifiedName qd = prt.parameterNames.get(i);
- String[] s = blah.get(qd);
- if (s == null || !prt.parameterPatterns.get(i).matcher(s[0]).matches())
+ String s = blah.get(qd);
+ if (s != null && prt.parameterPatterns.get(i).matcher(s).matches())
{
- return null;
+ abc.remove(qd);
}
else
{
- abc.remove(qd);
+ return null;
}
}
}
@@ -236,7 +235,7 @@
Route route = simpleRoutes.get(segment);
if (route != null)
{
- Map<QualifiedName, String[]> parameters = context.getParameters();
+ Map<QualifiedName, String> parameters = context.getParameters();
// Determine next path
String nextPath;
@@ -272,11 +271,11 @@
if (matcher.find())
{
// Update parameters
- Map<QualifiedName, String[]> parameters = new HashMap<QualifiedName, String[]>(context.getParameters());
+ Map<QualifiedName, String> parameters = new HashMap<QualifiedName, String>(context.getParameters());
int group = 1;
for (QualifiedName parameterName : route.parameterNames)
{
- parameters.put(parameterName, new String[]{matcher.group(group++)});
+ parameters.put(parameterName, matcher.group(group++));
}
// Build next controller context
@@ -311,7 +310,7 @@
{
if (routeParameters.size() > 0)
{
- for (Map.Entry<QualifiedName, String[]> entry : routeParameters.entrySet())
+ for (Map.Entry<QualifiedName, String> entry : routeParameters.entrySet())
{
if (!ret.getParameters().containsKey(entry.getKey()))
{
@@ -332,7 +331,7 @@
final Route append(
String path,
- Map<QualifiedName, String[]> parameters)
+ Map<QualifiedName, String> parameters)
{
Route route = append(path);
route.terminal = true;
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -54,9 +54,9 @@
this.root = root;
}
- public String render(Map<QualifiedName, String[]> blah)
+ public String render(Map<QualifiedName, String> parameters)
{
- return root.render(blah);
+ return root.render(parameters);
}
public ControllerResponse process(ControllerContext controllerContext) throws IOException
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -36,7 +36,7 @@
public abstract class AbstractTestController extends TestCase
{
- public void assertProcessResponse(String path, Map<QualifiedName, String[]> parameters, ControllerResponse response)
+ public void assertProcessResponse(String path, Map<QualifiedName, String> parameters, ControllerResponse response)
{
assertNotNull("Was not expecting a null response", response);
assertEquals(ProcessResponse.class, response.getClass());
@@ -47,23 +47,23 @@
public void assertProcessResponse(ControllerResponse response)
{
- assertProcessResponse(null, Collections.<QualifiedName, String[]>emptyMap(), response);
+ assertProcessResponse(null, Collections.<QualifiedName, String>emptyMap(), response);
}
public void assertProcessResponse(String path, ControllerResponse response)
{
- assertProcessResponse(path, Collections.<QualifiedName, String[]>emptyMap(), response);
+ assertProcessResponse(path, Collections.<QualifiedName, String>emptyMap(), response);
}
- public void assertProcessResponse(Map<QualifiedName, String[]> parameters, ControllerResponse response)
+ public void assertProcessResponse(Map<QualifiedName, String> parameters, ControllerResponse response)
{
assertProcessResponse(null, parameters, response);
}
- public void assertEquals(Map<QualifiedName, String[]> expectedParameters, Map<QualifiedName, String[]> parameters)
+ public void assertEquals(Map<QualifiedName, String> expectedParameters, Map<QualifiedName, String> parameters)
{
Assert.assertEquals(expectedParameters.keySet(), parameters.keySet());
- for (Map.Entry<QualifiedName, String[]> expectedEntry : expectedParameters.entrySet())
+ for (Map.Entry<QualifiedName, String> expectedEntry : expectedParameters.entrySet())
{
Assert.assertEquals(Arrays.asList(expectedEntry.getValue()), Arrays.asList(parameters.get(expectedEntry.getKey())));
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -43,7 +43,7 @@
assertNull(router.process(new ControllerContext("")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/")));
//
assertNull(router.process(new ControllerContext("/a")));
@@ -59,7 +59,7 @@
Router router = new Router(routerMD);
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
@@ -68,7 +68,7 @@
assertNull(router.process(new ControllerContext("a/")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/a/")));
//
assertNull(router.process(new ControllerContext("")));
@@ -96,10 +96,10 @@
assertNull(router.process(new ControllerContext("a/b")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/a/b")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/b/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/a/b/")));
//
assertNull(router.process(new ControllerContext("a/b/")));
@@ -125,7 +125,7 @@
RouterMetaData routerMD = new RouterMetaData();
routerMD.addRoute("/{p}", new ControllerRefMetaData());
Router router = new Router(routerMD);
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(new ControllerContext("/a")));
}
public void testParameterPropagationToDescendants() throws Exception
@@ -134,7 +134,7 @@
routerMD.addRoute("/", new ControllerRefMetaData().addParameter("p", "a"));
routerMD.addRoute("/a", new ControllerRefMetaData());
Router router = new Router(routerMD);
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(new ControllerContext("/a")));
}
public void testWildcardPattern() throws Exception
@@ -144,16 +144,16 @@
Router router = new Router(routerMD);
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{""}), router.process(new ControllerContext("/")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), ""), router.process(new ControllerContext("/")));
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a/b"}), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), "a/b"), router.process(new ControllerContext("/a/b")));
}
public void testSimplePattern() throws Exception
@@ -163,7 +163,7 @@
Router router = new Router(routerMD);
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
@@ -186,12 +186,12 @@
assertNull(router.process(new ControllerContext("a")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/a")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(), router.process(new ControllerContext("/a/")));
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), "a"), router.process(new ControllerContext("/a/b")));
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -60,11 +60,11 @@
public void testPrivateClassic() throws Exception
{
- Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
- expectedParameters.put(new QualifiedName("gtn", "controller"), new String[]{"site"});
- expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
- expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{""});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName, String>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"), "site");
+ expectedParameters.put(new QualifiedName("gtn", "sitename"), "classic");
+ expectedParameters.put(new QualifiedName("gtn", "sitetype"), "portal");
+ expectedParameters.put(new QualifiedName("gtn", "path"), "");
//
assertProcessResponse(expectedParameters, router.process(new ControllerContext("/private/classic")));
@@ -74,11 +74,11 @@
public void testPrivateClassicSlash() throws Exception
{
router.process(new ControllerContext("/private/classic/"));
- Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
- expectedParameters.put(new QualifiedName("gtn", "controller"), new String[]{"site"});
- expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
- expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"/"});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName, String>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"), "site");
+ expectedParameters.put(new QualifiedName("gtn", "sitename"), "classic");
+ expectedParameters.put(new QualifiedName("gtn", "sitetype"), "portal");
+ expectedParameters.put(new QualifiedName("gtn", "path"), "/");
//
assertProcessResponse(expectedParameters, router.process(new ControllerContext("/private/classic/")));
@@ -87,11 +87,11 @@
public void testPrivateClassicHome() throws Exception
{
- Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
- expectedParameters.put(new QualifiedName("gtn", "controller"), new String[]{"site"});
- expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
- expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"/home"});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName, String>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"), "site");
+ expectedParameters.put(new QualifiedName("gtn", "sitename"), "classic");
+ expectedParameters.put(new QualifiedName("gtn", "sitetype"), "portal");
+ expectedParameters.put(new QualifiedName("gtn", "path"), "/home");
//
assertProcessResponse(expectedParameters, router.process(new ControllerContext("/private/classic/home")));
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-09-02 09:33:23 UTC (rev 4026)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-09-02 12:55:51 UTC (rev 4027)
@@ -39,7 +39,7 @@
Router router = new Router(routerMD);
//
- assertEquals("/", router.render(Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/", router.render(Collections.<QualifiedName, String>emptyMap()));
}
public void testA() throws Exception
@@ -49,7 +49,7 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.<QualifiedName, String>emptyMap()));
}
public void testAB() throws Exception
@@ -59,7 +59,7 @@
Router router = new Router( routerMD);
//
- assertEquals("/a/b", router.render(Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a/b", router.render(Collections.<QualifiedName, String>emptyMap()));
}
public void testParameter() throws Exception
@@ -69,8 +69,8 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
- assertNull(router.render(Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), "a")));
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
}
public void testWildcardPattern() throws Exception
@@ -80,13 +80,13 @@
Router router = new Router(routerMD);
//
- assertEquals("/", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{""})));
+ assertEquals("/", router.render(Collections.singletonMap(new QualifiedName("p"), "")));
//
- assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), "a")));
//
- assertEquals("/a/b", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a/b"})));
+ assertEquals("/a/b", router.render(Collections.singletonMap(new QualifiedName("p"), "a/b")));
}
public void testSimplePattern() throws Exception
@@ -96,10 +96,10 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), "a")));
//
- assertNull(router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"ab"})));
+ assertNull(router.render(Collections.singletonMap(new QualifiedName("p"), "ab")));
}
public void testPrecedence() throws Exception
@@ -110,9 +110,9 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.<QualifiedName, String>emptyMap()));
//
- assertEquals("/a/b", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a/b", router.render(Collections.singletonMap(new QualifiedName("p"), "a")));
}
}
14 years, 3 months
gatein SVN: r4026 - portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-02 05:33:23 -0400 (Thu, 02 Sep 2010)
New Revision: 4026
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
Log:
update unit test
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02 09:27:13 UTC (rev 4025)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02 09:33:23 UTC (rev 4026)
@@ -42,12 +42,15 @@
{
RouterMetaData routerMD = new RouterMetaData();
ControllerRefMetaData portalControllerRef = new ControllerRefMetaData();
+ portalControllerRef.addParameter(new QualifiedName("gtn", "controller"), "site");
portalControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "portal");
routerMD.addRoute("/private/{{gtn}sitename}{{gtn}path:.*}", portalControllerRef);
ControllerRefMetaData groupControllerRef = new ControllerRefMetaData();
+ portalControllerRef.addParameter(new QualifiedName("gtn", "controller"), "site");
groupControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "group");
routerMD.addRoute("/groups/{{gtn}sitename}{{gtn}path:.*}", groupControllerRef);
ControllerRefMetaData userControllerRef = new ControllerRefMetaData();
+ portalControllerRef.addParameter(new QualifiedName("gtn", "controller"), "site");
userControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "user");
routerMD.addRoute("/users/{{gtn}sitename}{{gtn}path:.*}", userControllerRef);
@@ -58,6 +61,7 @@
public void testPrivateClassic() throws Exception
{
Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"), new String[]{"site"});
expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{""});
@@ -71,6 +75,7 @@
{
router.process(new ControllerContext("/private/classic/"));
Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"), new String[]{"site"});
expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"/"});
@@ -83,6 +88,7 @@
public void testPrivateClassicHome() throws Exception
{
Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"), new String[]{"site"});
expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"/home"});
14 years, 3 months
gatein SVN: r4025 - in portal/branches/navcontroller/component/web/controller/src: main/java/org/exoplatform/web/controller/protocol and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-02 05:27:13 -0400 (Thu, 02 Sep 2010)
New Revision: 4025
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRoute.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
Log:
better impl of rendering
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -32,32 +32,13 @@
{
/** . */
- private String ref;
-
- /** . */
private final Map<QualifiedName, String[]> parameters;
public ControllerRefMetaData()
{
- this(null);
- }
-
- public ControllerRefMetaData(String ref)
- {
- this.ref = ref;
this.parameters = new HashMap<QualifiedName, String[]>();
}
- public String getRef()
- {
- return ref;
- }
-
- public void setRef(String ref)
- {
- this.ref = ref;
- }
-
public ControllerRefMetaData addParameter(QualifiedName name, String first, String... rest)
{
String[] value = new String[1 + rest.length];
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -32,40 +32,32 @@
{
/** . */
- private final String controllerId;
-
- /** . */
private final String path;
/** . */
private final Map<QualifiedName, String[]> parameters;
- public ProcessResponse(String controllerId)
+ public ProcessResponse()
{
- this(controllerId, null, Collections.<QualifiedName, String[]>emptyMap());
+ this(null, Collections.<QualifiedName, String[]>emptyMap());
}
- public ProcessResponse(String controllerId, String path)
+ public ProcessResponse(String path)
{
- this(controllerId, path, Collections.<QualifiedName, String[]>emptyMap());
+ this(path, Collections.<QualifiedName, String[]>emptyMap());
}
- public ProcessResponse(String controllerId, Map<QualifiedName, String[]> parameters)
+ public ProcessResponse(Map<QualifiedName, String[]> parameters)
{
- this(controllerId, null, parameters);
+ this(null, parameters);
}
- public ProcessResponse(String controllerId, String path, Map<QualifiedName, String[]> parameters)
+ public ProcessResponse(String path, Map<QualifiedName, String[]> parameters)
{
- if (controllerId == null)
- {
- throw new NullPointerException();
- }
if (parameters == null)
{
throw new NullPointerException();
}
- this.controllerId = controllerId;
this.path = path;
this.parameters = parameters;
}
@@ -75,11 +67,6 @@
return path;
}
- public String getControllerId()
- {
- return controllerId;
- }
-
public Map<QualifiedName, String[]> getParameters()
{
return parameters;
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/PatternRoute.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -43,12 +43,16 @@
/** . */
final List<String> chunks;
- public PatternRoute(
+ PatternRoute(
+ Route parent,
Pattern pattern,
List<QualifiedName> parameterNames,
List<Pattern> parameterPatterns,
List<String> chunks)
{
+ super(parent);
+
+ //
if (chunks.size() != parameterNames.size() + 1)
{
throw new AssertionError("Was expecting chunk size " + chunks.size() + " to be equals to " + parameterNames.size() + 1);
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@@ -41,9 +42,12 @@
{
/** . */
- String controllerRef;
+ final Route parent;
/** . */
+ boolean terminal;
+
+ /** . */
final Map<String, SimpleRoute> simpleRoutes;
/** . */
@@ -52,96 +56,153 @@
/** . */
final Map<QualifiedName, String[]> routeParameters;
+ protected Route(Route parent)
+ {
+ if (parent == null)
+ {
+ throw new NullPointerException("No null parent");
+ }
+
+ //
+ this.parent = parent;
+ this.terminal = false;
+ this.simpleRoutes = new LinkedHashMap<String, SimpleRoute>();
+ this.patternRoutes = new ArrayList<PatternRoute>();
+ this.routeParameters = new HashMap<QualifiedName, String[]>();
+ }
+
Route()
{
- this.simpleRoutes = new HashMap<String, SimpleRoute>();
+ this.parent = null;
+ this.terminal = false;
+ this.simpleRoutes = new LinkedHashMap<String, SimpleRoute>();
this.patternRoutes = new ArrayList<PatternRoute>();
this.routeParameters = new HashMap<QualifiedName, String[]>();
}
/**
- * todo: a version that does not string concatenation but instead a buffer
+ * Ok, so this is not the fastest way to do it, but for now it's OK, it's what is needed, we'll find
+ * a way to optimize it later with some precompilation.
*/
- String render(String controllerId, Map<QualifiedName, String[]> blah)
+ final String render(Map<QualifiedName, String[]> blah)
{
- if (controllerRef != null && controllerRef.equals(controllerId))
+ Route r = find(blah);
+ if (r == null)
{
- for (Map.Entry<QualifiedName, String[]> entry : routeParameters.entrySet())
+ return null;
+ }
+ else
+ {
+ if (r instanceof PatternRoute || r instanceof SimpleRoute)
{
- String[] a = blah.get(entry.getKey());
- if (a == null || !Arrays.equals(entry.getValue(), a))
- {
- return null;
- }
+ StringBuilder sb = new StringBuilder();
+ r.render(blah, sb);
+ return sb.toString();
}
- return "/";
+ else
+ {
+ return "/";
+ }
}
- else
+ }
+
+ private void render(Map<QualifiedName, String[]> blah, StringBuilder sb)
+ {
+ if (parent != null)
{
- for (Map.Entry<String, SimpleRoute> a : simpleRoutes.entrySet())
+ parent.render(blah, sb);
+ }
+
+ //
+ if (this instanceof SimpleRoute)
+ {
+ SimpleRoute sr = (SimpleRoute)this;
+ sb.append('/').append(sr.value);
+ }
+ else if (this instanceof PatternRoute)
+ {
+ PatternRoute pr = (PatternRoute)this;
+ sb.append('/');
+ int i = 0;
+ while (i < pr.parameterNames.size())
{
- String b = a.getValue().render(controllerId, blah);
- if (b != null)
- {
- if (b.length() > 1)
- {
- return "/" + a.getKey() + b;
- }
- else
- {
- return "/" + a.getKey();
- }
- }
+ sb.append(pr.chunks.get(i));
+ String[] value = blah.get(pr.parameterNames.get(i));
+ sb.append(value[0]);
+ i++;
}
- there:
- for (PatternRoute a : patternRoutes)
+ sb.append(pr.chunks.get(i));
+ }
+ }
+
+ final Route find(Map<QualifiedName, String[]> blah)
+ {
+
+ // Remove what is matched
+ Map<QualifiedName, String[]> abc = new HashMap<QualifiedName, String[]>(blah);
+
+ // Match first the static parameteters
+ for (Map.Entry<QualifiedName, String[]> a : routeParameters.entrySet())
+ {
+ String[] s = blah.get(a.getKey());
+ if (s == null || !Arrays.equals(a.getValue(), s))
{
- int i = 0;
- while (i < a.parameterNames.size())
- {
- String[] value = blah.get(a.parameterNames.get(i));
- if (value == null || value.length < 1)
- {
- continue there;
- }
- if (!a.parameterPatterns.get(i).matcher(value[0]).matches())
- {
- continue there;
- }
- i++;
- }
+ return null;
+ }
+ else
+ {
+ abc.remove(a.getKey());
+ }
+ }
- //
- i = 0;
- StringBuilder sb = new StringBuilder();
- while (i < a.parameterNames.size())
+ // Match any pattern parameter
+ if (this instanceof PatternRoute)
+ {
+ PatternRoute prt = (PatternRoute)this;
+ for (int i = 0;i < prt.parameterNames.size();i++)
+ {
+ QualifiedName qd = prt.parameterNames.get(i);
+ String[] s = blah.get(qd);
+ if (s == null || !prt.parameterPatterns.get(i).matcher(s[0]).matches())
{
- sb.append(a.chunks.get(i));
- String[] value = blah.get(a.parameterNames.get(i));
- sb.append(value[0]);
- i++;
+ return null;
}
- sb.append(a.chunks.get(i));
-
- //
- String bilto = a.render(controllerId, blah);
- if (bilto != null)
+ else
{
- if (bilto.length() > 1)
- {
- return "/" + sb + bilto;
- }
- else
- {
- return "/" + sb.toString();
- }
+ abc.remove(qd);
}
}
}
+
+ //
+ if (abc.isEmpty() && terminal)
+ {
+ return this;
+ }
+
+ //
+ for (SimpleRoute route : simpleRoutes.values())
+ {
+ Route a = route.find(abc);
+ if (a != null)
+ {
+ return a;
+ }
+ }
+ for (PatternRoute route : patternRoutes)
+ {
+ Route a = route.find(abc);
+ if (a != null)
+ {
+ return a;
+ }
+ }
+
+ //
return null;
}
- ProcessResponse route(ControllerContext context)
+ final ProcessResponse route(ControllerContext context)
{
String path = context.getPath();
@@ -155,9 +216,9 @@
// The '/' means the current controller if any, otherwise it may be processed by the pattern matching
if (path.length() == 1)
{
- if (controllerRef != null)
+ if (terminal)
{
- ret = new ProcessResponse(controllerRef, context.getPath(), context.getParameters());
+ ret = new ProcessResponse(context.getPath(), context.getParameters());
}
}
else
@@ -269,13 +330,12 @@
/** . */
private static final Pattern PARAMETER_REGEX = Pattern.compile("^(?:\\{([^\\}]*)\\})?(.*)$");
- Route append(
+ final Route append(
String path,
- String controllerRef,
Map<QualifiedName, String[]> parameters)
{
Route route = append(path);
- route.controllerRef = controllerRef;
+ route.terminal = true;
route.routeParameters.putAll(parameters);
return route;
}
@@ -329,7 +389,7 @@
}
else
{
- SimpleRoute route = new SimpleRoute(path.substring(0, pos));
+ SimpleRoute route = new SimpleRoute(this, path.substring(0, pos));
simpleRoutes.put(route.value, route);
next = route;
}
@@ -391,7 +451,7 @@
// Julien : should the pattern end with a $ ?????? I don't see that for now
// we need to figure out clearly
Pattern pattern = builder.build();
- PatternRoute route = new PatternRoute(pattern, parameterNames, parameterPatterns, chunks);
+ PatternRoute route = new PatternRoute(this, pattern, parameterNames, parameterPatterns, chunks);
patternRoutes.add(route);
next = route;
}
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -47,16 +47,16 @@
for (Map.Entry<String, ControllerRefMetaData> routeMetaData : metaData.getRoutes().entrySet())
{
String path = routeMetaData.getKey();
- root.append(path, routeMetaData.getValue().getRef(), routeMetaData.getValue().getParameters());
+ root.append(path, routeMetaData.getValue().getParameters());
}
//
this.root = root;
}
- public String render(String controllerId, Map<QualifiedName, String[]> blah)
+ public String render(Map<QualifiedName, String[]> blah)
{
- return root.render(controllerId, blah);
+ return root.render(blah);
}
public ControllerResponse process(ControllerContext controllerContext) throws IOException
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRoute.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRoute.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/SimpleRoute.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -29,8 +29,11 @@
/** . */
final String value;
- public SimpleRoute(String value)
+ SimpleRoute(Route parent, String value)
{
+ super(parent);
+
+ //
this.value = value;
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -36,29 +36,28 @@
public abstract class AbstractTestController extends TestCase
{
- public void assertProcessResponse(String controllerId, String path, Map<QualifiedName, String[]> parameters, ControllerResponse response)
+ public void assertProcessResponse(String path, Map<QualifiedName, String[]> parameters, ControllerResponse response)
{
assertNotNull("Was not expecting a null response", response);
assertEquals(ProcessResponse.class, response.getClass());
- assertEquals(controllerId, ((ProcessResponse)response).getControllerId());
// todo check path and define semantic
// assertEquals(path, ((ProcessResponse)response).getPath());
assertEquals(parameters, ((ProcessResponse)response).getParameters());
}
- public void assertProcessResponse(String controllerId, ControllerResponse response)
+ public void assertProcessResponse(ControllerResponse response)
{
- assertProcessResponse(controllerId, null, Collections.<QualifiedName, String[]>emptyMap(), response);
+ assertProcessResponse(null, Collections.<QualifiedName, String[]>emptyMap(), response);
}
- public void assertProcessResponse(String controllerId, String path, ControllerResponse response)
+ public void assertProcessResponse(String path, ControllerResponse response)
{
- assertProcessResponse(controllerId, path, Collections.<QualifiedName, String[]>emptyMap(), response);
+ assertProcessResponse(path, Collections.<QualifiedName, String[]>emptyMap(), response);
}
- public void assertProcessResponse(String controllerId, Map<QualifiedName, String[]> parameters, ControllerResponse response)
+ public void assertProcessResponse(Map<QualifiedName, String[]> parameters, ControllerResponse response)
{
- assertProcessResponse(controllerId, null, parameters, response);
+ assertProcessResponse(null, parameters, response);
}
public void assertEquals(Map<QualifiedName, String[]> expectedParameters, Map<QualifiedName, String[]> parameters)
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -34,7 +34,7 @@
public class TestBuildRoute extends TestCase
{
- private ControllerRefMetaData ref1 = new ControllerRefMetaData("ref1");
+ private ControllerRefMetaData ref1 = new ControllerRefMetaData();
public void testRoot()
{
@@ -45,7 +45,6 @@
routerMD.addRoute(path, ref1);
Router router = new Router(routerMD);
Route expectedRoute = new Route();
- expectedRoute.controllerRef = "ref1";
assertEquals(expectedRoute, router.root);
}
}
@@ -59,8 +58,7 @@
routerMD.addRoute(path, ref1);
Router router = new Router(routerMD);
Route expectedRoute = new Route();
- SimpleRoute a = new SimpleRoute("a");
- a.controllerRef = "ref1";
+ SimpleRoute a = new SimpleRoute(expectedRoute, "a");
expectedRoute.simpleRoutes.put("a", a);
assertEquals(expectedRoute, router.root);
}
@@ -138,7 +136,6 @@
private void assertEquals(Route expectedRoute, Route route)
{
assertEquals(expectedRoute.getClass(), route.getClass());
- assertEquals(expectedRoute.controllerRef, route.controllerRef);
assertEquals(expectedRoute.simpleRoutes.keySet(), route.simpleRoutes.keySet());
for (Map.Entry<String, SimpleRoute> entry : expectedRoute.simpleRoutes.entrySet())
{
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -36,14 +36,14 @@
public void testRoot() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
assertNull(router.process(new ControllerContext("")));
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/")));
//
assertNull(router.process(new ControllerContext("/a")));
@@ -55,11 +55,11 @@
public void testA() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/a", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/a", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
@@ -68,7 +68,7 @@
assertNull(router.process(new ControllerContext("a/")));
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/")));
//
assertNull(router.process(new ControllerContext("")));
@@ -89,17 +89,17 @@
public void testAB() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/a/b", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/a/b", new ControllerRefMetaData());
Router router = new Router( routerMD);
//
assertNull(router.process(new ControllerContext("a/b")));
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/b")));
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/b/")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/b/")));
//
assertNull(router.process(new ControllerContext("a/b/")));
@@ -123,47 +123,47 @@
public void testParameter() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/{p}", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/{p}", new ControllerRefMetaData());
Router router = new Router(routerMD);
- assertProcessResponse("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
}
public void testParameterPropagationToDescendants() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/", new ControllerRefMetaData("ref1").addParameter("p", "a"));
- routerMD.addRoute("/a", new ControllerRefMetaData("ref2"));
+ routerMD.addRoute("/", new ControllerRefMetaData().addParameter("p", "a"));
+ routerMD.addRoute("/a", new ControllerRefMetaData());
Router router = new Router(routerMD);
- assertProcessResponse("ref2", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
}
public void testWildcardPattern() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/{p:.*}", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/{p:.*}", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertProcessResponse("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{""}), router.process(new ControllerContext("/")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{""}), router.process(new ControllerContext("/")));
//
- assertProcessResponse("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
//
- assertProcessResponse("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a/b"}), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a/b"}), router.process(new ControllerContext("/a/b")));
}
public void testSimplePattern() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/{p:a}", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/{p:a}", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertProcessResponse("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
@@ -178,20 +178,20 @@
public void testPrecedence() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/a", new ControllerRefMetaData("ref1"));
- routerMD.addRoute("/{p:a}/b", new ControllerRefMetaData("ref2"));
+ routerMD.addRoute("/a", new ControllerRefMetaData());
+ routerMD.addRoute("/{p:a}/b", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
assertNull(router.process(new ControllerContext("a")));
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a")));
//
- assertProcessResponse("ref1", Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/")));
+ assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(), router.process(new ControllerContext("/a/")));
//
- assertProcessResponse("ref2", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a/b")));
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -41,15 +41,15 @@
protected void setUp() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- ControllerRefMetaData portalControllerRef = new ControllerRefMetaData("site");
+ ControllerRefMetaData portalControllerRef = new ControllerRefMetaData();
portalControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "portal");
- routerMD.addRoute("/private/{{gtn}sitename}/{{gtn}path:.*}", portalControllerRef);
- ControllerRefMetaData groupControllerRef = new ControllerRefMetaData("site");
+ routerMD.addRoute("/private/{{gtn}sitename}{{gtn}path:.*}", portalControllerRef);
+ ControllerRefMetaData groupControllerRef = new ControllerRefMetaData();
groupControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "group");
- routerMD.addRoute("/groups/{{gtn}sitename}/{{gtn}path:.*}", groupControllerRef);
- ControllerRefMetaData userControllerRef = new ControllerRefMetaData("site");
+ routerMD.addRoute("/groups/{{gtn}sitename}{{gtn}path:.*}", groupControllerRef);
+ ControllerRefMetaData userControllerRef = new ControllerRefMetaData();
userControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "user");
- routerMD.addRoute("/users/{{gtn}sitename}/{{gtn}path:.*}", userControllerRef);
+ routerMD.addRoute("/users/{{gtn}sitename}{{gtn}path:.*}", userControllerRef);
//
this.router = new Router(routerMD);
@@ -63,8 +63,8 @@
expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{""});
//
- assertProcessResponse("site", expectedParameters, router.process(new ControllerContext("/private/classic")));
- assertEquals("/private/classic", router.render("site", expectedParameters));
+ assertProcessResponse(expectedParameters, router.process(new ControllerContext("/private/classic")));
+ assertEquals("/private/classic", router.render(expectedParameters));
}
public void testPrivateClassicSlash() throws Exception
@@ -73,11 +73,11 @@
Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{""});
+ expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"/"});
//
- assertProcessResponse("site", expectedParameters, router.process(new ControllerContext("/private/classic/")));
- assertEquals("/private/classic", router.render("site", expectedParameters));
+ assertProcessResponse(expectedParameters, router.process(new ControllerContext("/private/classic/")));
+ assertEquals("/private/classic/", router.render(expectedParameters));
}
public void testPrivateClassicHome() throws Exception
@@ -85,10 +85,10 @@
Map<QualifiedName, String[]> expectedParameters = new HashMap<QualifiedName, String[]>();
expectedParameters.put(new QualifiedName("gtn", "sitename"), new String[]{"classic"});
expectedParameters.put(new QualifiedName("gtn", "sitetype"), new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"home"});
+ expectedParameters.put(new QualifiedName("gtn", "path"), new String[]{"/home"});
//
- assertProcessResponse("site", expectedParameters, router.process(new ControllerContext("/private/classic/home")));
- assertEquals("/private/classic/home", router.render("site", expectedParameters));
+ assertProcessResponse(expectedParameters, router.process(new ControllerContext("/private/classic/home")));
+ assertEquals("/private/classic/home", router.render(expectedParameters));
}
}
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-09-02 09:22:53 UTC (rev 4024)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-09-02 09:27:13 UTC (rev 4025)
@@ -35,83 +35,84 @@
public void testRoot() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertEquals("/", router.render("ref1", Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/", router.render(Collections.<QualifiedName, String[]>emptyMap()));
}
public void testA() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/a", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/a", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render("ref1", Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.<QualifiedName, String[]>emptyMap()));
}
public void testAB() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/a/b", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/a/b", new ControllerRefMetaData());
Router router = new Router( routerMD);
//
- assertEquals("/a/b", router.render("ref1", Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a/b", router.render(Collections.<QualifiedName, String[]>emptyMap()));
}
public void testParameter() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/{p}", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/{p}", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertNull(router.render(Collections.<QualifiedName, String[]>emptyMap()));
}
public void testWildcardPattern() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/{p:.*}", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/{p:.*}", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertEquals("/", router.render("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{""})));
+ assertEquals("/", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{""})));
//
- assertEquals("/a", router.render("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
//
- assertEquals("/a/b", router.render("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a/b"})));
+ assertEquals("/a/b", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a/b"})));
}
public void testSimplePattern() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/{p:a}", new ControllerRefMetaData("ref1"));
+ routerMD.addRoute("/{p:a}", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
//
- assertNull(router.render("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"ab"})));
+ assertNull(router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"ab"})));
}
public void testPrecedence() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
- routerMD.addRoute("/a", new ControllerRefMetaData("ref1"));
- routerMD.addRoute("/{p:a}/b", new ControllerRefMetaData("ref2"));
+ routerMD.addRoute("/a", new ControllerRefMetaData());
+ routerMD.addRoute("/{p:a}/b", new ControllerRefMetaData());
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render("ref1", Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.<QualifiedName, String[]>emptyMap()));
//
- assertEquals("/a/b", router.render("ref2", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a/b", router.render(Collections.singletonMap(new QualifiedName("p"), new String[]{"a"})));
}
}
14 years, 3 months
gatein SVN: r4024 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization.
by do-not-reply@jboss.org
Author: mstruk
Date: 2010-09-02 05:22:53 -0400 (Thu, 02 Sep 2010)
New Revision: 4024
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationFilter.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java
Log:
GTNPORTAL-1407: Language doesn't persist when session timeout
- fix broken with recent GTNPORTAL-1306 commits when cookie support was disabled
GTNPORTAL-1306: PortletRequest's locale to return user's preference language instead of the locale from Accept-Language header
- reenabled cookies
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationFilter.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationFilter.java 2010-09-01 21:17:15 UTC (rev 4023)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationFilter.java 2010-09-02 09:22:53 UTC (rev 4024)
@@ -136,7 +136,7 @@
localeCtx.setSupportedLocales(supportedLocales);
localeCtx.setBrowserLocales(Collections.list(request.getLocales()));
- //localeCtx.setCookieLocales(LocalizationLifecycle.getCookieLocales(req));
+ localeCtx.setCookieLocales(LocalizationLifecycle.getCookieLocales(req));
localeCtx.setSessionLocale(LocalizationLifecycle.getSessionLocale(req));
localeCtx.setUserProfileLocale(getUserProfileLocale(container, req.getRemoteUser()));
localeCtx.setRemoteUser(req.getRemoteUser());
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java 2010-09-01 21:17:15 UTC (rev 4023)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java 2010-09-02 09:22:53 UTC (rev 4024)
@@ -123,7 +123,7 @@
HttpServletRequest request = HttpServletRequest.class.cast(context.getRequest());
localeCtx.setBrowserLocales(Collections.list(request.getLocales()));
- //localeCtx.setCookieLocales(getCookieLocales(request));
+ localeCtx.setCookieLocales(getCookieLocales(request));
localeCtx.setSessionLocale(getSessionLocale(request));
localeCtx.setUserProfileLocale(getUserProfileLocale(reqCtx));
localeCtx.setRemoteUser(reqCtx.getRemoteUser());
@@ -325,8 +325,7 @@
}
else
{
- // disabled for now
- //saveLocaleToCookie(context, loc);
+ saveLocaleToCookie(context, loc);
}
saveSessionLocale(context, loc);
14 years, 3 months
gatein SVN: r4023 - portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-01 17:17:15 -0400 (Wed, 01 Sep 2010)
New Revision: 4023
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
Log:
encapsulate the route creation inside the Route object
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-01 19:59:16 UTC (rev 4022)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-01 21:17:15 UTC (rev 4023)
@@ -269,8 +269,25 @@
/** . */
private static final Pattern PARAMETER_REGEX = Pattern.compile("^(?:\\{([^\\}]*)\\})?(.*)$");
- Route append(String path)
+ Route append(
+ String path,
+ String controllerRef,
+ Map<QualifiedName, String[]> parameters)
{
+ Route route = append(path);
+ route.controllerRef = controllerRef;
+ route.routeParameters.putAll(parameters);
+ return route;
+ }
+
+ /**
+ * Append a path, creates the necessary routes and returns the last route added.
+ *
+ * @param path the path to append
+ * @return the last route added
+ */
+ private Route append(String path)
+ {
int pos = path.length();
int level = 0;
List<Integer> start = new ArrayList<Integer>();
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-01 19:59:16 UTC (rev 4022)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-01 21:17:15 UTC (rev 4023)
@@ -25,7 +25,6 @@
import org.exoplatform.web.controller.metadata.ControllerRefMetaData;
import org.exoplatform.web.controller.metadata.RouterMetaData;
import org.exoplatform.web.controller.protocol.ControllerResponse;
-import org.exoplatform.web.controller.protocol.ProcessResponse;
import java.io.IOException;
import java.util.Map;
@@ -48,9 +47,7 @@
for (Map.Entry<String, ControllerRefMetaData> routeMetaData : metaData.getRoutes().entrySet())
{
String path = routeMetaData.getKey();
- Route route = root.append(path);
- route.controllerRef = routeMetaData.getValue().getRef();
- route.routeParameters.putAll(routeMetaData.getValue().getParameters());
+ root.append(path, routeMetaData.getValue().getRef(), routeMetaData.getValue().getParameters());
}
//
14 years, 3 months
gatein SVN: r4022 - components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-09-01 15:59:16 -0400 (Wed, 01 Sep 2010)
New Revision: 4022
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
Log:
- Fixed improper test. Should now pass.
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2010-09-01 18:21:04 UTC (rev 4021)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2010-09-01 19:59:16 UTC (rev 4022)
@@ -29,6 +29,7 @@
import org.gatein.wsrp.WSRPPortletURL;
import org.gatein.wsrp.WSRPRenderURL;
import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.payload.PayloadUtils;
import org.gatein.wsrp.producer.WSRPProducerBaseTest;
import org.gatein.wsrp.servlet.ServletAccess;
import org.gatein.wsrp.test.ExtendedAssert;
@@ -44,7 +45,11 @@
import org.junit.runner.RunWith;
import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.CacheControl;
+import org.oasis.wsrp.v2.Event;
import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.HandleEvents;
+import org.oasis.wsrp.v2.HandleEventsFailed;
+import org.oasis.wsrp.v2.HandleEventsResponse;
import org.oasis.wsrp.v2.InitCookie;
import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.InvalidRegistration;
@@ -62,6 +67,7 @@
import org.oasis.wsrp.v2.UnsupportedMode;
import org.oasis.wsrp.v2.UpdateResponse;
+import javax.xml.namespace.QName;
import java.rmi.RemoteException;
import java.util.List;
import java.util.Locale;
@@ -799,10 +805,30 @@
List<NamedString> formParameters = action.getInteractionParams().getFormParameters();
formParameters.add(namedString);
BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
+
+ // check events
+ List<Event> events = actionResponse.getUpdateResponse().getEvents();
+ assertNotNull(events);
+ assertEquals(1, events.size());
+ Event event = events.get(0);
+ assertEquals(new QName("urn:jboss:gatein:samples:event", "eventsample"), event.getName());
+ assertEquals(new QName("java.lang.String"), event.getType());
+ assertEquals("param-value", PayloadUtils.getPayloadAsSerializable(event.getType(), event.getPayload()));
+
+ // send event
+ HandleEvents handleEvents = WSRPTypeFactory.createHandleEvents(null,
+ WSRPTypeFactory.createPortletContext(consumerHandle), WSRPTypeFactory.createDefaultRuntimeContext(), null,
+ WSRPTypeFactory.createDefaultMarkupParams(), WSRPTypeFactory.createEventParams(events, StateChange.READ_ONLY));
+ HandleEventsResponse handleEventsResponse = producer.handleEvents(handleEvents);
+
+ // no failed events
+ List<HandleEventsFailed> failedEvents = handleEventsResponse.getFailedEvents();
+ assertEquals(0, failedEvents.size());
+
GetMarkup markupRequestConsumer = createMarkupRequest(consumerHandle);
- markupRequestConsumer.getMarkupParams().setNavigationalContext(actionResponse.getUpdateResponse().getNavigationalContext());
+ markupRequestConsumer.getMarkupParams().setNavigationalContext(handleEventsResponse.getUpdateResponse().getNavigationalContext());
MarkupResponse response = producer.getMarkup(markupRequestConsumer);
- checkMarkupResponse(response, "param-value");
+ checkMarkupResponse(response, "param-value", false, true);
}
finally
{
@@ -920,27 +946,42 @@
private MarkupContext checkMarkupResponse(MarkupResponse response, String markupString)
{
- ExtendedAssert.assertNotNull(response);
+ return checkMarkupResponse(response, markupString, true, false);
+ }
+ private MarkupContext checkMarkupResponse(MarkupResponse response, String markupString, boolean checkTitle, boolean partialMarkupMatch)
+ {
+ assertNotNull(response);
+
// Markup context
MarkupContext markupContext = response.getMarkupContext();
- ExtendedAssert.assertNotNull(markupContext);
- ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
- ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
+ assertNotNull(markupContext);
+ assertEquals("text/html", markupContext.getMimeType());
+ if (checkTitle)
+ {
+ assertEquals("title", markupContext.getPreferredTitle());
+ }
if (!ParameterValidation.isNullOrEmpty(markupString))
{
- ExtendedAssert.assertTrue(markupContext.isRequiresRewriting());
+ assertTrue(markupContext.isRequiresRewriting());
}
else
{
- ExtendedAssert.assertFalse(markupContext.isRequiresRewriting());
+ assertFalse(markupContext.isRequiresRewriting());
}
- ExtendedAssert.assertEquals(markupString, markupContext.getItemString());
+ if (!partialMarkupMatch)
+ {
+ assertEquals(markupString, markupContext.getItemString());
+ }
+ else
+ {
+ assertTrue(markupContext.getItemString().contains(markupString));
+ }
// Session context
SessionContext sessionContext = response.getSessionContext();
// The session information is should never be sent to the consumer, Cookies are used instead.
- ExtendedAssert.assertNull(sessionContext);
+ assertNull(sessionContext);
return markupContext;
}
14 years, 3 months
gatein SVN: r4021 - in portal/branches/navcontroller/component/web/controller/src: main/java/org/exoplatform/web/controller/router and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-01 14:21:04 -0400 (Wed, 01 Sep 2010)
New Revision: 4021
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
Log:
better impl of route parameters
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-01 17:38:44 UTC (rev 4020)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-01 18:21:04 UTC (rev 4021)
@@ -58,11 +58,20 @@
this.ref = ref;
}
- public void setParameter(QualifiedName name, String... value)
+ public ControllerRefMetaData addParameter(QualifiedName name, String first, String... rest)
{
+ String[] value = new String[1 + rest.length];
+ value[0] = first;
+ System.arraycopy(rest, 0, value, 1, rest.length);
parameters.put(name, value);
+ return this;
}
+ public ControllerRefMetaData addParameter(String name, String first, String... rest)
+ {
+ return addParameter(new QualifiedName(name), first, rest);
+ }
+
public Map<QualifiedName, String[]> getParameters()
{
return parameters;
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-01 17:38:44 UTC (rev 4020)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-01 18:21:04 UTC (rev 4021)
@@ -177,14 +177,6 @@
{
Map<QualifiedName, String[]> parameters = context.getParameters();
- // Update parameters
- if (route.routeParameters.size() > 0)
- {
- parameters = new HashMap<QualifiedName, String[]>(parameters);
- // julien : do a safe put all here on String[]
- parameters.putAll(route.routeParameters);
- }
-
// Determine next path
String nextPath;
if (pos == path.length())
@@ -220,8 +212,6 @@
{
// Update parameters
Map<QualifiedName, String[]> parameters = new HashMap<QualifiedName, String[]>(context.getParameters());
- // julien : do a safe put all here on String[]
- parameters.putAll(route.routeParameters);
int group = 1;
for (QualifiedName parameterName : route.parameterNames)
{
@@ -254,6 +244,22 @@
}
}
}
+
+ // Update parameters if it is possible
+ if (ret != null)
+ {
+ if (routeParameters.size() > 0)
+ {
+ for (Map.Entry<QualifiedName, String[]> entry : routeParameters.entrySet())
+ {
+ if (!ret.getParameters().containsKey(entry.getKey()))
+ {
+ // julien : should do a safe put all here on String[]
+ ret.getParameters().put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
}
//
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-01 17:38:44 UTC (rev 4020)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-01 18:21:04 UTC (rev 4021)
@@ -128,6 +128,15 @@
assertProcessResponse("ref1", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
}
+ public void testParameterPropagationToDescendants() throws Exception
+ {
+ RouterMetaData routerMD = new RouterMetaData();
+ routerMD.addRoute("/", new ControllerRefMetaData("ref1").addParameter("p", "a"));
+ routerMD.addRoute("/a", new ControllerRefMetaData("ref2"));
+ Router router = new Router(routerMD);
+ assertProcessResponse("ref2", Collections.singletonMap(new QualifiedName("p"), new String[]{"a"}), router.process(new ControllerContext("/a")));
+ }
+
public void testWildcardPattern() throws Exception
{
RouterMetaData routerMD = new RouterMetaData();
Modified: portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-01 17:38:44 UTC (rev 4020)
+++ portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-01 18:21:04 UTC (rev 4021)
@@ -42,13 +42,13 @@
{
RouterMetaData routerMD = new RouterMetaData();
ControllerRefMetaData portalControllerRef = new ControllerRefMetaData("site");
- portalControllerRef.setParameter(new QualifiedName("gtn", "sitetype"), "portal");
+ portalControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "portal");
routerMD.addRoute("/private/{{gtn}sitename}/{{gtn}path:.*}", portalControllerRef);
ControllerRefMetaData groupControllerRef = new ControllerRefMetaData("site");
- groupControllerRef.setParameter(new QualifiedName("gtn", "sitetype"), "group");
+ groupControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "group");
routerMD.addRoute("/groups/{{gtn}sitename}/{{gtn}path:.*}", groupControllerRef);
ControllerRefMetaData userControllerRef = new ControllerRefMetaData("site");
- userControllerRef.setParameter(new QualifiedName("gtn", "sitetype"), "user");
+ userControllerRef.addParameter(new QualifiedName("gtn", "sitetype"), "user");
routerMD.addRoute("/users/{{gtn}sitename}/{{gtn}path:.*}", userControllerRef);
//
14 years, 3 months
gatein SVN: r4020 - portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-09-01 13:38:44 -0400 (Wed, 01 Sep 2010)
New Revision: 4020
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
Log:
minor
Modified: portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
--- portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-01 17:14:17 UTC (rev 4019)
+++ portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-01 17:38:44 UTC (rev 4020)
@@ -145,15 +145,19 @@
{
String path = context.getPath();
+ ProcessResponse ret = null;
+
// Anything that does not begin with '/' returns null
if (path.length() > 0 && path.charAt(0) == '/')
{
+
+
// The '/' means the current controller if any, otherwise it may be processed by the pattern matching
if (path.length() == 1)
{
if (controllerRef != null)
{
- return new ProcessResponse(controllerRef, context.getPath(), context.getParameters());
+ ret = new ProcessResponse(controllerRef, context.getPath(), context.getParameters());
}
}
else
@@ -201,7 +205,7 @@
// If we do have a response we return it
if (response != null)
{
- return response;
+ ret = response;
}
}
}
@@ -245,14 +249,15 @@
// If we do have a response we return it
if (response != null)
{
- return response;
+ ret = response;
+ break;
}
}
}
}
//
- return null;
+ return ret;
}
/** . */
14 years, 3 months
gatein SVN: r4019 - in components/wsrp/trunk/wsrp-producer-war: src/main/webapp and 3 other directories.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-09-01 13:14:17 -0400 (Wed, 01 Sep 2010)
New Revision: 4019
Added:
components/wsrp/trunk/wsrp-producer-war/src/main/webapp/META-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/config/
components/wsrp/trunk/wsrp-producer-war/src/test/config/web.xml
Modified:
components/wsrp/trunk/wsrp-producer-war/pom.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
Log:
GTNWSRP-46: Update wsrp test setup to handle portlet tlds.
Modified: components/wsrp/trunk/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-09-01 16:54:26 UTC (rev 4018)
+++ components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-09-01 17:14:17 UTC (rev 4019)
@@ -478,6 +478,10 @@
<file>${JBOSS_TEST_HOME}/server/default/conf/jboss-log4j.xml</file>
<tofile>/conf/jboss-log4j.xml</tofile>
</configfile>
+ <configfile>
+ <file>${basedir}/src/test/config/web.xml</file>
+ <tofile>/deployers/jbossweb.deployer/web.xml</tofile>
+ </configfile>
</configfiles>
</configuration>
</configuration>
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml 2010-09-01 16:54:26 UTC (rev 4018)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml 2010-09-01 17:14:17 UTC (rev 4019)
@@ -34,6 +34,7 @@
<dependencySet>
<scope>test</scope>
<outputDirectory></outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>org.gatein.wsrp:test-framework</include>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/config/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/config/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/config/web.xml 2010-09-01 17:14:17 UTC (rev 4019)
@@ -0,0 +1,1208 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <!-- ======================== Introduction ============================== -->
+ <!-- This document defines default values for *all* web applications -->
+ <!-- loaded into this instance of Tomcat. As each application is -->
+ <!-- deployed, this file is processed, followed by the -->
+ <!-- "/WEB-INF/web.xml" deployment descriptor from your own -->
+ <!-- applications. -->
+ <!-- -->
+ <!-- WARNING: Do not configure application-specific resources here! -->
+ <!-- They should go in the "/WEB-INF/web.xml" file in your application. -->
+
+ <!-- =========== Common Context Params ================================== -->
+
+ <!-- Regular expression to determine if two different URLs actually point -->
+ <!-- to the same jar file. This keeps faces-config files from being -->
+ <!-- read twice. -->
+ <context-param>
+ <param-name>com.sun.faces.duplicateJARPattern</param-name>
+ <param-value>^tmp\d+(\S*\.jar)</param-value>
+ </context-param>
+
+ <!-- JBossInjectionProvider provides resource injection for managed beans. -->
+ <!-- See JSF 1.2 spec section 5.4 for details. -->
+ <context-param>
+ <param-name>com.sun.faces.injectionProvider</param-name>
+ <param-value>org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider</param-value>
+ </context-param>
+
+ <!-- ================== Common filter Configuration ==================== -->
+ <filter>
+ <filter-name>CommonHeadersFilter</filter-name>
+ <filter-class>
+ org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>
+ <init-param>
+ <param-name>X-Powered-By</param-name>
+ <param-value>Servlet 2.5; JBoss-5.0/JBossWeb-2.1</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>CommonHeadersFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <!-- ================== Common Listener Configuration ==================== -->
+ <listener>
+ <listener-class>org.jboss.web.tomcat.security.SecurityFlushSessionListener</listener-class>
+ </listener>
+
+ <!-- Configures JSF for a web application if the javax.faces.webapp.FacesServlet is declared -->
+ <!-- in web.xml. -->
+ <listener>
+ <listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener</listener-class>
+ </listener>
+
+ <!-- Listens to all web app lifecycle events so that @PreDestroy can be called on -->
+ <!-- JSF managed beans that go out of scope. You can comment this out if you -->
+ <!-- don't use JSF or you don't use annotations on your managed beans. -->
+ <listener>
+ <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>
+ </listener>
+
+ <!-- ================== Built In Servlet Definitions ==================== -->
+
+
+ <!-- The default servlet for all web applications, that serves static -->
+ <!-- resources. It processes all requests that are not mapped to other -->
+ <!-- servlets with servlet mappings (defined either here or in your own -->
+ <!-- web.xml file. This servlet supports the following initialization -->
+ <!-- parameters (default values are in square brackets): -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- input Input buffer size (in bytes) when reading -->
+ <!-- resources to be served. [2048] -->
+ <!-- -->
+ <!-- listings Should directory listings be produced if there -->
+ <!-- is no welcome file in this directory? [true] -->
+ <!-- -->
+ <!-- output Output buffer size (in bytes) when writing -->
+ <!-- resources to be served. [2048] -->
+ <!-- -->
+ <!-- readonly Is this context "read only", so HTTP -->
+ <!-- commands like PUT and DELETE are -->
+ <!-- rejected? [true] -->
+ <!-- -->
+ <!-- readmeFile File name to display with the directory -->
+ <!-- contents. [null] -->
+ <!-- -->
+ <!-- For directory listing customization. Checks localXsltFile, then -->
+ <!-- globalXsltFile, then defaults to original behavior. -->
+ <!-- -->
+ <!-- localXsltFile Make directory listings an XML doc and -->
+ <!-- pass the result to this style sheet residing -->
+ <!-- in that directory. This overrides -->
+ <!-- globalXsltFile[null] -->
+ <!-- -->
+ <!-- globalXsltFile Site wide configuration version of -->
+ <!-- localXsltFile This argument is expected -->
+ <!-- to be a physical file. [null] -->
+ <!-- -->
+ <!-- -->
+
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>listings</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- The "invoker" servlet, which executes anonymous servlet classes -->
+ <!-- that have not been defined in a web.xml file. Traditionally, this -->
+ <!-- servlet is mapped to the URL pattern "/servlet/*", but you can map -->
+ <!-- it to other patterns as well. The extra path info portion of such a -->
+ <!-- request must be the fully qualified class name of a Java class that -->
+ <!-- implements Servlet (or extends HttpServlet), or the servlet name -->
+ <!-- of an existing servlet definition. This servlet supports the -->
+ <!-- following initialization parameters (default values are in square -->
+ <!-- brackets): -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+
+ <!--
+ <servlet>
+ <servlet-name>invoker</servlet-name>
+ <servlet-class>
+ org.apache.catalina.servlets.InvokerServlet
+ </servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+ -->
+
+
+ <!-- The JSP page compiler and execution servlet, which is the mechanism -->
+ <!-- used by Tomcat to support JSP pages. Traditionally, this servlet -->
+ <!-- is mapped to the URL pattern "*.jsp". This servlet supports the -->
+ <!-- following initialization parameters (default values are in square -->
+ <!-- brackets): -->
+ <!-- -->
+ <!-- checkInterval If development is false and checkInterval is -->
+ <!-- greater than zero, background compilations are -->
+ <!-- enabled. checkInterval is the time in seconds -->
+ <!-- between checks to see if a JSP page needs to -->
+ <!-- be recompiled. [0] -->
+ <!-- -->
+ <!-- modificationTestInterval -->
+ <!-- Causes a JSP (and its dependent files) to not -->
+ <!-- be checked for modification during the -->
+ <!-- specified time interval (in seconds) from the -->
+ <!-- last time the JSP was checked for -->
+ <!-- modification. A value of 0 will cause the JSP -->
+ <!-- to be checked on every access. -->
+ <!-- Used in development mode only. [4] -->
+ <!-- -->
+ <!-- compiler Which compiler Ant should use to compile JSP -->
+ <!-- pages. See the Ant documentation for more -->
+ <!-- information. -->
+ <!-- -->
+ <!-- classdebuginfo Should the class file be compiled with -->
+ <!-- debugging information? [true] -->
+ <!-- -->
+ <!-- classpath What class path should I use while compiling -->
+ <!-- generated servlets? [Created dynamically -->
+ <!-- based on the current web application] -->
+ <!-- -->
+ <!-- development Is Jasper used in development mode? If true, -->
+ <!-- the frequency at which JSPs are checked for -->
+ <!-- modification may be specified via the -->
+ <!-- modificationTestInterval parameter. [true] -->
+ <!-- -->
+ <!-- enablePooling Determines whether tag handler pooling is -->
+ <!-- enabled [true] -->
+ <!-- -->
+ <!-- fork Tell Ant to fork compiles of JSP pages so that -->
+ <!-- a separate JVM is used for JSP page compiles -->
+ <!-- from the one Tomcat is running in. [true] -->
+ <!-- -->
+ <!-- ieClassId The class-id value to be sent to Internet -->
+ <!-- Explorer when using <jsp:plugin> tags. -->
+ <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
+ <!-- -->
+ <!-- javaEncoding Java file encoding to use for generating java -->
+ <!-- source files. [UTF8] -->
+ <!-- -->
+ <!-- keepgenerated Should we keep the generated Java source code -->
+ <!-- for each page instead of deleting it? [true] -->
+ <!-- -->
+ <!-- mappedfile Should we generate static content with one -->
+ <!-- print statement per input line, to ease -->
+ <!-- debugging? [true] -->
+ <!-- -->
+ <!-- trimSpaces Should white spaces in template text between -->
+ <!-- actions or directives be trimmed? [false] -->
+ <!-- -->
+ <!-- suppressSmap Should the generation of SMAP info for JSR45 -->
+ <!-- debugging be suppressed? [false] -->
+ <!-- -->
+ <!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
+ <!-- dumped to a file? [false] -->
+ <!-- False if suppressSmap is true -->
+ <!-- -->
+ <!-- genStrAsCharArray Should text strings be generated as char -->
+ <!-- arrays, to improve performance in some cases? -->
+ <!-- [false] -->
+ <!-- -->
+ <!-- errorOnUseBeanInvalidClassAttribute -->
+ <!-- Should Jasper issue an error when the value of -->
+ <!-- the class attribute in an useBean action is -->
+ <!-- not a valid bean class? [true] -->
+ <!-- -->
+ <!-- scratchdir What scratch directory should we use when -->
+ <!-- compiling JSP pages? [default work directory -->
+ <!-- for the current web application] -->
+ <!-- -->
+ <!-- xpoweredBy Determines whether X-Powered-By response -->
+ <!-- header is added by generated servlet [false] -->
+ <!-- -->
+ <!-- If you wish to use Jikes to compile JSP pages: -->
+ <!-- Set the init parameter "compiler" to "jikes". Define -->
+ <!-- the property "-Dbuild.compiler.emacs=true" when starting Tomcat -->
+ <!-- by adding the above to your CATALINA_OPTS environment variable. -->
+ <!-- If you get an error reporting that jikes can't use UTF8 encoding, -->
+ <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
+
+ <servlet>
+ <servlet-name>jsp</servlet-name>
+ <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+ <init-param>
+ <param-name>fork</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>xpoweredBy</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <!-- Use jdk1.5 features in jsp pages -->
+ <init-param>
+ <param-name>compilerSourceVM</param-name>
+ <param-value>1.5</param-value>
+ </init-param>
+ <!-- Use a custom options class to allow the shared tag lib descriptors
+ to be loaded from jars in the tomcat sar conf/tlds directory. The
+ standard options implementation can only find taglibs based on the
+ class loader classpath.
+ -->
+ <init-param>
+ <param-name>engineOptionsClass</param-name>
+ <param-value>
+ org.jboss.web.tomcat.service.jasper.JspServletOptions</param-value>
+ </init-param>
+ <!-- Specify the jars relative to the jbossweb-tomcat6.sar that should
+ be scanned for common tag lib descriptors to include in every war
+ deployment.
+ -->
+ <init-param>
+ <description>JSF standard tlds</description>
+ <param-name>tagLibJar0</param-name>
+ <param-value>jsf-libs/jsf-impl.jar</param-value>
+ </init-param>
+ <init-param>
+ <description>JSTL standard tlds</description>
+ <param-name>tagLibJar1</param-name>
+ <param-value>jstl.jar</param-value>
+ </init-param>
+ <init-param>
+ <description>Portlet standard tlds</description>
+ <param-name>tagLibJar2</param-name>
+ <param-value>../../deploy/test-producer.sar/pc-portlet.jar</param-value>
+ </init-param>
+
+
+ <load-on-startup>3</load-on-startup>
+ </servlet>
+
+
+ <!-- Server Side Includes processing servlet, which processes SSI -->
+ <!-- directives in HTML pages consistent with similar support in web -->
+ <!-- servers like Apache. Traditionally, this servlet is mapped to the -->
+ <!-- URL pattern "*.shtml". This servlet supports the following -->
+ <!-- initialization parameters (default values are in square brackets): -->
+ <!-- -->
+ <!-- buffered Should output from this servlet be buffered? -->
+ <!-- (0=false, 1=true) [0] -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- expires The number of seconds before a page with SSI -->
+ <!-- directives will expire. [No default] -->
+ <!-- -->
+ <!-- isVirtualWebappRelative -->
+ <!-- Should "virtual" paths be interpreted as -->
+ <!-- relative to the context root, instead of -->
+ <!-- the server root? (0=false, 1=true) [0] -->
+
+ <!--
+ <servlet>
+ <servlet-name>ssi</servlet-name>
+ <servlet-class>
+ org.apache.catalina.ssi.SSIServlet
+ </servlet-class>
+ <init-param>
+ <param-name>buffered</param-name>
+ <param-value>1</param-value>
+ </init-param>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>expires</param-name>
+ <param-value>666</param-value>
+ </init-param>
+ <init-param>
+ <param-name>isVirtualWebappRelative</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <load-on-startup>4</load-on-startup>
+ </servlet>
+ -->
+
+
+ <!-- Common Gateway Includes (CGI) processing servlet, which supports -->
+ <!-- execution of external applications that conform to the CGI spec -->
+ <!-- requirements. Typically, this servlet is mapped to the URL pattern -->
+ <!-- "/cgi-bin/*", which means that any CGI applications that are -->
+ <!-- executed must be present within the web application. This servlet -->
+ <!-- supports the following initialization parameters (default values -->
+ <!-- are in square brackets): -->
+ <!-- -->
+ <!-- cgiPathPrefix The CGI search path will start at -->
+ <!-- webAppRootDir + File.separator + this prefix. -->
+ <!-- [WEB-INF/cgi] -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- executable Name of the exectuable used to run the -->
+ <!-- script. [perl] -->
+ <!-- -->
+ <!-- parameterEncoding Name of parameter encoding to be used with -->
+ <!-- CGI servlet. -->
+ <!-- [System.getProperty("file.encoding","UTF-8")] -->
+ <!-- -->
+ <!-- passShellEnvironment Should the shell environment variables (if -->
+ <!-- any) be passed to the CGI script? [false] -->
+ <!-- -->
+ <!-- IMPORTANT: To use the CGI servlet, you also need to rename the -->
+ <!-- $CATALINA_HOME/server/lib/servlets-cgi.renametojar file -->
+ <!-- to $CATALINA_HOME/server/lib/servlets-cgi.jar -->
+
+ <!--
+ <servlet>
+ <servlet-name>cgi</servlet-name>
+ <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>6</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cgiPathPrefix</param-name>
+ <param-value>WEB-INF/cgi</param-value>
+ </init-param>
+ <load-on-startup>5</load-on-startup>
+ </servlet>
+ -->
+
+
+ <!-- ================ Built In Servlet Mappings ========================= -->
+
+
+ <!-- The servlet mappings for the built in servlets defined above. Note -->
+ <!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
+ <!-- must uncomment these mappings (or add them to your application's own -->
+ <!-- web.xml deployment descriptor) to enable these services -->
+
+ <!-- The mapping for the default servlet -->
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+ <!-- The mapping for the invoker servlet -->
+ <!--
+ <servlet-mapping>
+ <servlet-name>invoker</servlet-name>
+ <url-pattern>/servlet/*</url-pattern>
+ </servlet-mapping>
+ -->
+
+ <!-- The mapping for the JSP servlet -->
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jsp</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jspx</url-pattern>
+ </servlet-mapping>
+
+ <!-- The mapping for the SSI servlet -->
+ <!--
+ <servlet-mapping>
+ <servlet-name>ssi</servlet-name>
+ <url-pattern>*.shtml</url-pattern>
+ </servlet-mapping>
+ -->
+
+ <!-- The mapping for the CGI Gateway servlet -->
+
+ <!--
+ <servlet-mapping>
+ <servlet-name>cgi</servlet-name>
+ <url-pattern>/cgi-bin/*</url-pattern>
+ </servlet-mapping>
+ -->
+
+
+ <!-- ==================== Default Session Configuration ================= -->
+ <!-- You can set the default session timeout (in minutes) for all newly -->
+ <!-- created sessions by modifying the value below. -->
+
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+
+ <!-- ===================== Default MIME Type Mappings =================== -->
+ <!-- When serving static resources, Tomcat will automatically generate -->
+ <!-- a "Content-Type" header based on the resource's filename extension, -->
+ <!-- based on these mappings. Additional mappings can be added here (to -->
+ <!-- apply to all web applications), or in your own application's web.xml -->
+ <!-- deployment descriptor. -->
+
+ <mime-mapping>
+ <extension>abs</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ai</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aif</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aifc</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aiff</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aim</extension>
+ <mime-type>application/x-aim</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>art</extension>
+ <mime-type>image/x-jg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asf</extension>
+ <mime-type>video/x-ms-asf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asx</extension>
+ <mime-type>video/x-ms-asf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>au</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>avi</extension>
+ <mime-type>video/x-msvideo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>avx</extension>
+ <mime-type>video/x-rad-screenplay</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bcpio</extension>
+ <mime-type>application/x-bcpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bin</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bmp</extension>
+ <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>body</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdf</extension>
+ <mime-type>application/x-cdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cer</extension>
+ <mime-type>application/x-x509-ca-cert</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>class</extension>
+ <mime-type>application/java</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cpio</extension>
+ <mime-type>application/x-cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csh</extension>
+ <mime-type>application/x-csh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>css</extension>
+ <mime-type>text/css</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dib</extension>
+ <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>doc</extension>
+ <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dtd</extension>
+ <mime-type>application/xml-dtd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dv</extension>
+ <mime-type>video/x-dv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dvi</extension>
+ <mime-type>application/x-dvi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eps</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>etx</extension>
+ <mime-type>text/x-setext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>exe</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gif</extension>
+ <mime-type>image/gif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gtar</extension>
+ <mime-type>application/x-gtar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gz</extension>
+ <mime-type>application/x-gzip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hdf</extension>
+ <mime-type>application/x-hdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hqx</extension>
+ <mime-type>application/mac-binhex40</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htc</extension>
+ <mime-type>text/x-component</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htm</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>html</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hqx</extension>
+ <mime-type>application/mac-binhex40</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ief</extension>
+ <mime-type>image/ief</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jad</extension>
+ <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jar</extension>
+ <mime-type>application/java-archive</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>java</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jnlp</extension>
+ <mime-type>application/x-java-jnlp-file</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpe</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpeg</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpg</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>js</extension>
+ <mime-type>text/javascript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jsf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jspf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kar</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>latex</extension>
+ <mime-type>application/x-latex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m3u</extension>
+ <mime-type>audio/x-mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mac</extension>
+ <mime-type>image/x-macpaint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>man</extension>
+ <mime-type>application/x-troff-man</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mathml</extension>
+ <mime-type>application/mathml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>me</extension>
+ <mime-type>application/x-troff-me</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mid</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>midi</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mif</extension>
+ <mime-type>application/x-mif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mov</extension>
+ <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>movie</extension>
+ <mime-type>video/x-sgi-movie</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp1</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp2</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp3</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp4</extension>
+ <mime-type>video/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpa</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpe</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpeg</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpega</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpg</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpv2</extension>
+ <mime-type>video/mpeg2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ms</extension>
+ <mime-type>application/x-wais-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nc</extension>
+ <mime-type>application/x-netcdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oda</extension>
+ <mime-type>application/oda</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Database -->
+ <extension>odb</extension>
+ <mime-type>application/vnd.oasis.opendocument.database</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Chart -->
+ <extension>odc</extension>
+ <mime-type>application/vnd.oasis.opendocument.chart</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Formula -->
+ <extension>odf</extension>
+ <mime-type>application/vnd.oasis.opendocument.formula</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Drawing -->
+ <extension>odg</extension>
+ <mime-type>application/vnd.oasis.opendocument.graphics</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Image -->
+ <extension>odi</extension>
+ <mime-type>application/vnd.oasis.opendocument.image</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Master Document -->
+ <extension>odm</extension>
+ <mime-type>application/vnd.oasis.opendocument.text-master</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Presentation -->
+ <extension>odp</extension>
+ <mime-type>application/vnd.oasis.opendocument.presentation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Spreadsheet -->
+ <extension>ods</extension>
+ <mime-type>application/vnd.oasis.opendocument.spreadsheet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Text -->
+ <extension>odt</extension>
+ <mime-type>application/vnd.oasis.opendocument.text</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Drawing Template -->
+ <extension>otg </extension>
+ <mime-type>application/vnd.oasis.opendocument.graphics-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- HTML Document Template -->
+ <extension>oth</extension>
+ <mime-type>application/vnd.oasis.opendocument.text-web</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Presentation Template -->
+ <extension>otp</extension>
+ <mime-type>application/vnd.oasis.opendocument.presentation-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Spreadsheet Template -->
+ <extension>ots</extension>
+ <mime-type>application/vnd.oasis.opendocument.spreadsheet-template </mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Text Template -->
+ <extension>ott</extension>
+ <mime-type>application/vnd.oasis.opendocument.text-template</mime-type>
+ </mime-mapping>
+ <!-- xiph mime types -->
+ <mime-mapping>
+ <extension>ogx</extension>
+ <mime-type>application/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ogv</extension>
+ <mime-type>video/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oga</extension>
+ <mime-type>audio/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ogg</extension>
+ <mime-type>audio/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spx</extension>
+ <mime-type>audio/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>flac</extension>
+ <mime-type>audio/flac</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>anx</extension>
+ <mime-type>application/annodex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>axa</extension>
+ <mime-type>audio/annodex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>axv</extension>
+ <mime-type>video/annodex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xspf</extension>
+ <mime-type>application/xspf+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pbm</extension>
+ <mime-type>image/x-portable-bitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pct</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pdf</extension>
+ <mime-type>application/pdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pgm</extension>
+ <mime-type>image/x-portable-graymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pic</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pict</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pls</extension>
+ <mime-type>audio/x-scpls</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>png</extension>
+ <mime-type>image/png</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pnm</extension>
+ <mime-type>image/x-portable-anymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pnt</extension>
+ <mime-type>image/x-macpaint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppm</extension>
+ <mime-type>image/x-portable-pixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppt</extension>
+ <mime-type>application/powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ps</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>psd</extension>
+ <mime-type>image/x-photoshop</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qt</extension>
+ <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qti</extension>
+ <mime-type>image/x-quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qtif</extension>
+ <mime-type>image/x-quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ras</extension>
+ <mime-type>image/x-cmu-raster</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rdf</extension>
+ <mime-type>application/rdf+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rgb</extension>
+ <mime-type>image/x-rgb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rm</extension>
+ <mime-type>application/vnd.rn-realmedia</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>roff</extension>
+ <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rtf</extension>
+ <mime-type>application/rtf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rtx</extension>
+ <mime-type>text/richtext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sh</extension>
+ <mime-type>application/x-sh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>shar</extension>
+ <mime-type>application/x-shar</mime-type>
+ </mime-mapping>
+<!--
+ <mime-mapping>
+ <extension>shtml</extension>
+ <mime-type>text/x-server-parsed-html</mime-type>
+ </mime-mapping>
+-->
+ <mime-mapping>
+ <extension>smf</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sit</extension>
+ <mime-type>application/x-stuffit</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>snd</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>src</extension>
+ <mime-type>application/x-wais-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sv4cpio</extension>
+ <mime-type>application/x-sv4cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sv4crc</extension>
+ <mime-type>application/x-sv4crc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swf</extension>
+ <mime-type>application/x-shockwave-flash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>t</extension>
+ <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tar</extension>
+ <mime-type>application/x-tar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tcl</extension>
+ <mime-type>application/x-tcl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tex</extension>
+ <mime-type>application/x-tex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>texi</extension>
+ <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>texinfo</extension>
+ <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tif</extension>
+ <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tiff</extension>
+ <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tr</extension>
+ <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tsv</extension>
+ <mime-type>text/tab-separated-values</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>txt</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ulw</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ustar</extension>
+ <mime-type>application/x-ustar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vxml</extension>
+ <mime-type>application/voicexml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xbm</extension>
+ <mime-type>image/x-xbitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xht</extension>
+ <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xhtml</extension>
+ <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xml</extension>
+ <mime-type>application/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpm</extension>
+ <mime-type>image/x-xpixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xsl</extension>
+ <mime-type>application/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xslt</extension>
+ <mime-type>application/xslt+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xul</extension>
+ <mime-type>application/vnd.mozilla.xul+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xwd</extension>
+ <mime-type>image/x-xwindowdump</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wav</extension>
+ <mime-type>audio/x-wav</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svg</extension>
+ <mime-type>image/svg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svgz</extension>
+ <mime-type>image/svg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vsd</extension>
+ <mime-type>application/x-visio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Wireless Bitmap -->
+ <extension>wbmp</extension>
+ <mime-type>image/vnd.wap.wbmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- WML Source -->
+ <extension>wml</extension>
+ <mime-type>text/vnd.wap.wml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Compiled WML -->
+ <extension>wmlc</extension>
+ <mime-type>application/vnd.wap.wmlc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- WML Script Source -->
+ <extension>wmls</extension>
+ <mime-type>text/vnd.wap.wmlscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Compiled WML Script -->
+ <extension>wmlscriptc</extension>
+ <mime-type>application/vnd.wap.wmlscriptc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wmv</extension>
+ <mime-type>video/x-ms-wmv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wrl</extension>
+ <mime-type>x-world/x-vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>Z</extension>
+ <mime-type>application/x-compress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z</extension>
+ <mime-type>application/x-compress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zip</extension>
+ <mime-type>application/zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xls</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>doc</extension>
+ <mime-type>application/vnd.ms-word</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppt</extension>
+ <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+
+ <!-- ==================== Default Welcome File List ===================== -->
+ <!-- When a request URI refers to a directory, the default servlet looks -->
+ <!-- for a "welcome file" within that directory and, if present, -->
+ <!-- to the corresponding resource URI for display. If no welcome file -->
+ <!-- is present, the default servlet either serves a directory listing, -->
+ <!-- or returns a 404 status, depending on how it is configured. -->
+ <!-- -->
+ <!-- If you define welcome files in your own application's web.xml -->
+ <!-- deployment descriptor, that list *replaces* the list configured -->
+ <!-- here, so be sure that you include any of the default values that -->
+ <!-- you wish to include. -->
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
14 years, 3 months