Modified:
/jcatapult-core/trunk/.classpath
/jcatapult-core/trunk/jcatapult-core.eml
/jcatapult-core/trunk/jcatapult-core.iml
/jcatapult-core/trunk/jcatapult-core.ipr
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/JCatapultFilter.java
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/ServletTools.java
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/StaticResourceWorkflow.java
/jcatapult-core/trunk/src/java/test/unit/org/jcatapult/servlet/StaticResourceWorkflowTest.java
=======================================
--- /jcatapult-core/trunk/.classpath Wed Sep 10 17:12:27 2008
+++ /jcatapult-core/trunk/.classpath Tue Oct 13 23:02:24 2009
@@ -1,25 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER" />
- <classpathentry kind="src" path="src/conf/main" />
- <classpathentry kind="src" path="src/conf/test/unit"
output="target/classes/test/unit" />
- <classpathentry kind="src" path="src/java/main" />
- <classpathentry kind="src" path="src/java/test/integration"
output="target/classes/test/integration" />
- <classpathentry kind="src" path="src/java/test/unit"
output="target/classes/test/unit" />
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/com/google/code/guice/guice/1.0/guice-1.0.jar"
sourcepath="/SAVANT_REPOSITORY/com/google/code/guice/guice/1.0/guice-1.0-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"
sourcepath="/SAVANT_REPOSITORY/javax/persistence/persistence-api/1.0/persistence-api-1.0-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"
sourcepath="/SAVANT_REPOSITORY/javax/servlet/servlet-api/2.4/servlet-api-2.4-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/net/java/dev/java-net-commons/java-net-commons/1.5/java-net-commons-1.5.jar"
sourcepath="/SAVANT_REPOSITORY/net/java/dev/java-net-commons/java-net-commons/1.5/java-net-commons-1.5-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-collections/3.1/commons-collections-3.1.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-collections/3.1/commons-collections-3.1-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-configuration/1.4/commons-configuration-1.4.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-configuration/1.4/commons-configuration-1.4-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-lang/2.3/commons-lang-2.3.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-lang/2.3/commons-lang-2.3-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-logging/1.1/commons-logging-1.1.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-logging/1.1/commons-logging-1.1-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/easymock/easymock/2.2/easymock-2.2.jar"
sourcepath="/SAVANT_REPOSITORY/org/easymock/easymock/2.2/easymock-2.2-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/freemarker/freemarker/2.3.12/freemarker-2.3.12.jar"
sourcepath="/SAVANT_REPOSITORY/org/freemarker/freemarker/2.3.12/freemarker-2.3.12-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/hsqldb/hsqldb/1.8.9/hsqldb-1.8.9.jar"
sourcepath="/SAVANT_REPOSITORY/org/hsqldb/hsqldb/1.8.9/hsqldb-1.8.9-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/joda/joda-time/joda-time/1.4/joda-time-1.4.jar"
sourcepath="/SAVANT_REPOSITORY/org/joda/joda-time/joda-time/1.4/joda-time-1.4-src.jar"
/>
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/junit/junit/4.4/junit-4.4.jar"
sourcepath="/SAVANT_REPOSITORY/org/junit/junit/4.4/junit-4.4-src.jar" />
- <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/objectweb/asm/asm/3.1/asm-3.1.jar"
sourcepath="/SAVANT_REPOSITORY/org/objectweb/asm/asm/3.1/asm-3.1-src.jar" />
- <classpathentry kind="output" path="target/classes/main" />
+ <classpathentry kind="src" path="src/conf/main"/>
+ <classpathentry kind="src" path="src/java/main"/>
+ <classpathentry kind="src" output="target/classes/test/unit"
path="src/conf/test/unit"/>
+ <classpathentry kind="src" output="target/classes/test/integration"
path="src/java/test/integration"/>
+ <classpathentry kind="src" output="target/classes/test/unit"
path="src/java/test/unit"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/com/google/code/guice/guice/1.0/guice-1.0.jar"
sourcepath="/SAVANT_REPOSITORY/com/google/code/guice/guice/1.0/guice-1.0-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"
sourcepath="/SAVANT_REPOSITORY/javax/persistence/persistence-api/1.0/persistence-api-1.0-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"
sourcepath="/SAVANT_REPOSITORY/javax/servlet/servlet-api/2.4/servlet-api-2.4-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/net/java/dev/java-net-commons/java-net-commons/1.5/java-net-commons-1.5.jar"
sourcepath="/SAVANT_REPOSITORY/net/java/dev/java-net-commons/java-net-commons/1.5/java-net-commons-1.5-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-collections/3.1/commons-collections-3.1.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-collections/3.1/commons-collections-3.1-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-configuration/1.4/commons-configuration-1.4.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-configuration/1.4/commons-configuration-1.4-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-lang/2.3/commons-lang-2.3.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-lang/2.3/commons-lang-2.3-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/apache/commons/commons-logging/1.1/commons-logging-1.1.jar"
sourcepath="/SAVANT_REPOSITORY/org/apache/commons/commons-logging/1.1/commons-logging-1.1-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/easymock/easymock/2.2/easymock-2.2.jar"
sourcepath="/SAVANT_REPOSITORY/org/easymock/easymock/2.2/easymock-2.2-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/freemarker/freemarker/2.3.12/freemarker-2.3.12.jar"
sourcepath="/SAVANT_REPOSITORY/org/freemarker/freemarker/2.3.12/freemarker-2.3.12-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/hsqldb/hsqldb/1.8.9/hsqldb-1.8.9.jar"
sourcepath="/SAVANT_REPOSITORY/org/hsqldb/hsqldb/1.8.9/hsqldb-1.8.9-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/joda/joda-time/joda-time/1.4/joda-time-1.4.jar"
sourcepath="/SAVANT_REPOSITORY/org/joda/joda-time/joda-time/1.4/joda-time-1.4-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/junit/junit/4.4/junit-4.4.jar"
sourcepath="/SAVANT_REPOSITORY/org/junit/junit/4.4/junit-4.4-src.jar"/>
+ <classpathentry kind="var"
path="SAVANT_REPOSITORY/org/objectweb/asm/asm/3.1/asm-3.1.jar"
sourcepath="/SAVANT_REPOSITORY/org/objectweb/asm/asm/3.1/asm-3.1-src.jar"/>
+ <classpathentry kind="output" path="target/classes/main"/>
</classpath>
-
=======================================
--- /jcatapult-core/trunk/jcatapult-core.eml Tue Nov 27 08:05:30 2007
+++ /jcatapult-core/trunk/jcatapult-core.eml Tue Oct 13 23:02:24 2009
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<component inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes/main" />
- <exclude-output />
- <output-test url="file://$MODULE_DIR$/target/classes/test" />
- <testFolder url="file://$MODULE_DIR$/src/conf/test/unit" />
- <testFolder url="file://$MODULE_DIR$/src/java/test/integration" />
- <testFolder url="file://$MODULE_DIR$/src/java/test/unit" />
- <excludeFolder url="file://$MODULE_DIR$/target" />
+<component>
+ <output-test url="file://$MODULE_DIR$/target/classes/test"/>
+ <exclude-output/>
+ <contentEntry url="file://$MODULE_DIR$">
+ <testFolder url="file://$MODULE_DIR$/src/conf/test/unit"/>
+ <testFolder url="file://$MODULE_DIR$/src/java/test/integration"/>
+ <testFolder url="file://$MODULE_DIR$/src/java/test/unit"/>
+ <excludeFolder url="file://$MODULE_DIR$/target"/>
+ <excludeFolder url="file://$MODULE_DIR$/target/classes/main"/>
+ <excludeFolder url="file://$MODULE_DIR$/target/classes/test"/>
+ </contentEntry>
</component>
-
=======================================
--- /jcatapult-core/trunk/jcatapult-core.iml Sun Mar 8 12:08:52 2009
+++ /jcatapult-core/trunk/jcatapult-core.iml Tue Oct 13 23:02:24 2009
@@ -9,7 +9,7 @@
<datasource-mapping>
<factory-entry name="punit" />
</datasource-mapping>
- <deploymentDescriptor name="persistence.xml"
url="file://$MODULE_DIR$/src/conf/test/META-INF/persistence.xml"
optional="false" version="1.0" />
+ <deploymentDescriptor name="persistence.xml"
url="file://$MODULE_DIR$/src/conf/test/META-INF/persistence.xml" />
</configuration>
</facet>
</component>
=======================================
--- /jcatapult-core/trunk/jcatapult-core.ipr Mon May 11 15:52:13 2009
+++ /jcatapult-core/trunk/jcatapult-core.ipr Tue Oct 13 23:02:24 2009
@@ -88,72 +88,72 @@
<component name="IdProvider"
IDEtalkID="C3E10093AD37246DAE72198F2F6CDB7D" />
<component name="InspectionProjectProfileManager">
<option name="PROJECT_PROFILE" value="Project Default" />
- <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
- <scopes />
+ <option name="USE_PROJECT_PROFILE" value="true" />
+ <version value="1.0" />
<profiles>
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
- <inspection_tool class="InfiniteLoopStatement" level="WARNING"
enabled="false" />
- <inspection_tool class="TrivialIf" level="WARNING" enabled="false"
/>
- <inspection_tool class="EmptyFinallyBlock" level="WARNING"
enabled="false" />
- <inspection_tool class="EmptyStatementBody" level="WARNING"
enabled="false">
- <option name="m_reportEmptyBlocks" value="false" />
- </inspection_tool>
- <inspection_tool class="StringEquality" level="WARNING"
enabled="false" />
- <inspection_tool class="StringToString" level="WARNING"
enabled="false" />
- <inspection_tool class="LoopStatementsThatDontLoop"
level="WARNING" enabled="false" />
- <inspection_tool class="InfiniteRecursion" level="WARNING"
enabled="false" />
- <inspection_tool class="ConstantConditions" level="WARNING"
enabled="false">
+ <inspection_tool class="BooleanConstructor" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="CloneCallsSuperClone" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="CloneDeclaresCloneNotSupported"
enabled="false" level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="ConstantConditions" enabled="false"
level="WARNING" enabled_by_default="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false"
/>
</inspection_tool>
- <inspection_tool class="EmptyCatchBlock" level="WARNING"
enabled="false">
+ <inspection_tool class="ContinueOrBreakFromFinallyBlock"
enabled="false" level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="EmptyCatchBlock" enabled="false"
level="WARNING" enabled_by_default="false">
<option name="m_includeComments" value="true" />
<option name="m_ignoreTestCases" value="true" />
<option name="m_ignoreIgnoreParameter" value="true" />
</inspection_tool>
- <inspection_tool
class="UnnecessaryTemporaryOnConversionFromString" level="WARNING"
enabled="false" />
- <inspection_tool class="UnusedAssignment" level="WARNING"
enabled="false">
- <option name="REPORT_PREFIX_EXPRESSIONS" value="false" />
- <option name="REPORT_POSTFIX_EXPRESSIONS" value="true" />
- <option name="REPORT_REDUNDANT_INITIALIZER" value="true" />
+ <inspection_tool class="EmptyFinallyBlock" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="EmptyStatementBody" enabled="false"
level="WARNING" enabled_by_default="false">
+ <option name="m_reportEmptyBlocks" value="false" />
</inspection_tool>
- <inspection_tool class="ForCanBeForeach" level="WARNING"
enabled="false">
- <option name="REPORT_INDEXED_LOOP" value="true" />
- </inspection_tool>
- <inspection_tool class="FinalizeCallsSuperFinalize"
level="WARNING" enabled="false">
+ <inspection_tool class="EmptyTryBlock" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="ExtendsObject" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="FinalPrivateMethod" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="FinalStaticMethod" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="FinalizeCallsSuperFinalize"
enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_ignoreForObjectSubclasses" value="false" />
</inspection_tool>
- <inspection_tool class="UnnecessarySemicolon" level="WARNING"
enabled="false" />
- <inspection_tool class="PointlessArithmeticExpression"
level="WARNING" enabled="false">
+ <inspection_tool class="ForCanBeForeach" enabled="false"
level="WARNING" enabled_by_default="false">
+ <option name="REPORT_INDEXED_LOOP" value="true" />
+ </inspection_tool>
+ <inspection_tool class="InfiniteLoopStatement" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="InfiniteRecursion" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="LoopStatementsThatDontLoop"
enabled="false" level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="ManualArrayCopy" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="NoExplicitFinalizeCalls" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="PointlessArithmeticExpression"
enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_ignoreExpressionsContainingConstants"
value="false" />
</inspection_tool>
- <inspection_tool class="UnnecessaryTemporaryOnConversionToString"
level="WARNING" enabled="false" />
- <inspection_tool class="UnusedLabel" level="WARNING"
enabled="false" />
- <inspection_tool class="BooleanConstructor" level="WARNING"
enabled="false" />
- <inspection_tool class="ExtendsObject" level="WARNING"
enabled="false" />
- <inspection_tool class="UnnecessaryBoxing" level="WARNING"
enabled="false" />
- <inspection_tool class="CloneCallsSuperClone" level="WARNING"
enabled="false" />
- <inspection_tool class="ReturnFromFinallyBlock" level="WARNING"
enabled="false" />
- <inspection_tool class="EmptyTryBlock" level="WARNING"
enabled="false" />
- <inspection_tool class="ManualArrayCopy" level="WARNING"
enabled="false" />
- <inspection_tool class="ThrowFromFinallyBlock" level="WARNING"
enabled="false" />
- <inspection_tool class="CloneDeclaresCloneNotSupported"
level="WARNING" enabled="false" />
- <inspection_tool class="RedundantCast" level="WARNING"
enabled="false" />
- <inspection_tool class="StringConstructor" level="WARNING"
enabled="false">
+ <inspection_tool class="RedundantCast" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="RequiredAttributes" enabled="true"
level="WARNING" enabled_by_default="true">
+ <option name="myAdditionalRequiredHtmlAttributes" value="type" />
+ </inspection_tool>
+ <inspection_tool class="ReturnFromFinallyBlock" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="StringConstructor" enabled="false"
level="WARNING" enabled_by_default="false">
<option name="ignoreSubstringArguments" value="false" />
</inspection_tool>
- <inspection_tool class="UnnecessaryReturn" level="WARNING"
enabled="false" />
- <inspection_tool class="FinalStaticMethod" level="WARNING"
enabled="false" />
- <inspection_tool class="UnnecessaryUnboxing" level="WARNING"
enabled="false" />
- <inspection_tool class="NoExplicitFinalizeCalls" level="WARNING"
enabled="false" />
- <inspection_tool class="FinalPrivateMethod" level="WARNING"
enabled="false" />
- <inspection_tool class="ContinueOrBreakFromFinallyBlock"
level="WARNING" enabled="false" />
- <inspection_tool class="SynchronizeOnNonFinalField"
level="WARNING" enabled="false" />
- <inspection_tool class="RequiredAttributes" level="WARNING"
enabled="true">
- <option name="myAdditionalRequiredHtmlAttributes" value="type" />
+ <inspection_tool class="StringEquality" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="StringToString" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="SynchronizeOnNonFinalField"
enabled="false" level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="ThrowFromFinallyBlock" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="TrivialIf" enabled="false" level="WARNING"
enabled_by_default="false" />
+ <inspection_tool class="UnnecessaryBoxing" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="UnnecessaryReturn" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="UnnecessarySemicolon" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool
class="UnnecessaryTemporaryOnConversionFromString" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="UnnecessaryTemporaryOnConversionToString"
enabled="false" level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="UnnecessaryUnboxing" enabled="false"
level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="UnusedAssignment" enabled="false"
level="WARNING" enabled_by_default="false">
+ <option name="REPORT_PREFIX_EXPRESSIONS" value="false" />
+ <option name="REPORT_POSTFIX_EXPRESSIONS" value="true" />
+ <option name="REPORT_REDUNDANT_INITIALIZER" value="true" />
</inspection_tool>
+ <inspection_tool class="UnusedLabel" enabled="false"
level="WARNING" enabled_by_default="false" />
</profile>
</profiles>
<list size="0" />
@@ -320,7 +320,9 @@
<component name="ProjectDetails">
<option name="projectName" value="jcatapult-core" />
</component>
- <component name="ProjectFileVersion" converted="true" />
+ <component name="ProjectDictionaryState">
+ <dictionary name="bpontarelli" />
+ </component>
<component name="ProjectKey">
<option name="state"
value="https://jcatapult.googlecode.com/svn/jcatapult-core/trunk/jcatapult-core.ipr"
/>
</component>
@@ -518,8 +520,5 @@
<option name="useAlternate" value="false" />
</LanguageOptions>
</component>
- <UsedPathMacros>
- <macro name="SAVANT_REPOSITORY" description="" />
- </UsedPathMacros>
</project>
=======================================
---
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/JCatapultFilter.java
Thu Mar 12 10:28:33 2009
+++
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/JCatapultFilter.java
Tue Oct 13 23:02:24 2009
@@ -108,7 +108,7 @@
throws IOException, ServletException {
long start = System.currentTimeMillis();
if (request.getAttribute(ORIGINAL_REQUEST_URI) == null) {
- request.setAttribute(ORIGINAL_REQUEST_URI,
((HttpServletRequest) request).getRequestURI());
+ request.setAttribute(ORIGINAL_REQUEST_URI,
ServletTools.getRequestURI((HttpServletRequest) request));
}
ServletObjectsHolder.setServletRequest(new
HttpServletRequestWrapper((HttpServletRequest) request));
=======================================
---
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/ServletTools.java
Thu Jul 3 10:09:43 2008
+++
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/ServletTools.java
Tue Oct 13 23:02:24 2009
@@ -21,6 +21,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
/**
* Toolkit for Servlet related tasks
@@ -69,4 +70,20 @@
return baseUrl;
}
-}
+
+ /**
+ * The request URI without the context path.
+ *
+ * @param request The request.
+ * @return The uri minus the context path.
+ */
+ public static String getRequestURI(HttpServletRequest request) {
+ String uri = request.getRequestURI();
+ String context = request.getContextPath();
+ if (context.length() > 0) {
+ return uri.substring(context.length());
+ }
+
+ return uri;
+ }
+}
=======================================
---
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/StaticResourceWorkflow.java
Wed Nov 5 16:28:12 2008
+++
/jcatapult-core/trunk/src/java/main/org/jcatapult/servlet/StaticResourceWorkflow.java
Tue Oct 13 23:02:24 2009
@@ -98,7 +98,7 @@
* @throws ServletException If the chain throws.
*/
public void perform(WorkflowChain workflowChain) throws IOException,
ServletException {
- String uri = request.getRequestURI();
+ String uri = ServletTools.getRequestURI(request);
boolean handled = false;
if (enabled) {
// Ensure that this is a request for a resource like foo.jpg
=======================================
---
/jcatapult-core/trunk/src/java/test/unit/org/jcatapult/servlet/StaticResourceWorkflowTest.java
Wed Nov 5 16:28:12 2008
+++
/jcatapult-core/trunk/src/java/test/unit/org/jcatapult/servlet/StaticResourceWorkflowTest.java
Tue Oct 13 23:02:24 2009
@@ -51,9 +51,57 @@
HttpServletRequest req =
EasyMock.createStrictMock(HttpServletRequest.class);
EasyMock.expect(req.getRequestURI()).andReturn("/component/2.1.1/test.jpg");
+ EasyMock.expect(req.getContextPath()).andReturn("");
EasyMock.expect(req.getDateHeader("If-Modified-Since")).andReturn(0l);
EasyMock.replay(req);
+ final StringBuilder build = new StringBuilder();
+ ServletOutputStream sos = new ServletOutputStream() {
+ public void write(int b) throws IOException {
+ build.appendCodePoint(b);
+ }
+ };
+
+ HttpServletResponse res =
EasyMock.createStrictMock(HttpServletResponse.class);
+ res.setContentType("image/jpeg");
+ res.setDateHeader(EasyMock.eq("Date"),
EasyMock.geq(System.currentTimeMillis()));
+ res.setDateHeader("Expires", Long.MAX_VALUE);
+ res.setDateHeader("Retry-After", Long.MAX_VALUE);
+ res.setHeader("Cache-Control", "public");
+ res.setDateHeader("Last-Modified", 0);
+ EasyMock.expect(res.getOutputStream()).andReturn(sos);
+ EasyMock.replay(res);
+
+ WorkflowChain wc = EasyMock.createStrictMock(WorkflowChain.class);
+ EasyMock.replay(wc);
+
+ StaticResourceWorkflow srw = new StaticResourceWorkflow(context,
req, res, configuration);
+ srw.perform(wc);
+ EasyMock.verify(configuration, req, res, wc);
+
+ assertEquals("Test\n", build.toString());
+ }
+
+ /**
+ * Tests that a new request with a context path returns the byte
stream.
+ *
+ * @throws IOException Never.
+ * @throws ServletException Never.
+ */
+ @Test
+ public void testNewRequestContext() throws IOException,
ServletException {
+ Configuration configuration = makeConfiguration();
+
+ ServletContext context =
EasyMock.createStrictMock(ServletContext.class);
+
EasyMock.expect(context.getResource("/component/2.1.1/test.jpg")).andReturn(null);
+ EasyMock.replay(context);
+
+ HttpServletRequest req =
EasyMock.createStrictMock(HttpServletRequest.class);
+
EasyMock.expect(req.getRequestURI()).andReturn("/context-path/component/2.1.1/test.jpg");
+ EasyMock.expect(req.getContextPath()).andReturn("/context-path");
+
EasyMock.expect(req.getDateHeader("If-Modified-Since")).andReturn(0l);
+ EasyMock.replay(req);
+
final StringBuilder build = new StringBuilder();
ServletOutputStream sos = new ServletOutputStream() {
public void write(int b) throws IOException {
@@ -97,6 +145,7 @@
HttpServletRequest req =
EasyMock.createStrictMock(HttpServletRequest.class);
EasyMock.expect(req.getRequestURI()).andReturn("/component/2.1.1/test.jpg");
+ EasyMock.expect(req.getContextPath()).andReturn("");
EasyMock.expect(req.getDateHeader("If-Modified-Since")).andReturn(1l);
EasyMock.replay(req);
@@ -129,6 +178,7 @@
HttpServletRequest req =
EasyMock.createStrictMock(HttpServletRequest.class);
EasyMock.expect(req.getRequestURI()).andReturn("/component/2.1.1/bad.jpg");
+ EasyMock.expect(req.getContextPath()).andReturn("");
EasyMock.expect(req.getDateHeader("If-Modified-Since")).andReturn(0l);
EasyMock.replay(req);
@@ -159,6 +209,7 @@
HttpServletRequest req =
EasyMock.createStrictMock(HttpServletRequest.class);
EasyMock.expect(req.getRequestURI()).andReturn("/foo/bar");
+ EasyMock.expect(req.getContextPath()).andReturn("");
EasyMock.replay(req);
HttpServletResponse res =
EasyMock.createStrictMock(HttpServletResponse.class);