Skip to content

Commit dfbc252

Browse files
committed
Initial proxy skeleton
1 parent 6c907b5 commit dfbc252

18 files changed

Lines changed: 506 additions & 68 deletions

File tree

‎config-proxy/README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Tuckey URLRewriteFilter integration for Rewrite
2+
===============================================
3+
4+
A (for now) simple integration that loads the standard WEB-INF/urlrewrite.xml file for use in Rewrite
5+
6+
How to use
7+
==========
8+
9+
10+
* Remove URLRewriteFilter from your web.xml and POM.
11+
12+
* Leave your existing /WEB-INF/urlrewrite.xml [configuration file](http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html#configuration) in place.
13+
14+
* Include OCPSoft Rewrite in your application's POM file:
15+
16+
<dependency>
17+
<groupId>org.ocpsoft.rewrite</groupId>
18+
<artifactId>rewrite-config-tuckey</artifactId>
19+
<version>${rewrite.version}</version>
20+
</dependency>
21+
22+
* Run your Rewrite enhanced application!
23+
24+
TODO's
25+
======
26+
27+
* Integrate with mod_rewrite style configuration.
28+
29+
* Support Tuckey.org init parameters and configuration reloading.

‎config-proxy/pom.xml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<artifactId>rewrite-parent</artifactId>
7+
<groupId>org.ocpsoft.rewrite</groupId>
8+
<version>2.0.0-SNAPSHOT</version>
9+
<relativePath>../</relativePath>
10+
</parent>
11+
12+
<artifactId>rewrite-config-proxy</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.ocpsoft.rewrite</groupId>
17+
<artifactId>rewrite-api-servlet</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.jboss.spec.javax.servlet</groupId>
21+
<artifactId>jboss-servlet-api_2.5_spec</artifactId>
22+
<scope>provided</scope>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>org.ocpsoft.rewrite</groupId>
27+
<artifactId>rewrite-test-harness</artifactId>
28+
<scope>test</scope>
29+
</dependency>
30+
</dependencies>
31+
<build>
32+
<finalName>config-proxy</finalName>
33+
</build>
34+
</project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.ocpsoft.rewrite.config.proxy;
2+
3+
import java.util.Set;
4+
5+
import org.ocpsoft.rewrite.context.EvaluationContext;
6+
import org.ocpsoft.rewrite.param.ParameterStore;
7+
import org.ocpsoft.rewrite.param.Parameterized;
8+
import org.ocpsoft.rewrite.param.ParameterizedPatternBuilder;
9+
import org.ocpsoft.rewrite.param.RegexParameterizedPatternBuilder;
10+
import org.ocpsoft.rewrite.servlet.config.HttpOperation;
11+
import org.ocpsoft.rewrite.servlet.http.event.HttpServletRewrite;
12+
import org.ocpsoft.rewrite.util.ParseTools.CaptureType;
13+
14+
public class Proxy extends HttpOperation implements Parameterized
15+
{
16+
private static ParameterizedPatternBuilder location;
17+
18+
public Proxy(String url)
19+
{
20+
location = new RegexParameterizedPatternBuilder(CaptureType.BRACE, "[^/]+", url);
21+
}
22+
23+
public static Proxy to(String url)
24+
{
25+
return new Proxy(url);
26+
}
27+
28+
@Override
29+
public void performHttp(HttpServletRewrite event, EvaluationContext context)
30+
{
31+
32+
}
33+
34+
@Override
35+
public Set<String> getRequiredParameterNames()
36+
{
37+
return location.getRequiredParameterNames();
38+
}
39+
40+
@Override
41+
public void setParameterStore(ParameterStore store)
42+
{
43+
location.setParameterStore(store);
44+
}
45+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.ocpsoft.rewrite.config.tuckey.TuckeyConfigurationProvider

‎pom.xml‎

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!-- Copyright 2011 Lincoln Baxter, III Licensed under the Apache License,
4-
Version 2.0 (the "License"); you may not use this file except in compliance
5-
with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6-
Unless required by applicable law or agreed to in writing, software distributed
7-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
8-
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
9-
the specific language governing permissions and limitations under the License. -->
3+
<!-- Copyright 2011 Lincoln Baxter, III Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
4+
file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS
6+
IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
7+
governing permissions and limitations under the License. -->
108

11-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
9+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1211
<modelVersion>4.0.0</modelVersion>
1312
<groupId>org.ocpsoft.rewrite</groupId>
1413
<artifactId>rewrite-parent</artifactId>
@@ -50,6 +49,7 @@
5049
<module>config-jodatime</module>
5150
<module>config-prettyfaces</module>
5251
<module>config-prettyfaces-tests</module>
52+
<module>config-proxy</module>
5353
<module>config-servlet</module>
5454
<module>config-servlet-tests</module>
5555
<module>config-tuckey</module>
@@ -171,6 +171,11 @@
171171
<artifactId>rewrite-config-prettyfaces</artifactId>
172172
<version>${project.version}</version>
173173
</dependency>
174+
<dependency>
175+
<groupId>org.ocpsoft.rewrite</groupId>
176+
<artifactId>rewrite-config-proxy</artifactId>
177+
<version>${project.version}</version>
178+
</dependency>
174179
<dependency>
175180
<groupId>org.ocpsoft.rewrite</groupId>
176181
<artifactId>rewrite-config-tuckey</artifactId>
@@ -280,8 +285,7 @@
280285
</dependency>
281286

282287

283-
<!-- We are overriding version of ShrinkWrap Maven Resolver from
284-
Arquillian BOM -->
288+
<!-- We are overriding version of ShrinkWrap Maven Resolver from Arquillian BOM -->
285289
<dependency>
286290
<groupId>org.jboss.shrinkwrap.resolver</groupId>
287291
<artifactId>shrinkwrap-resolver-bom</artifactId>
@@ -296,13 +300,13 @@
296300
<type>pom</type>
297301
<scope>import</scope>
298302
</dependency>
299-
<dependency>
303+
<dependency>
300304
<groupId>org.jboss.arquillian.extension</groupId>
301305
<artifactId>arquillian-drone-bom</artifactId>
302306
<version>${version.arquillian}</version>
303307
<type>pom</type>
304308
<scope>import</scope>
305-
</dependency>
309+
</dependency>
306310
</dependencies>
307311
</dependencyManagement>
308312

@@ -363,8 +367,7 @@
363367
</dependency>
364368

365369
<!-- Weld servlet, EL and JSP required for testing CDI injections -->
366-
<!-- Don't use 'org.jboss.weld.servlet:weld-servlet' as it has
367-
an incompatible slf4j version shaded in -->
370+
<!-- Don't use 'org.jboss.weld.servlet:weld-servlet' as it has an incompatible slf4j version shaded in -->
368371
<dependency>
369372
<groupId>org.jboss.weld.servlet</groupId>
370373
<artifactId>weld-servlet-core</artifactId>
@@ -450,7 +453,8 @@
450453
<phase>process-test-classes</phase>
451454
<configuration>
452455
<target>
453-
<copy file="${user.dir}/test-harness/src/main/resources/jbossas-managed-standalone.xml" todir="${project.build.directory}/container/jboss-as-${version.jbossas}/standalone/configuration" />
456+
<copy file="${user.dir}/test-harness/src/main/resources/jbossas-managed-standalone.xml"
457+
todir="${project.build.directory}/container/jboss-as-${version.jbossas}/standalone/configuration" />
454458
</target>
455459
</configuration>
456460
<goals>
@@ -522,15 +526,28 @@
522526
<configuration>
523527
<target>
524528
<mkdir dir="${container.download.dir}" />
525-
<get dest="${container.download.dir}" verbose="true" skipexisting="true" src="http://download.java.net/glassfish/${version.glassfish}/release/glassfish-${version.glassfish}-web.zip" />
529+
<get dest="${container.download.dir}" verbose="true" skipexisting="true"
530+
src="http://download.java.net/glassfish/${version.glassfish}/release/glassfish-${version.glassfish}-web.zip" />
526531
<unzip src="${container.download.dir}/glassfish-${version.glassfish}-web.zip" dest="${project.build.directory}/container" />
527532
<!-- Change all TCP ports from "xxxx" to "3xxxx" -->
528-
<replace file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml" token="port=&quot;8080&quot;" value="port=&quot;38080&quot;" />
529-
<replace file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml" token="port=&quot;8181&quot;" value="port=&quot;38181&quot;" />
530-
<replace file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml" token="port=&quot;4848&quot;" value="port=&quot;34848&quot;" />
531-
<replace file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml" token="port=&quot;3700&quot;" value="port=&quot;33700&quot;" />
532-
<replace file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml" token="port=&quot;8686&quot;" value="port=&quot;38686&quot;" />
533-
<replace file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml" token="port=&quot;7676&quot;" value="port=&quot;37676&quot;" />
533+
<replace
534+
file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml"
535+
token="port=&quot;8080&quot;" value="port=&quot;38080&quot;" />
536+
<replace
537+
file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml"
538+
token="port=&quot;8181&quot;" value="port=&quot;38181&quot;" />
539+
<replace
540+
file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml"
541+
token="port=&quot;4848&quot;" value="port=&quot;34848&quot;" />
542+
<replace
543+
file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml"
544+
token="port=&quot;3700&quot;" value="port=&quot;33700&quot;" />
545+
<replace
546+
file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml"
547+
token="port=&quot;8686&quot;" value="port=&quot;38686&quot;" />
548+
<replace
549+
file="${project.build.directory}/container/glassfish3/glassfish/domains/domain1/config/domain.xml"
550+
token="port=&quot;7676&quot;" value="port=&quot;37676&quot;" />
534551
</target>
535552
</configuration>
536553
</execution>
@@ -590,13 +607,18 @@
590607
<configuration>
591608
<target>
592609
<mkdir dir="${container.download.dir}" />
593-
<get dest="${container.download.dir}" verbose="true" skipexisting="true" src="http://archive.apache.org/dist/tomcat/tomcat-7/v${version.tomcat}/bin/apache-tomcat-${version.tomcat}.zip" />
610+
<get dest="${container.download.dir}" verbose="true" skipexisting="true"
611+
src="http://archive.apache.org/dist/tomcat/tomcat-7/v${version.tomcat}/bin/apache-tomcat-${version.tomcat}.zip" />
594612
<unzip src="${container.download.dir}/apache-tomcat-${version.tomcat}.zip" dest="${project.build.directory}/container" />
595-
<move file="${project.build.directory}/container/apache-tomcat-${version.tomcat}" tofile="${project.build.directory}/container/apache-tomcat-7" />
613+
<move file="${project.build.directory}/container/apache-tomcat-${version.tomcat}"
614+
tofile="${project.build.directory}/container/apache-tomcat-7" />
596615
<!-- Change all TCP ports from "xxxx" to "3xxxx" -->
597-
<replace file="${project.build.directory}/container/apache-tomcat-7/conf/server.xml" token="port=&quot;8005&quot;" value="port=&quot;38005&quot;" />
598-
<replace file="${project.build.directory}/container/apache-tomcat-7/conf/server.xml" token="port=&quot;8080&quot;" value="port=&quot;38080&quot;" />
599-
<replace file="${project.build.directory}/container/apache-tomcat-7/conf/server.xml" token="port=&quot;8009&quot;" value="port=&quot;38009&quot;" />
616+
<replace file="${project.build.directory}/container/apache-tomcat-7/conf/server.xml"
617+
token="port=&quot;8005&quot;" value="port=&quot;38005&quot;" />
618+
<replace file="${project.build.directory}/container/apache-tomcat-7/conf/server.xml"
619+
token="port=&quot;8080&quot;" value="port=&quot;38080&quot;" />
620+
<replace file="${project.build.directory}/container/apache-tomcat-7/conf/server.xml"
621+
token="port=&quot;8009&quot;" value="port=&quot;38009&quot;" />
600622
<!-- Authentication for Tomcat Manager -->
601623
<echo file="${project.build.directory}/container/apache-tomcat-7/conf/tomcat-users.xml">
602624
<![CDATA[
@@ -633,8 +655,7 @@
633655
</dependency>
634656
</dependencies>
635657
<repositories>
636-
<!-- We current need this because we have to use the SNAPSHOTS
637-
for the Tomcat container adapter -->
658+
<!-- We current need this because we have to use the SNAPSHOTS for the Tomcat container adapter -->
638659
<repository>
639660
<id>arquillian-snapshots</id>
640661
<url>https://repository-arquillian.forge.cloudbees.com/snapshot/</url>
@@ -706,8 +727,8 @@
706727
<connection>scm:git:git://github.com/ocpsoft/rewrite.git</connection>
707728
<developerConnection>scm:git:git@github.com:ocpsoft/rewrite.git</developerConnection>
708729
<url>http://github.com/ocpsoft/rewrite</url>
709-
<tag>HEAD</tag>
710-
</scm>
730+
<tag>HEAD</tag>
731+
</scm>
711732

712733
<issueManagement>
713734
<system>GitHub</system>

‎showcase/pom.xml‎

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<parent>
5-
<artifactId>rewrite-parent</artifactId>
6-
<groupId>org.ocpsoft.rewrite</groupId>
7-
<version>2.0.0-SNAPSHOT</version>
8-
<relativePath>../</relativePath>
9-
</parent>
10-
11-
<groupId>org.ocpsoft.rewrite.showcase</groupId>
12-
<artifactId>rewrite-showcase</artifactId>
13-
<packaging>pom</packaging>
14-
15-
<modules>
16-
<module>access-control</module>
17-
<module>composite-query</module>
18-
<module>rest-ws</module>
19-
<module>bookstore</module>
20-
</modules>
21-
22-
<dependencyManagement>
23-
<dependencies>
24-
<dependency>
25-
<groupId>org.jboss.spec</groupId>
26-
<artifactId>jboss-javaee-6.0</artifactId>
27-
<version>${version.jboss.spec}</version>
28-
<type>pom</type>
29-
<scope>provided</scope>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.ocpsoft.prettytime</groupId>
33-
<artifactId>prettytime</artifactId>
34-
<version>1.0.8.Final</version>
35-
<scope>compile</scope>
36-
</dependency>
37-
</dependencies>
38-
</dependencyManagement>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>rewrite-parent</artifactId>
7+
<groupId>org.ocpsoft.rewrite</groupId>
8+
<version>2.0.0-SNAPSHOT</version>
9+
<relativePath>../</relativePath>
10+
</parent>
11+
<groupId>org.ocpsoft.rewrite.showcase</groupId>
12+
<artifactId>rewrite-showcase</artifactId>
13+
<packaging>pom</packaging>
14+
<modules>
15+
<module>access-control</module>
16+
<module>composite-query</module>
17+
<module>rest-ws</module>
18+
<module>bookstore</module>
19+
<module>proxy-server</module>
20+
</modules>
21+
<dependencyManagement>
22+
<dependencies>
23+
<dependency>
24+
<groupId>org.jboss.spec</groupId>
25+
<artifactId>jboss-javaee-6.0</artifactId>
26+
<version>${version.jboss.spec}</version>
27+
<type>pom</type>
28+
<scope>provided</scope>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.ocpsoft.prettytime</groupId>
32+
<artifactId>prettytime</artifactId>
33+
<version>1.0.8.Final</version>
34+
<scope>compile</scope>
35+
</dependency>
36+
</dependencies>
37+
</dependencyManagement>
3938
</project>

0 commit comments

Comments
 (0)