Skip to content

Commit

Permalink
Merge branch 'securityproxy-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tfr42 committed Feb 26, 2019
2 parents eb291be + 657c929 commit 1e93b48
Show file tree
Hide file tree
Showing 9 changed files with 559 additions and 176 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.class

.classpath
.project
.settings
# Package Files #
*.jar
*.war
Expand Down
82 changes: 67 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<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">
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>de.latlon</groupId>
<artifactId>j2ep</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<packaging>jar</packaging>
<version>1.2-securityproxy-master</version>
<name>j2ep</name>
<description>Fork of jEasy Extensible Proxy - svn://svn.code.sf.net/p/j2ep/code/trunk</description>
<build>
Expand All @@ -17,7 +16,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<version>2.22.1</version>
<configuration>
<excludes>
<exclude>**/PostTest*</exclude>
Expand All @@ -31,14 +30,22 @@
</excludes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.7</version>
<version>1.8.1</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
Expand All @@ -49,12 +56,12 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
<version>1.11</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.5</version>
<version>1.9.3</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
Expand All @@ -80,35 +87,80 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<version>3.8.1</version>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.2.1</version>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<server.url>http://localhost:8080</server.url>
<catalina.home></catalina.home>
</properties>
</project>

<scm>
<connection>scm:git:[email protected]:lat-lon/j2ep.git</connection>
<developerConnection>scm:git:[email protected]:lat-lon/j2ep.git</developerConnection>
<url>https://github.com/lat-lon/j2ep.git</url>
</scm>

<repositories>
<repository>
<id>latlon-repo</id>
<url>http://repo.lat-lon/nexus/content/groups/public/</url>
</repository>
<repository>
<id>j2ep-releases</id>
<url>http://repo.lat-lon/nexus/content/repositories/j2ep-release/</url>
</repository>
<repository>
<id>j2ep-snapshots</id>
<url>http://repo.lat-lon/nexus/content/repositories/j2ep-snapshots/</url>
</repository>
</repositories>

<distributionManagement>
<repository>
<id>j2ep-releases</id>
<url>http://repo.lat-lon/nexus/content/repositories/j2ep-release/</url>
</repository>
<snapshotRepository>
<id>j2ep-snapshots</id>
<url>http://repo.lat-lon/nexus/content/repositories/j2ep-snapshots/</url>
</snapshotRepository>
</distributionManagement>

<pluginRepositories>
<pluginRepository>
<id>latlon-repo</id>
<url>http://repo.lat-lon/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
51 changes: 44 additions & 7 deletions src/main/java/net/sf/j2ep/ConfigParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
package net.sf.j2ep;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.LinkedList;

Expand Down Expand Up @@ -53,11 +57,45 @@ public class ConfigParser {
* mappings included.
*
* @param data The config file containing the XML data structure
* @throws FileNotFoundException
*/
public ConfigParser(File data) {
public ConfigParser( File data ) {
createServerChain( data );
}

/**
* Standard constructor only specifying the input file. The constructor will
* parse the config and build a corresponding rule chain with the server
* mappings included.
*
* @param data The config file containing the XML data structure
*/
public ConfigParser(InputStream data) {
createServerChain( data );
}


private void createServerChain( File data ) {
log = LogFactory.getLog( ConfigParser.class );
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream( data );
createServerChain( fileInputStream );
} catch ( Exception e ) {
throw new RuntimeException( e );
} finally {
if ( fileInputStream != null )
try {
fileInputStream.close();
} catch ( IOException e ) {
}
}
}

private void createServerChain( InputStream data ) {
log = LogFactory.getLog(ConfigParser.class);
try {
LinkedList serverContainer = createServerList(data);
LinkedList<?> serverContainer = createServerList(data);
if (log.isDebugEnabled()) {
debugServers(serverContainer);
}
Expand All @@ -66,7 +104,6 @@ public ConfigParser(File data) {
throw new RuntimeException(e);
}
}

/**
* Returns the parsed server chain.
*
Expand All @@ -81,7 +118,7 @@ public ServerChain getServerChain() {
*
* @return The rules all put into a rule chain
*/
private LinkedList createServerList(File data) throws Exception {
private LinkedList<?> createServerList(InputStream data) throws Exception {
Digester digester = new Digester();
digester.setUseContextClassLoader(true);

Expand Down Expand Up @@ -133,7 +170,7 @@ private LinkedList createServerList(File data) throws Exception {
// Add server to list
digester.addSetNext("config/cluster-server", "add");

return (LinkedList) digester.parse(data);
return (LinkedList<?>) digester.parse(data);
}

/**
Expand All @@ -142,8 +179,8 @@ private LinkedList createServerList(File data) throws Exception {
*
* @param servers The server to debug
*/
private void debugServers(LinkedList servers) {
Iterator itr = servers.iterator();
private void debugServers(LinkedList<?> servers) {
Iterator<?> itr = servers.iterator();

while (itr.hasNext()) {
ServerContainer container = (ServerContainer) itr.next();
Expand Down
Loading

0 comments on commit 1e93b48

Please sign in to comment.