Skip to content

Commit

Permalink
Rely on polyglot's context-path normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Mar 6, 2013
1 parent 5cfdd7e commit 2725bb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
18 changes: 2 additions & 16 deletions modules/web/src/main/java/org/immutant/web/ring/RingMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class RingMetaData extends WebApplicationMetaData {
public RingMetaData(ClojureMetaData appMetaData) {
this.appMetaData = appMetaData;
setStaticPathPrefix( this.appMetaData.getString( "static" ) );
setContextPath(this.appMetaData.getString( "context-path" ));
final Object host = this.appMetaData.get( "virtual-host" );
if (host instanceof List) {
addHosts( (List)host );
Expand All @@ -49,25 +50,10 @@ public void attachTo(DeploymentUnit unit) {
unit.putAttachment( ATTACHMENT_KEY, this );
}

@Override
public String getContextPath() {
if (this.contextPath == null) {
this.contextPath = this.appMetaData.getString( "context-path" );
if (this.contextPath != null &&
!this.contextPath.startsWith( "/" )) {
this.contextPath = "/" + this.contextPath;
}
}

return this.contextPath;
}

public String toString() {
return "[RingApplicationMetaData:" + System.identityHashCode( this ) + "\n host=" + this.hosts + "\n context=" + this.contextPath + "]";
return "[RingApplicationMetaData:" + System.identityHashCode( this ) + "\n host=" + getHosts() + "\n context=" + getContextPath() + "]";
}


private ClojureMetaData appMetaData;
private List<String> hosts = new ArrayList<String>();
private String contextPath;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
(.getContextPath (make-md {"context-path" ?given})) => ?expected)
?expected ?given
"/foo" "/foo"
"/foo" "/foo/"
"/foo" "foo"
"/" "/"
nil nil
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
</dependencyManagement>

<properties>
<version.polyglot>1.x.incremental.11</version.polyglot>
<version.polyglot>1.x.incremental.13</version.polyglot>
<version.junit>4.7</version.junit>
<version.jmock>2.5.1</version.jmock>
<version.mockito>1.8.4</version.mockito>
Expand Down

0 comments on commit 2725bb8

Please sign in to comment.