jrevproxy-cvs Mailing List for jRevProxy
Status: Alpha
Brought to you by:
fnoe
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(13) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(25) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
|
From: Frederik N. <fn...@us...> - 2005-10-30 10:58:27
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30732/src/cx/noe/jrevproxy Added Files: PasswordHandler.java Log Message: update --- NEW FILE: PasswordHandler.java --- /* * Created on Mar 24, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package cx.noe.jrevproxy; import javax.crypto.*; /** * @author freon * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class PasswordHandler { } |
|
From: Frederik N. <fn...@us...> - 2005-10-25 21:20:58
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31260/src/cx/noe/jrevproxy Modified Files: Ruleset.java HTTPResponse.java Rule.java RequestHandler.java SocketFactory.java Log Message: renamed enum variables to resolve restrictions imposed by 5.0 compiler Index: HTTPResponse.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPResponse.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** HTTPResponse.java 26 Dec 2003 19:14:18 -0000 1.21 --- HTTPResponse.java 25 Oct 2005 21:20:47 -0000 1.22 *************** *** 171,177 **** // Add the different headers to the HTTP response // Walk over the different keys ! Enumeration enum = headers.keys(); ! while(enum.hasMoreElements()) { ! String key = (String)enum.nextElement(); tmp += key.trim(); tmp += ": "; --- 171,177 ---- // Add the different headers to the HTTP response // Walk over the different keys ! Enumeration e = headers.keys(); ! while(e.hasMoreElements()) { ! String key = (String)e.nextElement(); tmp += key.trim(); tmp += ": "; Index: Rule.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/Rule.java,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** Rule.java 26 Dec 2003 22:04:31 -0000 2.9 --- Rule.java 25 Oct 2005 21:20:47 -0000 2.10 *************** *** 164,172 **** public boolean isAuthorized(String subjectdn){ ! Enumeration enum = users.elements(); String user = null; ! while(enum.hasMoreElements()) { ! user = (String) enum.nextElement(); if(user.compareToIgnoreCase(subjectdn) == 0) --- 164,172 ---- public boolean isAuthorized(String subjectdn){ ! Enumeration e = users.elements(); String user = null; ! while(e.hasMoreElements()) { ! user = (String) e.nextElement(); if(user.compareToIgnoreCase(subjectdn) == 0) Index: RequestHandler.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RequestHandler.java,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** RequestHandler.java 26 Dec 2003 19:14:18 -0000 2.30 --- RequestHandler.java 25 Oct 2005 21:20:47 -0000 2.31 *************** *** 744,750 **** // we make a filter chain based on the filters specified in // the xml configuration file ! Enumeration enum = responseFilters.elements(); ! while(enum.hasMoreElements()) { ! Class cl = (Class)enum.nextElement(); log(DEBUG,"Filter class: " + cl.toString()); IHTTPFilter f = createFilterInstance(cl); --- 744,750 ---- // we make a filter chain based on the filters specified in // the xml configuration file ! Enumeration e = responseFilters.elements(); ! while(e.hasMoreElements()) { ! Class cl = (Class)e.nextElement(); log(DEBUG,"Filter class: " + cl.toString()); IHTTPFilter f = createFilterInstance(cl); Index: Ruleset.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/Ruleset.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -d -r2.7 -r2.8 *** Ruleset.java 26 Dec 2003 19:14:18 -0000 2.7 --- Ruleset.java 25 Oct 2005 21:20:47 -0000 2.8 *************** *** 54,62 **** private boolean isNewRule(Rule r) { // walk over the list of rules and find out if it is a new rule ! Enumeration enum = rules.elements(); Rule rule = null; ! while(enum.hasMoreElements()) { ! rule = (Rule) enum.nextElement(); if(rule.getName().equals(r.getName())) return false; --- 54,62 ---- private boolean isNewRule(Rule r) { // walk over the list of rules and find out if it is a new rule ! Enumeration e = rules.elements(); Rule rule = null; ! while(e.hasMoreElements()) { ! rule = (Rule) e.nextElement(); if(rule.getName().equals(r.getName())) return false; *************** *** 89,97 **** */ public Rule getApplicableRule(String virtualdir) { ! Enumeration enum = rules.elements(); Rule rule = null; ! while(enum.hasMoreElements()) { ! rule = (Rule) enum.nextElement(); if(rule.isApplicable(virtualdir)) --- 89,97 ---- */ public Rule getApplicableRule(String virtualdir) { ! Enumeration e = rules.elements(); Rule rule = null; ! while(e.hasMoreElements()) { ! rule = (Rule) e.nextElement(); if(rule.isApplicable(virtualdir)) Index: SocketFactory.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/SocketFactory.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -d -r2.4 -r2.5 *** SocketFactory.java 26 Dec 2003 19:14:18 -0000 2.4 --- SocketFactory.java 25 Oct 2005 21:20:47 -0000 2.5 *************** *** 82,86 **** log(INFO,"trustStore: " + trustStoreName); ! Enumeration enum = truststore.aliases(); log(DEBUG,"trustStore contains the following aliases:"); --- 82,86 ---- log(INFO,"trustStore: " + trustStoreName); ! Enumeration e = truststore.aliases(); log(DEBUG,"trustStore contains the following aliases:"); *************** *** 88,93 **** int counter = 1; ! while(enum.hasMoreElements()) { ! String alias = (String)enum.nextElement(); log(DEBUG,"alias "+ counter++ + ": " + alias); } --- 88,93 ---- int counter = 1; ! while(e.hasMoreElements()) { ! String alias = (String)e.nextElement(); log(DEBUG,"alias "+ counter++ + ": " + alias); } |
|
From: Frederik N. <fn...@us...> - 2005-10-25 21:20:54
|
Update of /cvsroot/jrevproxy/jRevProxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31260 Added Files: .classpath Log Message: renamed enum variables to resolve restrictions imposed by 5.0 compiler --- NEW FILE: .classpath --- <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path=""/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path=""/> </classpath> |
|
From: Frederik N. <fn...@us...> - 2005-01-02 09:59:17
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3999/src/cx/noe/jrevproxy Modified Files: VersionInfo.java Log Message: update of build information Index: VersionInfo.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/VersionInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VersionInfo.java 27 Dec 2003 09:14:58 -0000 1.3 --- VersionInfo.java 2 Jan 2005 09:59:06 -0000 1.4 *************** *** 30,34 **** private final String version = "v0.6"; ! private final int buildNumber = 1006; public String getVersion() { --- 30,34 ---- private final String version = "v0.6"; ! private final int buildNumber = 1019; public String getVersion() { |
|
From: Frederik N. <fn...@us...> - 2004-03-28 11:46:27
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18748/src/cx/noe/jrevproxy Modified Files: RevProxy.java Log Message: Method refactoring Index: RevProxy.java =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RevProxy.java,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** RevProxy.java 26 Dec 2003 19:14:18 -0000 2.24 --- RevProxy.java 28 Mar 2004 11:35:09 -0000 2.25 *************** *** 99,110 **** return; } ! ! System.out.println("jRevProxy " + new VersionInfo().toString()); ! System.out.println(""); ! System.out.print("Java VM: " + System.getProperty("java.vm.name")); ! System.out.println(" " +System.getProperty("java.vm.version")); ! System.out.print("OS: " + System.getProperty("os.name")); ! System.out.print(" " + System.getProperty("os.version")); ! System.out.println(" " + System.getProperty("os.arch")); // // load the configuration file --- 99,103 ---- return; } ! showLogInfo(); // // load the configuration file *************** *** 326,329 **** --- 319,336 ---- System.out.println("jRevProxy stopped"); } + /** + * Show logging information on console + * + */ + private static void showLogInfo() { + + System.out.println("jRevProxy " + new VersionInfo().toString()); + System.out.println(""); + System.out.print("Java VM: " + System.getProperty("java.vm.name")); + System.out.println(" " +System.getProperty("java.vm.version")); + System.out.print("OS: " + System.getProperty("os.name")); + System.out.print(" " + System.getProperty("os.version")); + System.out.println(" " + System.getProperty("os.arch")); + } /** |
|
From: <fn...@us...> - 2003-12-27 09:15:02
|
Update of /cvsroot/jrevproxy/jRevProxy/build In directory sc8-pr-cvs1:/tmp/cvs-serv14960/build Modified Files: build.number Log Message: Added startup scripts to src subdirectory Index: build.number =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/build/build.number,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.number 29 May 2003 08:15:19 -0000 1.2 --- build.number 27 Dec 2003 09:14:58 -0000 1.3 *************** *** 1,3 **** #Build Number for ANT. Do not edit! ! #Thu May 29 10:13:24 WEST 2003 ! build.number=1003 --- 1,3 ---- #Build Number for ANT. Do not edit! ! #Fri Dec 26 23:03:45 CET 2003 ! build.number=1007 |
|
From: <fn...@us...> - 2003-12-27 09:15:02
|
Update of /cvsroot/jrevproxy/jRevProxy In directory sc8-pr-cvs1:/tmp/cvs-serv14960 Modified Files: .project Log Message: Added startup scripts to src subdirectory Index: .project =================================================================== RCS file: /cvsroot/jrevproxy/jRevProxy/.project,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .project 24 Dec 2003 23:29:11 -0000 1.1 --- .project 27 Dec 2003 09:14:58 -0000 1.2 *************** *** 1,11 **** <?xml version="1.0" encoding="UTF-8"?> <projectDescription> ! <name>jRevProxy</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription> --- 1,17 ---- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> ! <name>jrevproxy</name> <comment></comment> <projects> </projects> <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> + <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription> |
|
From: <fn...@us...> - 2003-12-27 09:15:01
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy
In directory sc8-pr-cvs1:/tmp/cvs-serv14960/src/cx/noe/jrevproxy
Modified Files:
VersionInfo.java
Log Message:
Added startup scripts to src subdirectory
Index: VersionInfo.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/VersionInfo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VersionInfo.java 26 Dec 2003 19:14:18 -0000 1.2
--- VersionInfo.java 27 Dec 2003 09:14:58 -0000 1.3
***************
*** 30,34 ****
private final String version = "v0.6";
! private final int buildNumber = 1034;
public String getVersion() {
--- 30,34 ----
private final String version = "v0.6";
! private final int buildNumber = 1006;
public String getVersion() {
|
|
From: <fn...@us...> - 2003-12-27 09:15:01
|
Update of /cvsroot/jrevproxy/jRevProxy/src In directory sc8-pr-cvs1:/tmp/cvs-serv14960/src Added Files: jrevproxy.sh jrevproxy.bat Log Message: Added startup scripts to src subdirectory |
|
From: <fn...@us...> - 2003-12-26 22:04:34
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy
In directory sc8-pr-cvs1:/tmp/cvs-serv28141/src/cx/noe/jrevproxy
Modified Files:
HTTPBase.java Rule.java HTTPRequest.java
Log Message:
fixed/updated javadoc info
Index: HTTPBase.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPBase.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** HTTPBase.java 15 Jun 2003 21:21:38 -0000 1.12
--- HTTPBase.java 26 Dec 2003 22:04:31 -0000 1.13
***************
*** 60,64 ****
/**
* Updates HTTP header values or adds the key/value pair if the header is missing at all
! * @param response the HTTP message
* @param key the HTTP header key
* @param value the HTTP header value
--- 60,64 ----
/**
* Updates HTTP header values or adds the key/value pair if the header is missing at all
! * @param msg the HTTP message
* @param key the HTTP header key
* @param value the HTTP header value
***************
*** 105,109 ****
/**
* Retrieves a value for a header key in the specified HTTP message
! * @param request the HTTP message
**/
public static String getValue(String msg, String key) {
--- 105,110 ----
/**
* Retrieves a value for a header key in the specified HTTP message
! * @param msg the HTTP message
! * @param key the key to be searched for
**/
public static String getValue(String msg, String key) {
Index: Rule.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/Rule.java,v
retrieving revision 2.8
retrieving revision 2.9
diff -C2 -d -r2.8 -r2.9
*** Rule.java 18 May 2003 11:10:48 -0000 2.8
--- Rule.java 26 Dec 2003 22:04:31 -0000 2.9
***************
*** 61,65 ****
/**
* Sets the external virtual directory
! * @param the external virtual directory
*/
public void setVirtualDir(String vdir) {
--- 61,65 ----
/**
* Sets the external virtual directory
! * @param vdir the external virtual directory
*/
public void setVirtualDir(String vdir) {
Index: HTTPRequest.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPRequest.java,v
retrieving revision 2.13
retrieving revision 2.14
diff -C2 -d -r2.13 -r2.14
*** HTTPRequest.java 26 Dec 2003 19:14:18 -0000 2.13
--- HTTPRequest.java 26 Dec 2003 22:04:31 -0000 2.14
***************
*** 168,173 ****
*
* @param request the HTTPRequest string
! * @param vdir the virtual directory to be placed in the request
! * @return the modified HTTPRequest string with the new virtual directory
**/
public static String setVirtualDir(String request, String newVdir) throws HTTPFormatException {
--- 168,173 ----
*
* @param request the HTTPRequest string
! * @param newVdir the virtual directory to be placed in the request
! * @return the modified HTTPRequest string with the new virtual directory
**/
public static String setVirtualDir(String request, String newVdir) throws HTTPFormatException {
|
|
From: <fn...@us...> - 2003-12-26 19:14:22
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy
In directory sc8-pr-cvs1:/tmp/cvs-serv1441/src/cx/noe/jrevproxy
Modified Files:
PoolManager.java HTTPResponse.java RequestHandler.java
VersionInfo.java SocketFactory.java ConnectionInfo.java
HTTPRequest.java RequestListener.java Ruleset.java
RevProxy.java
Log Message:
merge with storem branch; updated suffixstring in datalogger
Index: PoolManager.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/PoolManager.java,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -d -r2.12 -r2.13
*** PoolManager.java 24 May 2003 20:17:35 -0000 2.12
--- PoolManager.java 26 Dec 2003 19:14:18 -0000 2.13
***************
*** 29,36 ****
* PoolManager
*
! * The Poolmanager manages a set of threads that handle incoming and outgoing
! * HTTP requests.
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
--- 29,36 ----
* PoolManager
*
! * <p>The Poolmanager manages a set of threads that handle incoming and outgoing
! * HTTP requests.</p>
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
***************
*** 64,68 ****
public void init() {
- log(METHOD,"--init--");
createPool();
// start the poolmonitor
--- 64,67 ----
***************
*** 76,80 ****
**/
public synchronized void destroy() {
- log(METHOD,"--destroy--");
Handler h = null;
int stoppedHandlers = 0;
--- 75,78 ----
***************
*** 103,107 ****
public int getPoolsize() {
- log(METHOD,"--getPoolsize--");
return poolsize;
}
--- 101,104 ----
***************
*** 114,118 ****
*/
public synchronized void run(RevProRunnable thejob) throws Exception {
- log(METHOD,"--run--");
// find the next available handler
Handler h = null;
--- 111,114 ----
***************
*** 134,138 ****
*/
private void createPool() {
- log(METHOD,"--createPool--");
log(INFO,"Requested poolsize: "+ poolsize);
for(int i=0;i<poolsize;i++) {
--- 130,133 ----
***************
*** 150,154 ****
*/
private synchronized void addToPool(Handler handler) {
- log(METHOD,"--addToPool--");
poolstack.push(handler);
log(INFO,"handler " + handler.id + " pushed back");
--- 145,148 ----
***************
*** 156,160 ****
private void addTempToPool(int id) {
- log(METHOD,"--addTempToPool--");
Handler w = new Handler(id,true);
w.start();
--- 150,153 ----
***************
*** 167,177 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[PoolManager] " + str);
}
public ILog getLogger() {
- log(METHOD,"--getLogger--");
return logger;
}
--- 160,174 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
public ILog getLogger() {
return logger;
}
***************
*** 200,205 ****
public void run() {
- log(METHOD,"--run--");
- //
while(isRunning) {
synchronized (this) {
--- 197,200 ----
***************
*** 234,238 ****
private void handle(RevProRunnable job) {
- log(METHOD,"--handle--");
synchronized(this) {
thejob = job;
--- 229,232 ----
***************
*** 248,251 ****
--- 242,250 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logHandler != null)
***************
*** 282,291 ****
public void destroy() {
- log(METHOD,"--destroy--");
isRunning = false;
}
public void run(){
- log(METHOD,"--run--");
while(isAlive()) {
// calculate poolstack load
--- 281,288 ----
***************
*** 313,319 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[PoolMonitor] " + str);
}
}
--- 310,321 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
}
Index: HTTPResponse.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPResponse.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** HTTPResponse.java 15 Jun 2003 21:21:38 -0000 1.20
--- HTTPResponse.java 26 Dec 2003 19:14:18 -0000 1.21
***************
*** 30,52 ****
* HTTPResponse
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
public class HTTPResponse extends HTTPBase{
- /* Status-Code = "200" ; OK
- * "201" ; Created
- * "202" ; Accepted
- * "204" ; No Content
- * "301" ; Moved Permanently
- * "302" ; Moved Temporarily
- * "304" ; Not Modified
- * "400" ; Bad Request
- * "401" ; Unauthorized
- * "403" ; Forbidden
- * "404" ; Not Found
- * "500" ; Internal Server Error
- * "501" ; Not Implemented
- * "502" ; Bad Gateway
- * "503" ; Service Unavailable */
public static final int HTTP_OK = 200;
--- 30,37 ----
* HTTPResponse
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public class HTTPResponse extends HTTPBase{
public static final int HTTP_OK = 200;
Index: RequestHandler.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RequestHandler.java,v
retrieving revision 2.29
retrieving revision 2.30
diff -C2 -d -r2.29 -r2.30
*** RequestHandler.java 15 Jun 2003 21:21:38 -0000 2.29
--- RequestHandler.java 26 Dec 2003 19:14:18 -0000 2.30
***************
*** 40,49 ****
* RequestHandler
*
! * The RequestHandler handles the external request.
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
! public class RequestHandler implements RevProRunnable,ILog {
private PoolManager manager = null;
--- 40,49 ----
* RequestHandler
*
! * <p>The RequestHandler handles the external request.</p>
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
! public class RequestHandler extends Thread implements RevProRunnable,ILog {
private PoolManager manager = null;
***************
*** 58,65 ****
private ConnectionInfo connectioninfo = null;
//
! private OutputStream outEx = null;
! private InputStream inEx = null;
! private InputStream inIn = null;
! private OutputStream outIn = null;
//
private int retcode = -1;
--- 58,65 ----
private ConnectionInfo connectioninfo = null;
//
! private OutputStream extOut = null;
! private InputStream extIn = null;
! private InputStream intIn = null;
! private OutputStream intOut = null;
//
private int retcode = -1;
***************
*** 104,113 ****
logger = info.getLogger();
- log(METHOD,"--run--");
-
try {
! if(!createExtStreams()) {
log(INFO,"failed to create external input/output streams");
! sendBadRequestResponse(outEx,"No data received");
// let's reset the logger back to the original
logger = oldLogger;
--- 104,111 ----
logger = info.getLogger();
try {
! if(!createExternalStreams()) {
log(INFO,"failed to create external input/output streams");
! sendBadRequestResponse(extOut,"No data received");
// let's reset the logger back to the original
logger = oldLogger;
***************
*** 116,132 ****
//
int size = 0;
! String inStr = null;
! outStream = readRequest(inEx);
// convert to String so that we can start parsing the request
// check that we have a non-empty request that is well formed (GET || POST)
! if((size = outStream.size()) == 0 || !HTTPRequest.isHTTPRequest(inStr = outStream.toString())) {
if(size == 0) {
log(INFO,"no external request data available");
! sendBadRequestResponse(outEx,"No data received");
}
else {
! log(DEBUG,"external request: " + inStr);
log(INFO,"no valid external HTTP request received");
! sendBadRequestResponse(outEx,"No valid HTTP request received");
}
// let's reset the logger back to the original
--- 114,129 ----
//
int size = 0;
! String inStr = readRequest();
// convert to String so that we can start parsing the request
// check that we have a non-empty request that is well formed (GET || POST)
! if((size = inStr.length()) == 0 || !HTTPRequest.isHTTPRequest(inStr)) {
if(size == 0) {
log(INFO,"no external request data available");
! sendBadRequestResponse(extOut,"No data received");
}
else {
! log(DUMP,"external request: " + inStr);
log(INFO,"no valid external HTTP request received");
! sendBadRequestResponse(extOut,"No valid HTTP request received");
}
// let's reset the logger back to the original
***************
*** 135,139 ****
}
// log the external request in case we are in debug mode
! log(DEBUG,"external request: " + inStr);
// find out what virtual directory the request refers to
--- 132,136 ----
}
// log the external request in case we are in debug mode
! log(DUMP,"external request: " + inStr);
// find out what virtual directory the request refers to
***************
*** 145,149 ****
if(rule == null) {
log(INFO,"Did not find an applicable rule for virtualdir " + virtualDir);
! sendBadRequestResponse(outEx,"The requested resource could not be located");
// let's reset the logger back to the original
logger = oldLogger;
--- 142,146 ----
if(rule == null) {
log(INFO,"Did not find an applicable rule for virtualdir " + virtualDir);
! sendBadRequestResponse(extOut,"The requested resource could not be located");
// let's reset the logger back to the original
logger = oldLogger;
***************
*** 160,164 ****
if(subjectDN != null)
if(!rule.isAuthorized(subjectDN)) {
! sendNotAuthorizedResponse(outEx);
log(INFO,"User is NOT authorized to read the requested resource");
// let's reset the logger back to the original
--- 157,161 ----
if(subjectDN != null)
if(!rule.isAuthorized(subjectDN)) {
! sendNotAuthorizedResponse(extOut);
log(INFO,"User is NOT authorized to read the requested resource");
// let's reset the logger back to the original
***************
*** 175,183 ****
inStr = HTTPRequest.trim(inStr);
inStr = HTTPRequest.setVirtualDir(inStr,newVdir);
! log(DEBUG,"jRevProxy modified request: " + inStr);
! if(!createInStreams(rule.getJunction())) {
log(INFO,"failed to create internal input/output streams");
! sendBadRequestResponse(outEx,"No data received");
//
// let's reset the logger back to the original
--- 172,180 ----
inStr = HTTPRequest.trim(inStr);
inStr = HTTPRequest.setVirtualDir(inStr,newVdir);
! log(DUMP,"jRevProxy modified request: " + inStr);
! if(!createInternalStreams(rule.getJunction())) {
log(INFO,"failed to create internal input/output streams");
! sendBadRequestResponse(extOut,"No data received");
//
// let's reset the logger back to the original
***************
*** 189,193 ****
if(!sendAndReceive(inStr)) {
log(INFO,"failed to send/receive an HTTP response");
! sendBadRequestResponse(outEx,"No data received");
//
// let's reset the logger back to the original
--- 186,190 ----
if(!sendAndReceive(inStr)) {
log(INFO,"failed to send/receive an HTTP response");
! sendBadRequestResponse(extOut,"No data received");
//
// let's reset the logger back to the original
***************
*** 208,212 ****
log(DEBUG,"Transfer-Encoding is chunked; let's decode it");
outStr = HTTPResponse.decodeTransferEncoding(outStr);
! log(DEBUG,"decoded internal response: " + outStr);
}
}
--- 205,209 ----
log(DEBUG,"Transfer-Encoding is chunked; let's decode it");
outStr = HTTPResponse.decodeTransferEncoding(outStr);
! log(DUMP,"decoded internal response: " + outStr);
}
}
***************
*** 214,220 ****
if(HTTPResponse.getContentTypeGroup(contenttype) == HTTPResponse.IMAGE) {
log(DEBUG,"Content is IMAGE");
! outEx.write(outStream.toByteArray());
! outEx.flush();
! outEx.close();
logger = oldLogger;
return;
--- 211,218 ----
if(HTTPResponse.getContentTypeGroup(contenttype) == HTTPResponse.IMAGE) {
log(DEBUG,"Content is IMAGE");
! // ByteArrayOutputStream.toByteArray() copies date, memory x2
! extOut.write(outStream.toByteArray());
! //outEx.flush(); - tdob, doesn't do nothing for OutputStream
! extOut.close();
logger = oldLogger;
return;
***************
*** 225,229 ****
if(retcode == HTTPResponse.HTTP_OK || retcode == -1){
outStr = filter(outStr, contenttype, virtualDir);
! log(DEBUG,"filtered internal response: " + outStr);
//
if(retcode == -1) {
--- 223,227 ----
if(retcode == HTTPResponse.HTTP_OK || retcode == -1){
outStr = filter(outStr, contenttype, virtualDir);
! log(DUMP,"filtered internal response: " + outStr);
//
if(retcode == -1) {
***************
*** 232,241 ****
// was not empty. So we will reconstruct a new correct response.
outStr = reconstructResponse(outStr);
! log(DEBUG,"reconstructed response: " + outStr);
}
}
else
log(INFO,"we have returncode " + retcode+ " so just send the response back as is");
! outEx.write(outStr.getBytes());
//
log(DEBUG,"internal response data sent to external socket");
--- 230,239 ----
// was not empty. So we will reconstruct a new correct response.
outStr = reconstructResponse(outStr);
! log(DUMP,"reconstructed response: " + outStr);
}
}
else
log(INFO,"we have returncode " + retcode+ " so just send the response back as is");
! extOut.write(outStr.getBytes());
//
log(DEBUG,"internal response data sent to external socket");
***************
*** 243,247 ****
else {
log(INFO,"no internal response data available");
! sendBadRequestResponse(outEx,"No data received");
//
// let's reset the logger back to the original
--- 241,245 ----
else {
log(INFO,"no internal response data available");
! sendBadRequestResponse(extOut,"No data received");
//
// let's reset the logger back to the original
***************
*** 250,259 ****
}
//
! outEx.flush();
! outEx.close();
}
catch(HTTPFormatException e) {
log(e);
! sendBadRequestResponse(outEx,"HTTP request received not valid");
// let's reset the logger back to the original
logger = oldLogger;
--- 248,257 ----
}
//
! extOut.flush();
! extOut.close();
}
catch(HTTPFormatException e) {
log(e);
! sendBadRequestResponse(extOut,"HTTP request received not valid");
// let's reset the logger back to the original
logger = oldLogger;
***************
*** 262,266 ****
catch(IOException e) {
log(e);
! sendBadRequestResponse(outEx,"IOException");
// let's reset the logger back to the original
logger = oldLogger;
--- 260,264 ----
catch(IOException e) {
log(e);
! sendBadRequestResponse(extOut,"IOException");
// let's reset the logger back to the original
logger = oldLogger;
***************
*** 269,273 ****
catch(Exception e) {
log(e);
! sendBadRequestResponse(outEx,"No data received");
// let's reset the logger back to the original
logger = oldLogger;
--- 267,271 ----
catch(Exception e) {
log(e);
! sendBadRequestResponse(extOut,"No data received");
// let's reset the logger back to the original
logger = oldLogger;
***************
*** 286,290 ****
*/
public synchronized void handle(Socket socket) throws Exception {
- log(METHOD,"--handle--");
this.socket = socket;
manager.run(this);
--- 284,287 ----
***************
*** 296,302 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[RequestHandler] " + str);
}
--- 293,304 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
***************
*** 306,313 ****
}
public void log(ILog logger, int level, String str) {
if(logger != null)
! logger.log(level,"[RequestHandler] " + str);
}
/**
* Provides a reference to the set of rules
--- 308,322 ----
}
+ /**
+ * Logs a string using a specific DataLogger instance
+ * @param logger the DataLogger instance
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(ILog logger, int level, String str) {
if(logger != null)
! logger.log(level, str);
}
+
/**
* Provides a reference to the set of rules
***************
*** 323,328 ****
*/
private void sendNotAuthorizedResponse(OutputStream out) {
- log(METHOD,"--sendNotAuthorizedResponse--");
- //
try {
out.write("HTTP/1.0 200 OK\r\n".getBytes());
--- 332,335 ----
***************
*** 344,358 ****
private void sendBadRequestResponse(OutputStream out, String description) {
- log(METHOD,"--sendBadRequestResponse--");
sendErrorResponse(out,400, description);
}
private void sendNotFoundResponse(OutputStream out, String description) {
- log(METHOD,"--sendNotFoundResponse--");
sendErrorResponse(out,404, description);
}
private void sendErrorResponse(OutputStream out, int errorcode, String description) {
- log(METHOD,"--sendErrorResponse--");
try {
out.write(("HTTP/1.0 " + errorcode +" "+ description + "\r\n").getBytes());
--- 351,362 ----
***************
*** 365,371 ****
}
! private ByteArrayOutputStream readRequest(InputStream inEx) {
! return read(inEx,false);
! }
private ByteArrayOutputStream readResponse(InputStream inEx) {
--- 369,426 ----
}
! /**
! * Reads the request from the external input stream
! *
! * @return a string containing the request
! */
! private String readRequest() {
! final int BUF_SIZE = 2048;
! final byte[] EOL = {(byte)'\n', (byte)'\r'};
!
! /* buffer to use for requests */
! byte[] buf = new byte[BUF_SIZE];
!
! try {
! int nread = 0;
! int i = 0;
! boolean HTTP11 = false;
!
! outerloop:
! /* NOTE: If the request is too big, we return the first BUF_SIZE bytes */
! while (nread < BUF_SIZE) {
! int r = extIn.read(buf, nread, BUF_SIZE - nread);
! if (r == -1) {
! /* EOF */
! return new String("");
! }
! i = nread;
! nread += r;
! if (nread > 1) {
! for (; i < nread; i++) {
! if (buf[i] == EOL[0] && buf[i-1] == EOL[1]) {
! if (!HTTP11) {
! /* we have read first line */
! if (!(HTTP11 = HTTPRequest.isHttp11(buf))) {
! break outerloop;
! }
! } else {
! if (buf[i-2] == EOL[0] && buf[i-3] == EOL[1]) {
! break outerloop;
! }
! }
! }
! }
! }
! }
!
! /* keep the interesting part of the buffer */
! return new String(buf, 0, i+1);
! } catch(Exception e) {
! log(e);
! log(DUMP, new String(buf));
! }
!
! return new String();
! }
private ByteArrayOutputStream readResponse(InputStream inEx) {
***************
*** 380,389 ****
* * The total request indicated by the "Content-Length" header has been read (only in case of HTTP Responses)
*
! * @param inEx InputStream
* @param isResponse true if the info to be read is a HTTPResponse, false in the other case
* @return the bytearray holding the information read
**/
private ByteArrayOutputStream read(InputStream inEx, boolean isResponse) {
- log(METHOD,"--read--");
// create a temporary read buffer and a stream where we will put all our read information
byte[] buffer = new byte[512];
--- 435,443 ----
* * The total request indicated by the "Content-Length" header has been read (only in case of HTTP Responses)
*
! * @param extIn InputStream
* @param isResponse true if the info to be read is a HTTPResponse, false in the other case
* @return the bytearray holding the information read
**/
private ByteArrayOutputStream read(InputStream inEx, boolean isResponse) {
// create a temporary read buffer and a stream where we will put all our read information
byte[] buffer = new byte[512];
***************
*** 400,404 ****
catch (SocketTimeoutException st) {
// will jump here in case we have a read timeout
! log(DEBUG,"inEx.read-> SocketTimeoutException");
// log(st);
// we assume that this is the end of the request and jump out of the loop
--- 454,458 ----
catch (SocketTimeoutException st) {
// will jump here in case we have a read timeout
! log(DEBUG,"extIn.read-> SocketTimeoutException");
// log(st);
// we assume that this is the end of the request and jump out of the loop
***************
*** 412,416 ****
catch (IOException e) {
// will jump here in case we have end of stream
! log(DEBUG,"inEx.read-> IOException");
log(e);
// we assume that this is the end of the request and jump out of the loop
--- 466,470 ----
catch (IOException e) {
// will jump here in case we have end of stream
! log(DEBUG,"extIn.read-> IOException");
log(e);
// we assume that this is the end of the request and jump out of the loop
***************
*** 419,423 ****
// we do not have any data anymore so we stop reading
if (nBytes <= 0) {
! log(DEBUG,"inEx -> nBytes <= 0");
}
else {
--- 473,477 ----
// we do not have any data anymore so we stop reading
if (nBytes <= 0) {
! log(DEBUG,"extIn -> nBytes <= 0");
}
else {
***************
*** 461,465 ****
*/
protected boolean sendAndReceive(String inStr) {
- log(METHOD,"--sendAndReceive--");
int nrretries = 1;
//
--- 515,518 ----
***************
*** 471,483 ****
do {
log(INFO, nrretries + " try to send and receive");
! outIn.write(inStr.getBytes());
log(DEBUG,"internal request send");
! outStream = readResponse(inIn);
log(DEBUG,"internal response received");
//
if(outStream.size() != 0) {
String outStr = outStream.toString();
! log(DEBUG,"internal response: " + outStr);
// check first what HTTP returncode we have received
//
--- 524,536 ----
do {
log(INFO, nrretries + " try to send and receive");
! intOut.write(inStr.getBytes());
log(DEBUG,"internal request send");
! outStream = readResponse(intIn);
log(DEBUG,"internal response received");
//
if(outStream.size() != 0) {
String outStr = outStream.toString();
! log(DUMP,"internal response: " + outStr);
// check first what HTTP returncode we have received
//
***************
*** 507,518 ****
catch(HTTPFormatException e) {
log(e);
! sendBadRequestResponse(outEx,"HTTP request received not valid");
break TriesLoop;
}
catch(Exception e) {
log(e);
! sendBadRequestResponse(outEx,"No data received");
break TriesLoop;
! } //
log(DEBUG,"Redirected request: "+ inStr);
--- 560,572 ----
catch(HTTPFormatException e) {
log(e);
! sendBadRequestResponse(extOut,"HTTP request received not valid");
break TriesLoop;
}
catch(Exception e) {
log(e);
! sendBadRequestResponse(extOut,"No data received");
break TriesLoop;
! }
! //
log(DEBUG,"Redirected request: "+ inStr);
***************
*** 520,524 ****
if(HTTPResponse.getValue(outStr, "Connection").equalsIgnoreCase("Close")) {
! if(!createInStreams(new URL(location))) {
log(INFO,"failed to create internal input/output streams");
// Send MOVED to the client, should redirect himself
--- 574,578 ----
if(HTTPResponse.getValue(outStr, "Connection").equalsIgnoreCase("Close")) {
! if(!createInternalStreams(new URL(location))) {
log(INFO,"failed to create internal input/output streams");
// Send MOVED to the client, should redirect himself
***************
*** 572,583 ****
* @return false in case the streams cannot be created successfully; true in case of success
*/
! protected boolean createInStreams(URL url) {
! log(METHOD, "--createInStreams(URL)--");
!
String protocol = url.getProtocol();
String host = url.getHost();
int port = url.getPort();
! return createInStreams(protocol, host, port);
}
--- 626,635 ----
* @return false in case the streams cannot be created successfully; true in case of success
*/
! protected boolean createInternalStreams(URL url) {
String protocol = url.getProtocol();
String host = url.getHost();
int port = url.getPort();
! return createInternalStreams(protocol, host, port);
}
***************
*** 591,596 ****
* @return false in case the streams cannot be created successfully; true in case of success
*/
! protected boolean createInStreams(String protocol, String host, int port) {
! log(METHOD,"--createInStreams(protocol,host,port)--");
Socket intSocket = null;
--- 643,647 ----
* @return false in case the streams cannot be created successfully; true in case of success
*/
! protected boolean createInternalStreams(String protocol, String host, int port) {
Socket intSocket = null;
***************
*** 616,621 ****
log(DEBUG,"internal socket timeout set: " + soTimeout);
//
! inIn = intSocket.getInputStream();
! outIn = intSocket.getOutputStream();
log(DEBUG,"internal input- and outputstreams created");
}
--- 667,672 ----
log(DEBUG,"internal socket timeout set: " + soTimeout);
//
! intIn = intSocket.getInputStream();
! intOut = intSocket.getOutputStream();
log(DEBUG,"internal input- and outputstreams created");
}
***************
*** 640,653 ****
* @return false in case the streams cannot be created successfully; true in case of success
*/
! protected boolean createExtStreams() {
! log(METHOD,"--createExtStreams--");
try {
// set a timeout to avoid infinite reads while no new bytes are arriving
socket.setSoTimeout(soTimeout);
log(DEBUG,"external socket timeout set: " + soTimeout);
!
// create the in/out streams for the external socket connection
! outEx = socket.getOutputStream();
! inEx = socket.getInputStream();
log(DEBUG,"external input- and outputstreams created");
}
--- 691,705 ----
* @return false in case the streams cannot be created successfully; true in case of success
*/
! protected boolean createExternalStreams() {
try {
// set a timeout to avoid infinite reads while no new bytes are arriving
socket.setSoTimeout(soTimeout);
log(DEBUG,"external socket timeout set: " + soTimeout);
!
! socket.setTcpNoDelay(true);
!
// create the in/out streams for the external socket connection
! extOut = socket.getOutputStream();
! extIn = new BufferedInputStream(socket.getInputStream());
log(DEBUG,"external input- and outputstreams created");
}
***************
*** 668,677 ****
protected String filter(String outStr, int contenttype, String vdir) {
- log(METHOD,"--filter--");
- //
Hashtable headers = HTTPResponse.getHeaders(outStr);
! log(DEBUG, "Original headers: " + headers.toString());
String originalBody = HTTPResponse.getMessageBody(outStr);
! log(DEBUG, "Original body: " + originalBody);
//
Hashtable props = new Hashtable();
--- 720,727 ----
protected String filter(String outStr, int contenttype, String vdir) {
Hashtable headers = HTTPResponse.getHeaders(outStr);
! log(DUMP, "Original headers: " + headers.toString());
String originalBody = HTTPResponse.getMessageBody(outStr);
! log(DUMP, "Original body: " + originalBody);
//
Hashtable props = new Hashtable();
***************
*** 705,711 ****
String body = htmlfilter.filter(originalBody, headers, props);
! log(DEBUG,"Retrieved the filtered headers: " + headers.toString());
if(body != null) {
! log(DEBUG,"Retrieved the filtered body: " + body);
log(DEBUG,"Body length: " + body.length());
}
--- 755,761 ----
String body = htmlfilter.filter(originalBody, headers, props);
! log(DUMP,"Retrieved the filtered headers: " + headers.toString());
if(body != null) {
! log(DUMP,"Retrieved the filtered body: " + body);
log(DEBUG,"Body length: " + body.length());
}
***************
*** 724,728 ****
*/
protected String getPath(Rule rule) {
- log(METHOD,"--getPath--");
String newVdir = rule.getJunction().getPath();
if (newVdir == null || newVdir == "")
--- 774,777 ----
***************
*** 732,736 ****
protected IHTTPFilter createFilterInstance(Class classInstance) {
- log(METHOD,"--createFilterInstance--");
IHTTPFilter filter = null;
--- 781,784 ----
***************
*** 747,751 ****
protected Object createObject(Constructor constructor, Object[] arguments) {
- log(METHOD,"--createObject--");
log(DEBUG,"Constructor: " + constructor.toString());
Object object = null;
--- 795,798 ----
***************
*** 761,766 ****
protected String reconstructResponse(String outStr) {
- log(METHOD,"--reconstructResponse--");
- //
Hashtable headers = HTTPResponse.getHeaders(outStr);
log(DEBUG, "Original headers: " + headers.toString());
--- 808,811 ----
***************
*** 770,790 ****
}
}
- /**
- * HTTP return codes
- * Status-Code = "200" ; OK
- * | "201" ; Created
- * | "202" ; Accepted
- * | "204" ; No Content
- * | "301" ; Moved Permanently
- * | "302" ; Moved Temporarily
- * | "304" ; Not Modified
- * | "400" ; Bad Request
- * | "401" ; Unauthorized
- * | "403" ; Forbidden
- * | "404" ; Not Found
- * | "500" ; Internal Server Error
- * | "501" ; Not Implemented
- * | "502" ; Bad Gateway
- * | "503" ; Service Unavailable
- *
- */
--- 815,816 ----
Index: VersionInfo.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/VersionInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** VersionInfo.java 29 May 2003 19:04:09 -0000 1.1
--- VersionInfo.java 26 Dec 2003 19:14:18 -0000 1.2
***************
*** 22,47 ****
/**
- *
* VersionInfo
*
! * @author <a href=mailto:fre...@no...> Frederik Noe</a>
* @version <tt>$Revision$</tt>
- *
*/
public final class VersionInfo {
! private final String version = "v0.1";
! private final int buildNumber = 1000;
! public String getVersion() {
! return version;
! }
! public int getBuildNumber() {
! return buildNumber;
! }
! public String toString() {
! return version +" build " + buildNumber;
! }
}
--- 22,45 ----
/**
* VersionInfo
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public final class VersionInfo {
! private final String version = "v0.6";
! private final int buildNumber = 1034;
! public String getVersion() {
! return version;
! }
! public int getBuildNumber() {
! return buildNumber;
! }
! public String toString() {
! return version +" build " + buildNumber;
! }
}
Index: SocketFactory.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/SocketFactory.java,v
retrieving revision 2.3
retrieving revision 2.4
diff -C2 -d -r2.3 -r2.4
*** SocketFactory.java 27 Mar 2003 15:49:37 -0000 2.3
--- SocketFactory.java 26 Dec 2003 19:14:18 -0000 2.4
***************
*** 55,59 ****
public ServerSocket getServerSocket(int port) throws IOException {
- log(METHOD,"--getServerSocket--");
InetAddress bindAddress = null;
ServerSocket serversocket = null;
--- 55,58 ----
***************
*** 67,71 ****
public SSLServerSocket getSSLServerSocket(int port, boolean requireClientAuthentication) throws Exception{
- log(METHOD,"--getSSLServerSocket--");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
--- 66,69 ----
***************
*** 113,127 ****
public Socket getClientSocket(String host, int port) throws Exception{
- log(METHOD,"--getClientSocket--");
return new Socket(host,port);
}
public Socket getSSLClientSocket(String host, int port) throws Exception{
- log(METHOD,"--getSSLClientSocket--");
return null;
}
private InetAddress getBindAddress() {
- log(METHOD,"--getBindAddress--");
String address = null;
if(null != (address = properties.getProperty("INTERFACE"))) {
--- 111,122 ----
***************
*** 144,151 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[SocketFactory] " + str);
}
-
}
--- 139,151 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
}
Index: ConnectionInfo.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/ConnectionInfo.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ConnectionInfo.java 15 Jun 2003 21:21:38 -0000 1.10
--- ConnectionInfo.java 26 Dec 2003 19:14:18 -0000 1.11
***************
*** 26,29 ****
--- 26,30 ----
/**
* ConnectionInfo
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 42,46 ****
* Creates a new instance of ConnectionInfo
*/
! public ConnectionInfo(ILog logger, InetSocketAddress socketaddress) {
this.logger = logger;
this.socketaddress = socketaddress;
--- 43,47 ----
* Creates a new instance of ConnectionInfo
*/
! public ConnectionInfo(ILog logger, InetSocketAddress socketaddress) {
this.logger = logger;
this.socketaddress = socketaddress;
***************
*** 52,56 ****
*/
public InetSocketAddress getSocketAddress() {
- log(METHOD,"--getSocketAddress--");
return socketaddress;
}
--- 53,56 ----
***************
*** 61,65 ****
*/
public void setCertificate(X509Certificate certificate) {
- log(METHOD,"--setCertificate--");
log(DEBUG,"Certificate SubjectDN: " + certificate.getSubjectDN().getName());
this.certificate = certificate;
--- 61,64 ----
***************
*** 95,105 ****
*/
public X509Certificate getCertificate() {
- log(METHOD,"--getCertificate--");
return certificate;
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[ConnectionInfo] " + str);
}
--- 94,108 ----
*/
public X509Certificate getCertificate() {
return certificate;
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
Index: HTTPRequest.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPRequest.java,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -d -r2.12 -r2.13
*** HTTPRequest.java 15 Jun 2003 21:21:38 -0000 2.12
--- HTTPRequest.java 26 Dec 2003 19:14:18 -0000 2.13
***************
*** 24,31 ****
* HTTPRequest
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
public class HTTPRequest extends HTTPBase{
/**
--- 24,38 ----
* HTTPRequest
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public class HTTPRequest extends HTTPBase{
+
+ private static final String HTTP10 = "HTTP/1.0";
+ private static final String HTTP11 = "HTTP/1.1";
+
+ public static boolean isHttp11(byte[] b) {
+ return ((new String(b)).toUpperCase().indexOf(new String(HTTP11).toUpperCase()) != -1);
+ }
/**
Index: RequestListener.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RequestListener.java,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -d -r2.15 -r2.16
*** RequestListener.java 15 Jun 2003 21:21:38 -0000 2.15
--- RequestListener.java 26 Dec 2003 19:14:18 -0000 2.16
***************
*** 46,50 ****
* RequestListener
*
! * Starts listening for HTTP/HTTPS requests
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
--- 46,51 ----
* RequestListener
*
! * <p>Starts listening for HTTP/HTTPS requests</p>
! *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 80,85 ****
public void init() throws Exception {
- log(METHOD,"--init--");
- //
parseXMLConfig();
refresher.start();
--- 81,84 ----
***************
*** 87,91 ****
public void destroy() {
- log(METHOD,"--destroy--");
isRunning = false;
--- 86,89 ----
***************
*** 97,102 ****
public void run(){
- log(METHOD,"--run--");
-
try{
//
--- 95,98 ----
***************
*** 206,228 ****
}
public int getPort(){
! log(METHOD,"--getPort--");
return port;
}
/**
! * Sets also the port number on which the socket has to listen
* @param port the port number
*/
! public void setPort(int port) {
! log(METHOD,"--setPort--");
! this.port = port;
}
public void setClientAuthentication(boolean clientauth) {
- log(METHOD,"--setClientAuthentication--");
this.clientauth = clientauth;
}
public int getProtocol() {
return protocol;
}
--- 202,236 ----
}
+ /**
+ * Gets the port number on which the socket has to listen
+ */
public int getPort(){
! log(DEBUG, "Port number = "+port);
return port;
}
/**
! * Sets the port number on which the socket has to listen
! *
* @param port the port number
*/
! public void setPort(int port) throws IllegalArgumentException {
! if(port <=0 || port > 65535) {
! log(DEBUG, "Port number not in range 1-65535");
! throw new IllegalArgumentException();
! } else {
! this.port = port;
! log(DEBUG, "Port number set to "+this.port);
! }
}
public void setClientAuthentication(boolean clientauth) {
this.clientauth = clientauth;
}
+ /**
+ * Gets the communication protocol which has to be used
+ */
public int getProtocol() {
+ log(DEBUG, "Protocol = "+protocol);
return protocol;
}
***************
*** 236,240 ****
*/
public void setProtocol(int protocol) throws IllegalArgumentException{
- log(METHOD,"--setProtocol--");
switch(protocol){
case HTTP:
--- 244,247 ----
***************
*** 256,262 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[RequestListener] " + str);
}
--- 263,275 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
***************
*** 282,286 ****
public String getSubjectName() {
- log(METHOD," --getSubjectName-- ");
if(certificate != null)
return certificate.getSubjectDN().getName();
--- 295,298 ----
***************
*** 290,294 ****
public void handshakeCompleted(javax.net.ssl.HandshakeCompletedEvent event) {
- log(METHOD," --handshakeCompleted-- ");
try {
X509Certificate certificate = event.getPeerCertificateChain()[0];
--- 302,305 ----
***************
*** 317,323 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[CustomHandshakeCompletedListener] " + str);
}
--- 328,340 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
***************
*** 328,336 ****
}
/**
! * parse XML configuration file and create a set of rules out of it
*/
private void parseXMLConfig() throws Exception {
- log(METHOD,"--parseXMLConfig--");
-
if(xmlfilename == null) {
xmlfilename = properties.getProperty("XMLCONFIGFILE");
--- 345,351 ----
}
/**
! * Parse XML configuration file and create a set of rules out of it
*/
private void parseXMLConfig() throws Exception {
if(xmlfilename == null) {
xmlfilename = properties.getProperty("XMLCONFIGFILE");
***************
*** 349,353 ****
ruleset = parser.getRuleset();
log(INFO,"Ruleset read and parsed successfully ");
! log(DEBUG, ruleset.toString());
}
--- 364,368 ----
ruleset = parser.getRuleset();
log(INFO,"Ruleset read and parsed successfully ");
! log(DUMP, ruleset.toString());
}
***************
*** 378,382 ****
public void run() {
- log(METHOD,"--run--");
while(isRunning) {
try {
--- 393,396 ----
***************
*** 392,398 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[RulesetRefresher] " + str);
}
--- 406,418 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
Index: Ruleset.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/Ruleset.java,v
retrieving revision 2.6
retrieving revision 2.7
diff -C2 -d -r2.6 -r2.7
*** Ruleset.java 7 May 2003 12:11:14 -0000 2.6
--- Ruleset.java 26 Dec 2003 19:14:18 -0000 2.7
***************
*** 23,28 ****
/**
* Ruleset
! *
! * Holds a set of reverse proxy rules
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
--- 23,29 ----
/**
* Ruleset
! *
! * <p>Holds a set of reverse proxy rules</p>
! *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
Index: RevProxy.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RevProxy.java,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** RevProxy.java 15 Jun 2003 21:21:38 -0000 2.23
--- RevProxy.java 26 Dec 2003 19:14:18 -0000 2.24
***************
*** 33,36 ****
--- 33,37 ----
* Main entrance class, receiving command line parameters for the properties configuration file
* and XML configuration file
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 143,148 ****
if(null != (portstr = config.getProperty("PORT"))) {
port = Integer.parseInt(portstr);
! if(port <=0) {
! System.out.println("invalid port specified");
return;
}
--- 144,149 ----
if(null != (portstr = config.getProperty("PORT"))) {
port = Integer.parseInt(portstr);
! if(port <=0 || port > 65535) {
! System.out.println("Invalid port specified");
return;
}
***************
*** 181,187 ****
String loglevel = null;
if(null != (loglevel = config.getProperty("LOGLEVEL"))) {
! if(loglevel.compareToIgnoreCase("DEBUG") == 0) {
! datalogger.setLogLevel(DataLogger.DEBUG);
! }
else if (loglevel.compareToIgnoreCase("INFO") == 0)
datalogger.setLogLevel(DataLogger.INFO);
--- 182,191 ----
String loglevel = null;
if(null != (loglevel = config.getProperty("LOGLEVEL"))) {
! if (loglevel.compareToIgnoreCase("DUMP") == 0) {
! datalogger.setLogLevel(DataLogger.DUMP);
! System.setProperty("javax.net.debug", "all");
! }
! else if (loglevel.compareToIgnoreCase("DEBUG") == 0)
! datalogger.setLogLevel(DataLogger.DEBUG);
else if (loglevel.compareToIgnoreCase("INFO") == 0)
datalogger.setLogLevel(DataLogger.INFO);
***************
*** 222,226 ****
if(null != (poolsizeStr = config.getProperty("POOLSIZE"))) {
poolsize= Integer.parseInt(poolsizeStr);
! if(poolsize <=0) {
System.out.println("invalid poolsize specified");
return;
--- 226,230 ----
if(null != (poolsizeStr = config.getProperty("POOLSIZE"))) {
poolsize= Integer.parseInt(poolsizeStr);
! if(poolsize <= 0) {
System.out.println("invalid poolsize specified");
return;
|
|
From: <fn...@us...> - 2003-12-26 19:14:22
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/filter
In directory sc8-pr-cvs1:/tmp/cvs-serv1441/src/cx/noe/jrevproxy/filter
Modified Files:
MDaemonFilter.java JavascriptFilter.java BaseFilter.java
HTMLFilter.java
Log Message:
merge with storem branch; updated suffixstring in datalogger
Index: MDaemonFilter.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/filter/MDaemonFilter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MDaemonFilter.java 15 Jun 2003 21:21:39 -0000 1.8
--- MDaemonFilter.java 26 Dec 2003 19:14:18 -0000 1.9
***************
*** 29,32 ****
--- 29,33 ----
/**
* MDaemonFilter
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 59,67 ****
* Filters the HTTP response body sent by the Worldclient
* component of the MDaemon mail server
* @param responseBody the HTTP response provided by Worldclient
* @return the filtered HTTP response
*/
public String filterBody(String responseBody) {
- log(METHOD,"--filterBody--");
if(responseBody == null || responseBody.length() == 0)
return responseBody;
--- 60,68 ----
* Filters the HTTP response body sent by the Worldclient
* component of the MDaemon mail server
+ *
* @param responseBody the HTTP response provided by Worldclient
* @return the filtered HTTP response
*/
public String filterBody(String responseBody) {
if(responseBody == null || responseBody.length() == 0)
return responseBody;
***************
*** 100,107 ****
* Filters the HTTP headers sent by the Worldclient
* component of the MDaemon mail server
* @param headers the table of HTTP response headers provided by Worldclient
*/
public void filterHeaders(Hashtable headers) {
- log(METHOD,"--filterHeaders--");
//nothing to do here
}
--- 101,108 ----
* Filters the HTTP headers sent by the Worldclient
* component of the MDaemon mail server
+ *
* @param headers the table of HTTP response headers provided by Worldclient
*/
public void filterHeaders(Hashtable headers) {
//nothing to do here
}
Index: JavascriptFilter.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/filter/JavascriptFilter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JavascriptFilter.java 17 May 2003 22:40:03 -0000 1.4
--- JavascriptFilter.java 26 Dec 2003 19:14:18 -0000 1.5
***************
*** 26,29 ****
--- 26,30 ----
/**
* JavascriptFilter
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 38,42 ****
}
! /** Creates a new instance of JavascriptFilter */
public JavascriptFilter(ILog logger) {
super(logger);
--- 39,45 ----
}
! /**
! * Creates a new instance of JavascriptFilter
! */
public JavascriptFilter(ILog logger) {
super(logger);
***************
*** 55,59 ****
public String filterBody(String msgBody) {
// we just do not filter anything at all
- log(METHOD,"-- filterBody --");
return msgBody;
}
--- 58,61 ----
***************
*** 61,65 ****
public void filterHeaders(Hashtable headers) {
// we do not add anything additional
- log(METHOD,"-- filterHeaders --");
}
--- 63,66 ----
Index: BaseFilter.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/filter/BaseFilter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** BaseFilter.java 18 May 2003 11:11:32 -0000 1.7
--- BaseFilter.java 26 Dec 2003 19:14:18 -0000 1.8
***************
*** 28,31 ****
--- 28,32 ----
/**
* BaseFilter
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 55,59 ****
public String filter(String responseBody, Hashtable headers, Hashtable properties) {
- log(METHOD,"--filter--");
String tmp = responseBody;
this.properties = properties;
--- 56,59 ----
***************
*** 74,78 ****
public void setNextFilter(IHTTPFilter filter) {
- log(METHOD,"--setNextFilter--");
nextFilter = filter;
}
--- 74,77 ----
***************
*** 89,94 ****
public void retrieveCommonInfo(Hashtable properties) {
- log(METHOD,"--retrieveCommonInfo--");
- //
errorcode = ((Integer)properties.get("HTTP_RETURNCODE")).intValue();
hostname = (String)properties.get("HOSTNAME");
--- 88,91 ----
Index: HTMLFilter.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/filter/HTMLFilter.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** HTMLFilter.java 15 Jun 2003 21:21:39 -0000 1.11
--- HTMLFilter.java 26 Dec 2003 19:14:18 -0000 1.12
***************
*** 30,33 ****
--- 30,34 ----
/**
* HTMLFilter
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 57,61 ****
public void filterHeaders( Hashtable headers) {
- log(METHOD,"-- updateHeaders --");
if(headers == null || headers.isEmpty() == true)
return;
--- 58,61 ----
***************
*** 71,75 ****
public String filterBody(String body) {
- log(METHOD,"-- filterHTML --");
if(body == null || body.length() == 0)
return null;
--- 71,74 ----
|
|
From: <fn...@us...> - 2003-12-26 19:14:22
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/logging
In directory sc8-pr-cvs1:/tmp/cvs-serv1441/src/cx/noe/jrevproxy/logging
Modified Files:
DataLogger.java ILog.java
Log Message:
merge with storem branch; updated suffixstring in datalogger
Index: DataLogger.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/logging/DataLogger.java,v
retrieving revision 2.10
retrieving revision 2.11
diff -C2 -d -r2.10 -r2.11
*** DataLogger.java 29 May 2003 13:56:54 -0000 2.10
--- DataLogger.java 26 Dec 2003 19:14:19 -0000 2.11
***************
*** 29,33 ****
* DataLogger
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
--- 29,33 ----
* DataLogger
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
***************
*** 40,44 ****
private int level = INFO;
private boolean debug = false;
!
/**
* Creates a DataLogger instance
--- 40,47 ----
private int level = INFO;
private boolean debug = false;
! private final int PREFIXLENGTH = 7;
!
! private final String[] prefixStr = {"DUMP","DEBUG","METHOD","INFO"};
!
/**
* Creates a DataLogger instance
***************
*** 49,52 ****
--- 52,56 ----
*/
public DataLogger(String logpath) throws IllegalArgumentException {
+ // tdob, maybe we should look if the path is existing or creatable
if(logpath == null || logpath.length() == 0)
throw new IllegalArgumentException("A logpath cannot be null or empty");
***************
*** 108,112 ****
try {
PrintWriter ostream = new PrintWriter(getFileOutputStream());
! ostream.write("["+prefix+"] "+data+"\r\n");
ostream.close();
}
--- 112,130 ----
try {
PrintWriter ostream = new PrintWriter(getFileOutputStream());
!
! Throwable e = new Throwable();
! StackTraceElement[] stackElements = e.getStackTrace();
!
! // Find the method in the stack which isn't part of the logging
! int stackrecord = 0;
! while(stackElements[stackrecord].getMethodName().equalsIgnoreCase("log")) {
! if(stackElements.length-1 == stackrecord)
! break;
! stackrecord++;
! }
!
! String classname = "["+unmungeSimpleClassName(extractSimpleClassName(stackElements[stackrecord].getClassName()))+"."+stackElements[stackrecord].getMethodName()+"] ";
!
! ostream.write("["+prefix+"] "+ prefixStr[level] + getSuffixStr(level) + classname + data +"\r\n");
ostream.close();
}
***************
*** 118,121 ****
--- 136,152 ----
}
}
+
+ private String getSuffixStr(int level) {
+ int length = prefixStr[level].length();
+ StringBuffer buf = new StringBuffer("");
+ if(length < PREFIXLENGTH) {
+ for(int i = length; i< PREFIXLENGTH; i++) {
+ buf.append(' ');
+ }
+ }
+ else
+ buf.append(' ');
+ return buf.toString();
+ }
/**
***************
*** 156,159 ****
return (OutputStream) new FileOutputStream(getLogFileName(),true);
}
!
}
--- 187,253 ----
return (OutputStream) new FileOutputStream(getLogFileName(),true);
}
!
! public static String extractPackageName (String fullClassName)
! {
! if ((null == fullClassName) || ("".equals (fullClassName)))
! return "";
!
! // The package name is everything preceding the last dot.
! // Is there a dot in the name?
! int lastDot = fullClassName.lastIndexOf ('.');
!
! // Note that by fiat, I declare that any class name that has been
! // passed in which starts with a dot doesn't have a package name.
! if (0 >= lastDot)
! return "";
!
! // Otherwise, extract the package name.
! return fullClassName.substring (0, lastDot);
! }
!
! public static String extractSimpleClassName (String fullClassName)
! {
! if ((null == fullClassName) || ("".equals (fullClassName)))
! return "";
!
! // The simple class name is everything after the last dot.
! // If there's no dot then the whole thing is the class name.
! int lastDot = fullClassName.lastIndexOf ('.');
! if (0 > lastDot)
! return fullClassName;
!
! // Otherwise, extract the class name.
! return fullClassName.substring (++lastDot);
! }
!
! public static String extractDirectClassName (String simpleClassName)
! {
! if ((null == simpleClassName) || ("".equals (simpleClassName)))
! return "";
!
! // The direct class name is everything after the last '$', if there
! // are any '$'s in the simple class name. Otherwise, it's just
! // the simple class name.
! int lastSign = simpleClassName.lastIndexOf ('$');
! if (0 > lastSign)
! return simpleClassName;
!
! // Otherwise, extract the last class name.
! // Note that if you have a multiply-nested class, that this
! // will only extract the very last one. Extracting the stack of
! // nestings is left as an exercise for the reader.
! return simpleClassName.substring (++lastSign);
! }
!
! public static String unmungeSimpleClassName (String simpleClassName)
! {
! if ((null == simpleClassName) || ("".equals (simpleClassName)))
! return "";
!
! // Nested classes are set apart from top-level classes by using
! // the dollar sign '$' instead of a period '.' as the separator
! // between them and the top-level class that they sit
! // underneath. Let's undo that.
! return simpleClassName.replace ('$', '.');
! }
}
Index: ILog.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/logging/ILog.java,v
retrieving revision 2.3
retrieving revision 2.4
diff -C2 -d -r2.3 -r2.4
*** ILog.java 27 Mar 2003 15:49:32 -0000 2.3
--- ILog.java 26 Dec 2003 19:14:19 -0000 2.4
***************
*** 22,31 ****
/**
- *
* ILog
*
! * @author <a href=mailto:fre...@no...> Frederik Noë</a>
* @version <tt>$Revision$</tt>
- *
*/
public interface ILog {
--- 22,29 ----
/**
* ILog
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public interface ILog {
***************
*** 33,38 ****
public void log(Throwable e);
! public final int DEBUG = 0;
! public final int METHOD = 1;
! public final int INFO = 2;
}
--- 31,37 ----
public void log(Throwable e);
! public final int DUMP = 0;
! public final int DEBUG = 1;
! public final int METHOD = 2;
! public final int INFO = 3;
}
|
|
From: <fn...@us...> - 2003-12-25 20:18:38
|
Update of /cvsroot/jrevproxy/jRevProxy/doc In directory sc8-pr-cvs1:/tmp/cvs-serv25094/doc Added Files: dummy.txt Log Message: removed javadoc reference documentation; added dummy file |
Update of /cvsroot/jrevproxy/jRevProxy/doc/javadoc/cx/noe/jrevproxy/logging In directory sc8-pr-cvs1:/tmp/cvs-serv25094/doc/javadoc/cx/noe/jrevproxy/logging Removed Files: package-summary.html ILog.html package-tree.html package-frame.html DataLogger.html Log Message: removed javadoc reference documentation; added dummy file --- package-summary.html DELETED --- --- ILog.html DELETED --- --- package-tree.html DELETED --- --- package-frame.html DELETED --- --- DataLogger.html DELETED --- |
Update of /cvsroot/jrevproxy/jRevProxy/doc/javadoc/cx/noe/jrevproxy In directory sc8-pr-cvs1:/tmp/cvs-serv25094/doc/javadoc/cx/noe/jrevproxy Removed Files: HTTPFormatException.html RulesetParser.html HTTPBase.html HTTPResponse.html RevProRunnable.html package-summary.html Rule.html package-tree.html RequestHandler.html IHandlerInfo.html Ruleset.html RevProxy.html PoolManager.html RequestListener.html DOMRulesetUnmarshaller.html IRequestFilter.html ConnectionInfo.html package-frame.html SocketFactory.html HTTPRequest.html Log Message: removed javadoc reference documentation; added dummy file --- HTTPFormatException.html DELETED --- --- RulesetParser.html DELETED --- --- HTTPBase.html DELETED --- --- HTTPResponse.html DELETED --- --- RevProRunnable.html DELETED --- --- package-summary.html DELETED --- --- Rule.html DELETED --- --- package-tree.html DELETED --- --- RequestHandler.html DELETED --- --- IHandlerInfo.html DELETED --- --- Ruleset.html DELETED --- --- RevProxy.html DELETED --- --- PoolManager.html DELETED --- --- RequestListener.html DELETED --- --- DOMRulesetUnmarshaller.html DELETED --- --- IRequestFilter.html DELETED --- --- ConnectionInfo.html DELETED --- --- package-frame.html DELETED --- --- SocketFactory.html DELETED --- --- HTTPRequest.html DELETED --- |
Update of /cvsroot/jrevproxy/jRevProxy/doc/javadoc In directory sc8-pr-cvs1:/tmp/cvs-serv25094/doc/javadoc Removed Files: constant-values.html overview-summary.html serialized-form.html package-list overview-frame.html help-doc.html packages.html stylesheet.css index-all.html overview-tree.html allclasses-noframe.html deprecated-list.html allclasses-frame.html index.html Log Message: removed javadoc reference documentation; added dummy file --- constant-values.html DELETED --- --- overview-summary.html DELETED --- --- serialized-form.html DELETED --- --- package-list DELETED --- --- overview-frame.html DELETED --- --- help-doc.html DELETED --- --- packages.html DELETED --- --- stylesheet.css DELETED --- --- index-all.html DELETED --- --- overview-tree.html DELETED --- --- allclasses-noframe.html DELETED --- --- deprecated-list.html DELETED --- --- allclasses-frame.html DELETED --- --- index.html DELETED --- |
|
From: <fn...@us...> - 2003-12-24 23:29:15
|
Update of /cvsroot/jrevproxy/jRevProxy/src In directory sc8-pr-cvs1:/tmp/cvs-serv10509/src Removed Files: .nbattrs Log Message: removed netbeans specific attribs; added eclipse project file --- .nbattrs DELETED --- |
|
From: <fn...@us...> - 2003-12-24 23:29:14
|
Update of /cvsroot/jrevproxy/jRevProxy/etc In directory sc8-pr-cvs1:/tmp/cvs-serv10509/etc Removed Files: .nbattrs Log Message: removed netbeans specific attribs; added eclipse project file --- .nbattrs DELETED --- |
|
From: <fn...@us...> - 2003-12-24 23:29:14
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy In directory sc8-pr-cvs1:/tmp/cvs-serv10509/src/cx/noe/jrevproxy Removed Files: .nbattrs Log Message: removed netbeans specific attribs; added eclipse project file --- .nbattrs DELETED --- |
|
From: <fn...@us...> - 2003-12-24 23:29:14
|
Update of /cvsroot/jrevproxy/jRevProxy In directory sc8-pr-cvs1:/tmp/cvs-serv10509 Added Files: .project Removed Files: .nbattrs Log Message: removed netbeans specific attribs; added eclipse project file --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>jRevProxy</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription> --- .nbattrs DELETED --- |
|
From: <st...@us...> - 2003-12-09 22:32:57
|
Update of /cvsroot/jrevproxy/jRevProxy/bin In directory sc8-pr-cvs1:/tmp/cvs-serv5076/bin Removed Files: jrevproxy.sh Log Message: logging with introspection, remove all METHOD logging, added DUMP logging, updated javadoc comments --- jrevproxy.sh DELETED --- |
|
From: <st...@us...> - 2003-12-09 22:32:50
|
Update of /cvsroot/jrevproxy/jRevProxy/bin In directory sc8-pr-cvs1:/tmp/cvs-serv5047/bin Removed Files: jrevproxy.bat Log Message: logging with introspection, remove all METHOD logging, added DUMP logging, updated javadoc comments --- jrevproxy.bat DELETED --- |
|
From: <st...@us...> - 2003-12-09 22:29:01
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/logging
In directory sc8-pr-cvs1:/tmp/cvs-serv4077/src/cx/noe/jrevproxy/logging
Modified Files:
Tag: storem
DataLogger.java ILog.java
Log Message:
logging with introspection, remove all METHOD logging, added DUMP logging, updated javadoc comments
Index: DataLogger.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/logging/DataLogger.java,v
retrieving revision 2.10
retrieving revision 2.10.2.1
diff -C2 -d -r2.10 -r2.10.2.1
*** DataLogger.java 29 May 2003 13:56:54 -0000 2.10
--- DataLogger.java 9 Dec 2003 22:28:58 -0000 2.10.2.1
***************
*** 29,33 ****
* DataLogger
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
--- 29,33 ----
* DataLogger
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
***************
*** 40,44 ****
private int level = INFO;
private boolean debug = false;
!
/**
* Creates a DataLogger instance
--- 40,48 ----
private int level = INFO;
private boolean debug = false;
!
! // tdob, don't like this, should be done extrapolating length!
! private final String[] prefixStr = {"DUMP","DEBUG","METHOD","INFO"};
! private final String[] suffixStr = {" "," "," "," "};
!
/**
* Creates a DataLogger instance
***************
*** 49,52 ****
--- 53,57 ----
*/
public DataLogger(String logpath) throws IllegalArgumentException {
+ // tdob, maybe we should look if the path is existing or creatable
if(logpath == null || logpath.length() == 0)
throw new IllegalArgumentException("A logpath cannot be null or empty");
***************
*** 108,112 ****
try {
PrintWriter ostream = new PrintWriter(getFileOutputStream());
! ostream.write("["+prefix+"] "+data+"\r\n");
ostream.close();
}
--- 113,131 ----
try {
PrintWriter ostream = new PrintWriter(getFileOutputStream());
!
! Throwable e = new Throwable();
! StackTraceElement[] stackElements = e.getStackTrace();
!
! // Find the method in the stack which isn't part of the logging
! int stackrecord = 0;
! while(stackElements[stackrecord].getMethodName().equalsIgnoreCase("log")) {
! if(stackElements.length-1 == stackrecord)
! break;
! stackrecord++;
! }
!
! String classname = "["+unmungeSimpleClassName(extractSimpleClassName(stackElements[stackrecord].getClassName()))+"."+stackElements[stackrecord].getMethodName()+"] ";
!
! ostream.write("["+prefix+"] "+ prefixStr[level] + suffixStr[level] + classname + data +"\r\n");
ostream.close();
}
***************
*** 156,159 ****
return (OutputStream) new FileOutputStream(getLogFileName(),true);
}
!
}
--- 175,241 ----
return (OutputStream) new FileOutputStream(getLogFileName(),true);
}
!
! public static String extractPackageName (String fullClassName)
! {
! if ((null == fullClassName) || ("".equals (fullClassName)))
! return "";
!
! // The package name is everything preceding the last dot.
! // Is there a dot in the name?
! int lastDot = fullClassName.lastIndexOf ('.');
!
! // Note that by fiat, I declare that any class name that has been
! // passed in which starts with a dot doesn't have a package name.
! if (0 >= lastDot)
! return "";
!
! // Otherwise, extract the package name.
! return fullClassName.substring (0, lastDot);
! }
!
! public static String extractSimpleClassName (String fullClassName)
! {
! if ((null == fullClassName) || ("".equals (fullClassName)))
! return "";
!
! // The simple class name is everything after the last dot.
! // If there's no dot then the whole thing is the class name.
! int lastDot = fullClassName.lastIndexOf ('.');
! if (0 > lastDot)
! return fullClassName;
!
! // Otherwise, extract the class name.
! return fullClassName.substring (++lastDot);
! }
!
! public static String extractDirectClassName (String simpleClassName)
! {
! if ((null == simpleClassName) || ("".equals (simpleClassName)))
! return "";
!
! // The direct class name is everything after the last '$', if there
! // are any '$'s in the simple class name. Otherwise, it's just
! // the simple class name.
! int lastSign = simpleClassName.lastIndexOf ('$');
! if (0 > lastSign)
! return simpleClassName;
!
! // Otherwise, extract the last class name.
! // Note that if you have a multiply-nested class, that this
! // will only extract the very last one. Extracting the stack of
! // nestings is left as an exercise for the reader.
! return simpleClassName.substring (++lastSign);
! }
!
! public static String unmungeSimpleClassName (String simpleClassName)
! {
! if ((null == simpleClassName) || ("".equals (simpleClassName)))
! return "";
!
! // Nested classes are set apart from top-level classes by using
! // the dollar sign '$' instead of a period '.' as the separator
! // between them and the top-level class that they sit
! // underneath. Let's undo that.
! return simpleClassName.replace ('$', '.');
! }
}
Index: ILog.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/logging/ILog.java,v
retrieving revision 2.3
retrieving revision 2.3.2.1
diff -C2 -d -r2.3 -r2.3.2.1
*** ILog.java 27 Mar 2003 15:49:32 -0000 2.3
--- ILog.java 9 Dec 2003 22:28:58 -0000 2.3.2.1
***************
*** 22,31 ****
/**
- *
* ILog
*
! * @author <a href=mailto:fre...@no...> Frederik Noë</a>
* @version <tt>$Revision$</tt>
- *
*/
public interface ILog {
--- 22,29 ----
/**
* ILog
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public interface ILog {
***************
*** 33,38 ****
public void log(Throwable e);
! public final int DEBUG = 0;
! public final int METHOD = 1;
! public final int INFO = 2;
}
--- 31,37 ----
public void log(Throwable e);
! public final int DUMP = 0;
! public final int DEBUG = 1;
! public final int METHOD = 2;
! public final int INFO = 3;
}
|
Update of /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy
In directory sc8-pr-cvs1:/tmp/cvs-serv4077/src/cx/noe/jrevproxy
Modified Files:
Tag: storem
PoolManager.java HTTPBase.java HTTPResponse.java
RequestHandler.java VersionInfo.java SocketFactory.java
ConnectionInfo.java HTTPRequest.java RequestListener.java
Ruleset.java RevProxy.java HTTPFormatException.java
Log Message:
logging with introspection, remove all METHOD logging, added DUMP logging, updated javadoc comments
Index: PoolManager.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/PoolManager.java,v
retrieving revision 2.12
retrieving revision 2.12.2.1
diff -C2 -d -r2.12 -r2.12.2.1
*** PoolManager.java 24 May 2003 20:17:35 -0000 2.12
--- PoolManager.java 9 Dec 2003 22:28:57 -0000 2.12.2.1
***************
*** 29,36 ****
* PoolManager
*
! * The Poolmanager manages a set of threads that handle incoming and outgoing
! * HTTP requests.
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
--- 29,36 ----
* PoolManager
*
! * <p>The Poolmanager manages a set of threads that handle incoming and outgoing
! * HTTP requests.</p>
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
***************
*** 64,68 ****
public void init() {
- log(METHOD,"--init--");
createPool();
// start the poolmonitor
--- 64,67 ----
***************
*** 76,80 ****
**/
public synchronized void destroy() {
- log(METHOD,"--destroy--");
Handler h = null;
int stoppedHandlers = 0;
--- 75,78 ----
***************
*** 103,107 ****
public int getPoolsize() {
- log(METHOD,"--getPoolsize--");
return poolsize;
}
--- 101,104 ----
***************
*** 114,118 ****
*/
public synchronized void run(RevProRunnable thejob) throws Exception {
- log(METHOD,"--run--");
// find the next available handler
Handler h = null;
--- 111,114 ----
***************
*** 134,138 ****
*/
private void createPool() {
- log(METHOD,"--createPool--");
log(INFO,"Requested poolsize: "+ poolsize);
for(int i=0;i<poolsize;i++) {
--- 130,133 ----
***************
*** 150,154 ****
*/
private synchronized void addToPool(Handler handler) {
- log(METHOD,"--addToPool--");
poolstack.push(handler);
log(INFO,"handler " + handler.id + " pushed back");
--- 145,148 ----
***************
*** 156,160 ****
private void addTempToPool(int id) {
- log(METHOD,"--addTempToPool--");
Handler w = new Handler(id,true);
w.start();
--- 150,153 ----
***************
*** 167,177 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[PoolManager] " + str);
}
public ILog getLogger() {
- log(METHOD,"--getLogger--");
return logger;
}
--- 160,174 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
public ILog getLogger() {
return logger;
}
***************
*** 200,205 ****
public void run() {
- log(METHOD,"--run--");
- //
while(isRunning) {
synchronized (this) {
--- 197,200 ----
***************
*** 234,238 ****
private void handle(RevProRunnable job) {
- log(METHOD,"--handle--");
synchronized(this) {
thejob = job;
--- 229,232 ----
***************
*** 248,251 ****
--- 242,250 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logHandler != null)
***************
*** 282,291 ****
public void destroy() {
- log(METHOD,"--destroy--");
isRunning = false;
}
public void run(){
- log(METHOD,"--run--");
while(isAlive()) {
// calculate poolstack load
--- 281,288 ----
***************
*** 313,319 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[PoolMonitor] " + str);
}
}
--- 310,321 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
}
Index: HTTPBase.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPBase.java,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** HTTPBase.java 15 Jun 2003 21:21:38 -0000 1.12
--- HTTPBase.java 9 Dec 2003 22:28:57 -0000 1.12.2.1
***************
*** 27,31 ****
* HTTPBase
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
--- 27,31 ----
* HTTPBase
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
Index: HTTPResponse.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPResponse.java,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -d -r1.20 -r1.20.2.1
*** HTTPResponse.java 15 Jun 2003 21:21:38 -0000 1.20
--- HTTPResponse.java 9 Dec 2003 22:28:57 -0000 1.20.2.1
***************
*** 30,52 ****
* HTTPResponse
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
public class HTTPResponse extends HTTPBase{
- /* Status-Code = "200" ; OK
- * "201" ; Created
- * "202" ; Accepted
- * "204" ; No Content
- * "301" ; Moved Permanently
- * "302" ; Moved Temporarily
- * "304" ; Not Modified
- * "400" ; Bad Request
- * "401" ; Unauthorized
- * "403" ; Forbidden
- * "404" ; Not Found
- * "500" ; Internal Server Error
- * "501" ; Not Implemented
- * "502" ; Bad Gateway
- * "503" ; Service Unavailable */
public static final int HTTP_OK = 200;
--- 30,37 ----
* HTTPResponse
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public class HTTPResponse extends HTTPBase{
public static final int HTTP_OK = 200;
Index: RequestHandler.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RequestHandler.java,v
retrieving revision 2.29.2.2
retrieving revision 2.29.2.3
diff -C2 -d -r2.29.2.2 -r2.29.2.3
*** RequestHandler.java 9 Dec 2003 10:41:44 -0000 2.29.2.2
--- RequestHandler.java 9 Dec 2003 22:28:57 -0000 2.29.2.3
***************
*** 40,49 ****
* RequestHandler
*
! * The RequestHandler handles the external request.
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
! public class RequestHandler implements RevProRunnable,ILog {
private PoolManager manager = null;
--- 40,49 ----
* RequestHandler
*
! * <p>The RequestHandler handles the external request.</p>
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
! public class RequestHandler extends Thread implements RevProRunnable,ILog {
private PoolManager manager = null;
***************
*** 104,109 ****
logger = info.getLogger();
- log(METHOD,"--run--");
-
try {
if(!createExternalStreams()) {
--- 104,107 ----
***************
*** 125,129 ****
}
else {
! log(DEBUG,"external request: " + inStr);
log(INFO,"no valid external HTTP request received");
sendBadRequestResponse(extOut,"No valid HTTP request received");
--- 123,127 ----
}
else {
! log(DUMP,"external request: " + inStr);
log(INFO,"no valid external HTTP request received");
sendBadRequestResponse(extOut,"No valid HTTP request received");
***************
*** 134,138 ****
}
// log the external request in case we are in debug mode
! log(DEBUG,"external request: " + inStr);
// find out what virtual directory the request refers to
--- 132,136 ----
}
// log the external request in case we are in debug mode
! log(DUMP,"external request: " + inStr);
// find out what virtual directory the request refers to
***************
*** 174,178 ****
inStr = HTTPRequest.trim(inStr);
inStr = HTTPRequest.setVirtualDir(inStr,newVdir);
! log(DEBUG,"jRevProxy modified request: " + inStr);
if(!createInternalStreams(rule.getJunction())) {
--- 172,176 ----
inStr = HTTPRequest.trim(inStr);
inStr = HTTPRequest.setVirtualDir(inStr,newVdir);
! log(DUMP,"jRevProxy modified request: " + inStr);
if(!createInternalStreams(rule.getJunction())) {
***************
*** 207,211 ****
log(DEBUG,"Transfer-Encoding is chunked; let's decode it");
outStr = HTTPResponse.decodeTransferEncoding(outStr);
! log(DEBUG,"decoded internal response: " + outStr);
}
}
--- 205,209 ----
log(DEBUG,"Transfer-Encoding is chunked; let's decode it");
outStr = HTTPResponse.decodeTransferEncoding(outStr);
! log(DUMP,"decoded internal response: " + outStr);
}
}
***************
*** 213,218 ****
if(HTTPResponse.getContentTypeGroup(contenttype) == HTTPResponse.IMAGE) {
log(DEBUG,"Content is IMAGE");
extOut.write(outStream.toByteArray());
! extOut.flush();
extOut.close();
logger = oldLogger;
--- 211,217 ----
if(HTTPResponse.getContentTypeGroup(contenttype) == HTTPResponse.IMAGE) {
log(DEBUG,"Content is IMAGE");
+ // ByteArrayOutputStream.toByteArray() copies date, memory x2
extOut.write(outStream.toByteArray());
! //outEx.flush(); - tdob, doesn't do nothing for OutputStream
extOut.close();
logger = oldLogger;
***************
*** 224,228 ****
if(retcode == HTTPResponse.HTTP_OK || retcode == -1){
outStr = filter(outStr, contenttype, virtualDir);
! log(DEBUG,"filtered internal response: " + outStr);
//
if(retcode == -1) {
--- 223,227 ----
if(retcode == HTTPResponse.HTTP_OK || retcode == -1){
outStr = filter(outStr, contenttype, virtualDir);
! log(DUMP,"filtered internal response: " + outStr);
//
if(retcode == -1) {
***************
*** 231,235 ****
// was not empty. So we will reconstruct a new correct response.
outStr = reconstructResponse(outStr);
! log(DEBUG,"reconstructed response: " + outStr);
}
}
--- 230,234 ----
// was not empty. So we will reconstruct a new correct response.
outStr = reconstructResponse(outStr);
! log(DUMP,"reconstructed response: " + outStr);
}
}
***************
*** 285,289 ****
*/
public synchronized void handle(Socket socket) throws Exception {
- log(METHOD,"--handle--");
this.socket = socket;
manager.run(this);
--- 284,287 ----
***************
*** 295,301 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[RequestHandler] " + str);
}
--- 293,304 ----
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
***************
*** 305,312 ****
}
public void log(ILog logger, int level, String str) {
if(logger != null)
! logger.log(level,"[RequestHandler] " + str);
}
/**
* Provides a reference to the set of rules
--- 308,322 ----
}
+ /**
+ * Logs a string using a specific DataLogger instance
+ * @param logger the DataLogger instance
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(ILog logger, int level, String str) {
if(logger != null)
! logger.log(level, str);
}
+
/**
* Provides a reference to the set of rules
***************
*** 322,327 ****
*/
private void sendNotAuthorizedResponse(OutputStream out) {
- log(METHOD,"--sendNotAuthorizedResponse--");
- //
try {
out.write("HTTP/1.0 200 OK\r\n".getBytes());
--- 332,335 ----
***************
*** 343,357 ****
private void sendBadRequestResponse(OutputStream out, String description) {
- log(METHOD,"--sendBadRequestResponse--");
sendErrorResponse(out,400, description);
}
private void sendNotFoundResponse(OutputStream out, String description) {
- log(METHOD,"--sendNotFoundResponse--");
sendErrorResponse(out,404, description);
}
private void sendErrorResponse(OutputStream out, int errorcode, String description) {
- log(METHOD,"--sendErrorResponse--");
try {
out.write(("HTTP/1.0 " + errorcode +" "+ description + "\r\n").getBytes());
--- 351,362 ----
***************
*** 413,417 ****
} catch(Exception e) {
log(e);
! log(DEBUG, new String(buf));
}
--- 418,422 ----
} catch(Exception e) {
log(e);
! log(DUMP, new String(buf));
}
***************
*** 435,439 ****
**/
private ByteArrayOutputStream read(InputStream inEx, boolean isResponse) {
- log(METHOD,"--read--");
// create a temporary read buffer and a stream where we will put all our read information
byte[] buffer = new byte[512];
--- 440,443 ----
***************
*** 511,515 ****
*/
protected boolean sendAndReceive(String inStr) {
- log(METHOD,"--sendAndReceive--");
int nrretries = 1;
//
--- 515,518 ----
***************
*** 529,533 ****
if(outStream.size() != 0) {
String outStr = outStream.toString();
! log(DEBUG,"internal response: " + outStr);
// check first what HTTP returncode we have received
//
--- 532,536 ----
if(outStream.size() != 0) {
String outStr = outStream.toString();
! log(DUMP,"internal response: " + outStr);
// check first what HTTP returncode we have received
//
***************
*** 564,568 ****
sendBadRequestResponse(extOut,"No data received");
break TriesLoop;
! } //
log(DEBUG,"Redirected request: "+ inStr);
--- 567,572 ----
sendBadRequestResponse(extOut,"No data received");
break TriesLoop;
! }
! //
log(DEBUG,"Redirected request: "+ inStr);
***************
*** 623,628 ****
*/
protected boolean createInternalStreams(URL url) {
- log(METHOD, "--createInternalStreams(URL)--");
-
String protocol = url.getProtocol();
String host = url.getHost();
--- 627,630 ----
***************
*** 642,646 ****
*/
protected boolean createInternalStreams(String protocol, String host, int port) {
- log(METHOD,"--createInternalStreams(protocol,host,port)--");
Socket intSocket = null;
--- 644,647 ----
***************
*** 691,695 ****
*/
protected boolean createExternalStreams() {
- log(METHOD,"--createExternalStreams--");
try {
// set a timeout to avoid infinite reads while no new bytes are arriving
--- 692,695 ----
***************
*** 720,729 ****
protected String filter(String outStr, int contenttype, String vdir) {
- log(METHOD,"--filter--");
- //
Hashtable headers = HTTPResponse.getHeaders(outStr);
! log(DEBUG, "Original headers: " + headers.toString());
String originalBody = HTTPResponse.getMessageBody(outStr);
! log(DEBUG, "Original body: " + originalBody);
//
Hashtable props = new Hashtable();
--- 720,727 ----
protected String filter(String outStr, int contenttype, String vdir) {
Hashtable headers = HTTPResponse.getHeaders(outStr);
! log(DUMP, "Original headers: " + headers.toString());
String originalBody = HTTPResponse.getMessageBody(outStr);
! log(DUMP, "Original body: " + originalBody);
//
Hashtable props = new Hashtable();
***************
*** 757,763 ****
String body = htmlfilter.filter(originalBody, headers, props);
! log(DEBUG,"Retrieved the filtered headers: " + headers.toString());
if(body != null) {
! log(DEBUG,"Retrieved the filtered body: " + body);
log(DEBUG,"Body length: " + body.length());
}
--- 755,761 ----
String body = htmlfilter.filter(originalBody, headers, props);
! log(DUMP,"Retrieved the filtered headers: " + headers.toString());
if(body != null) {
! log(DUMP,"Retrieved the filtered body: " + body);
log(DEBUG,"Body length: " + body.length());
}
***************
*** 776,780 ****
*/
protected String getPath(Rule rule) {
- log(METHOD,"--getPath--");
String newVdir = rule.getJunction().getPath();
if (newVdir == null || newVdir == "")
--- 774,777 ----
***************
*** 784,788 ****
protected IHTTPFilter createFilterInstance(Class classInstance) {
- log(METHOD,"--createFilterInstance--");
IHTTPFilter filter = null;
--- 781,784 ----
***************
*** 799,803 ****
protected Object createObject(Constructor constructor, Object[] arguments) {
- log(METHOD,"--createObject--");
log(DEBUG,"Constructor: " + constructor.toString());
Object object = null;
--- 795,798 ----
***************
*** 813,818 ****
protected String reconstructResponse(String outStr) {
- log(METHOD,"--reconstructResponse--");
- //
Hashtable headers = HTTPResponse.getHeaders(outStr);
log(DEBUG, "Original headers: " + headers.toString());
--- 808,811 ----
***************
*** 822,842 ****
}
}
- /**
- * HTTP return codes
- * Status-Code = "200" ; OK
- * | "201" ; Created
- * | "202" ; Accepted
- * | "204" ; No Content
- * | "301" ; Moved Permanently
- * | "302" ; Moved Temporarily
- * | "304" ; Not Modified
- * | "400" ; Bad Request
- * | "401" ; Unauthorized
- * | "403" ; Forbidden
- * | "404" ; Not Found
- * | "500" ; Internal Server Error
- * | "501" ; Not Implemented
- * | "502" ; Bad Gateway
- * | "503" ; Service Unavailable
- *
- */
--- 815,816 ----
Index: VersionInfo.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/VersionInfo.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** VersionInfo.java 7 Dec 2003 17:46:58 -0000 1.1.2.1
--- VersionInfo.java 9 Dec 2003 22:28:57 -0000 1.1.2.2
***************
*** 22,36 ****
/**
- *
* VersionInfo
*
! * @author <a href=mailto:fre...@no...> Frederik Noe</a>
* @version <tt>$Revision$</tt>
- *
*/
public final class VersionInfo {
private final String version = "v0.6";
! private final int buildNumber = 1012;
public String getVersion() {
--- 22,34 ----
/**
* VersionInfo
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
public final class VersionInfo {
private final String version = "v0.6";
! private final int buildNumber = 1034;
public String getVersion() {
Index: SocketFactory.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/SocketFactory.java,v
retrieving revision 2.3
retrieving revision 2.3.2.1
diff -C2 -d -r2.3 -r2.3.2.1
*** SocketFactory.java 27 Mar 2003 15:49:37 -0000 2.3
--- SocketFactory.java 9 Dec 2003 22:28:57 -0000 2.3.2.1
***************
*** 55,59 ****
public ServerSocket getServerSocket(int port) throws IOException {
- log(METHOD,"--getServerSocket--");
InetAddress bindAddress = null;
ServerSocket serversocket = null;
--- 55,58 ----
***************
*** 67,71 ****
public SSLServerSocket getSSLServerSocket(int port, boolean requireClientAuthentication) throws Exception{
- log(METHOD,"--getSSLServerSocket--");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
--- 66,69 ----
***************
*** 113,127 ****
public Socket getClientSocket(String host, int port) throws Exception{
- log(METHOD,"--getClientSocket--");
return new Socket(host,port);
}
public Socket getSSLClientSocket(String host, int port) throws Exception{
- log(METHOD,"--getSSLClientSocket--");
return null;
}
private InetAddress getBindAddress() {
- log(METHOD,"--getBindAddress--");
String address = null;
if(null != (address = properties.getProperty("INTERFACE"))) {
--- 111,122 ----
***************
*** 144,151 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[SocketFactory] " + str);
}
-
}
--- 139,151 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
}
Index: ConnectionInfo.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/ConnectionInfo.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** ConnectionInfo.java 15 Jun 2003 21:21:38 -0000 1.10
--- ConnectionInfo.java 9 Dec 2003 22:28:57 -0000 1.10.2.1
***************
*** 26,29 ****
--- 26,30 ----
/**
* ConnectionInfo
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 42,46 ****
* Creates a new instance of ConnectionInfo
*/
! public ConnectionInfo(ILog logger, InetSocketAddress socketaddress) {
this.logger = logger;
this.socketaddress = socketaddress;
--- 43,47 ----
* Creates a new instance of ConnectionInfo
*/
! public ConnectionInfo(ILog logger, InetSocketAddress socketaddress) {
this.logger = logger;
this.socketaddress = socketaddress;
***************
*** 52,56 ****
*/
public InetSocketAddress getSocketAddress() {
- log(METHOD,"--getSocketAddress--");
return socketaddress;
}
--- 53,56 ----
***************
*** 61,65 ****
*/
public void setCertificate(X509Certificate certificate) {
- log(METHOD,"--setCertificate--");
log(DEBUG,"Certificate SubjectDN: " + certificate.getSubjectDN().getName());
this.certificate = certificate;
--- 61,64 ----
***************
*** 95,105 ****
*/
public X509Certificate getCertificate() {
- log(METHOD,"--getCertificate--");
return certificate;
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[ConnectionInfo] " + str);
}
--- 94,108 ----
*/
public X509Certificate getCertificate() {
return certificate;
}
+ /**
+ * Logs a string using the DataLogger
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
Index: HTTPRequest.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPRequest.java,v
retrieving revision 2.12.2.1
retrieving revision 2.12.2.2
diff -C2 -d -r2.12.2.1 -r2.12.2.2
*** HTTPRequest.java 7 Dec 2003 17:46:58 -0000 2.12.2.1
--- HTTPRequest.java 9 Dec 2003 22:28:57 -0000 2.12.2.2
***************
*** 24,28 ****
* HTTPRequest
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
--- 24,28 ----
* HTTPRequest
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
Index: RequestListener.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RequestListener.java,v
retrieving revision 2.15
retrieving revision 2.15.2.1
diff -C2 -d -r2.15 -r2.15.2.1
*** RequestListener.java 15 Jun 2003 21:21:38 -0000 2.15
--- RequestListener.java 9 Dec 2003 22:28:57 -0000 2.15.2.1
***************
*** 46,50 ****
* RequestListener
*
! * Starts listening for HTTP/HTTPS requests
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
--- 46,51 ----
* RequestListener
*
! * <p>Starts listening for HTTP/HTTPS requests</p>
! *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 80,85 ****
public void init() throws Exception {
- log(METHOD,"--init--");
- //
parseXMLConfig();
refresher.start();
--- 81,84 ----
***************
*** 87,91 ****
public void destroy() {
- log(METHOD,"--destroy--");
isRunning = false;
--- 86,89 ----
***************
*** 97,102 ****
public void run(){
- log(METHOD,"--run--");
-
try{
//
--- 95,98 ----
***************
*** 206,228 ****
}
public int getPort(){
! log(METHOD,"--getPort--");
return port;
}
/**
! * Sets also the port number on which the socket has to listen
* @param port the port number
*/
! public void setPort(int port) {
! log(METHOD,"--setPort--");
! this.port = port;
}
public void setClientAuthentication(boolean clientauth) {
- log(METHOD,"--setClientAuthentication--");
this.clientauth = clientauth;
}
public int getProtocol() {
return protocol;
}
--- 202,236 ----
}
+ /**
+ * Gets the port number on which the socket has to listen
+ */
public int getPort(){
! log(DEBUG, "Port number = "+port);
return port;
}
/**
! * Sets the port number on which the socket has to listen
! *
* @param port the port number
*/
! public void setPort(int port) throws IllegalArgumentException {
! if(port <=0 || port > 65535) {
! log(DEBUG, "Port number not in range 1-65535");
! throw new IllegalArgumentException();
! } else {
! this.port = port;
! log(DEBUG, "Port number set to "+this.port);
! }
}
public void setClientAuthentication(boolean clientauth) {
this.clientauth = clientauth;
}
+ /**
+ * Gets the communication protocol which has to be used
+ */
public int getProtocol() {
+ log(DEBUG, "Protocol = "+protocol);
return protocol;
}
***************
*** 236,240 ****
*/
public void setProtocol(int protocol) throws IllegalArgumentException{
- log(METHOD,"--setProtocol--");
switch(protocol){
case HTTP:
--- 244,247 ----
***************
*** 256,262 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[RequestListener] " + str);
}
--- 263,275 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
***************
*** 282,286 ****
public String getSubjectName() {
- log(METHOD," --getSubjectName-- ");
if(certificate != null)
return certificate.getSubjectDN().getName();
--- 295,298 ----
***************
*** 290,294 ****
public void handshakeCompleted(javax.net.ssl.HandshakeCompletedEvent event) {
- log(METHOD," --handshakeCompleted-- ");
try {
X509Certificate certificate = event.getPeerCertificateChain()[0];
--- 302,305 ----
***************
*** 317,323 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[CustomHandshakeCompletedListener] " + str);
}
--- 328,340 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
***************
*** 328,336 ****
}
/**
! * parse XML configuration file and create a set of rules out of it
*/
private void parseXMLConfig() throws Exception {
- log(METHOD,"--parseXMLConfig--");
-
if(xmlfilename == null) {
xmlfilename = properties.getProperty("XMLCONFIGFILE");
--- 345,351 ----
}
/**
! * Parse XML configuration file and create a set of rules out of it
*/
private void parseXMLConfig() throws Exception {
if(xmlfilename == null) {
xmlfilename = properties.getProperty("XMLCONFIGFILE");
***************
*** 349,353 ****
ruleset = parser.getRuleset();
log(INFO,"Ruleset read and parsed successfully ");
! log(DEBUG, ruleset.toString());
}
--- 364,368 ----
ruleset = parser.getRuleset();
log(INFO,"Ruleset read and parsed successfully ");
! log(DUMP, ruleset.toString());
}
***************
*** 378,382 ****
public void run() {
- log(METHOD,"--run--");
while(isRunning) {
try {
--- 393,396 ----
***************
*** 392,398 ****
}
public void log(int level, String str) {
if(logger != null)
! logger.log(level,"[RulesetRefresher] " + str);
}
--- 406,418 ----
}
+ /**
+ * Logs a string using the DataLogger
+ *
+ * @param level the logging level
+ * @param str the string to be logged
+ */
public void log(int level, String str) {
if(logger != null)
! logger.log(level, str);
}
Index: Ruleset.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/Ruleset.java,v
retrieving revision 2.6
retrieving revision 2.6.2.1
diff -C2 -d -r2.6 -r2.6.2.1
*** Ruleset.java 7 May 2003 12:11:14 -0000 2.6
--- Ruleset.java 9 Dec 2003 22:28:57 -0000 2.6.2.1
***************
*** 23,28 ****
/**
* Ruleset
! *
! * Holds a set of reverse proxy rules
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
--- 23,29 ----
/**
* Ruleset
! *
! * <p>Holds a set of reverse proxy rules</p>
! *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
Index: RevProxy.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/RevProxy.java,v
retrieving revision 2.23
retrieving revision 2.23.2.1
diff -C2 -d -r2.23 -r2.23.2.1
*** RevProxy.java 15 Jun 2003 21:21:38 -0000 2.23
--- RevProxy.java 9 Dec 2003 22:28:57 -0000 2.23.2.1
***************
*** 33,36 ****
--- 33,37 ----
* Main entrance class, receiving command line parameters for the properties configuration file
* and XML configuration file
+ *
* @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
***************
*** 143,148 ****
if(null != (portstr = config.getProperty("PORT"))) {
port = Integer.parseInt(portstr);
! if(port <=0) {
! System.out.println("invalid port specified");
return;
}
--- 144,149 ----
if(null != (portstr = config.getProperty("PORT"))) {
port = Integer.parseInt(portstr);
! if(port <=0 || port > 65535) {
! System.out.println("Invalid port specified");
return;
}
***************
*** 181,187 ****
String loglevel = null;
if(null != (loglevel = config.getProperty("LOGLEVEL"))) {
! if(loglevel.compareToIgnoreCase("DEBUG") == 0) {
! datalogger.setLogLevel(DataLogger.DEBUG);
! }
else if (loglevel.compareToIgnoreCase("INFO") == 0)
datalogger.setLogLevel(DataLogger.INFO);
--- 182,191 ----
String loglevel = null;
if(null != (loglevel = config.getProperty("LOGLEVEL"))) {
! if (loglevel.compareToIgnoreCase("DUMP") == 0) {
! datalogger.setLogLevel(DataLogger.DUMP);
! System.setProperty("javax.net.debug", "all");
! }
! else if (loglevel.compareToIgnoreCase("DEBUG") == 0)
! datalogger.setLogLevel(DataLogger.DEBUG);
else if (loglevel.compareToIgnoreCase("INFO") == 0)
datalogger.setLogLevel(DataLogger.INFO);
***************
*** 222,226 ****
if(null != (poolsizeStr = config.getProperty("POOLSIZE"))) {
poolsize= Integer.parseInt(poolsizeStr);
! if(poolsize <=0) {
System.out.println("invalid poolsize specified");
return;
--- 226,230 ----
if(null != (poolsizeStr = config.getProperty("POOLSIZE"))) {
poolsize= Integer.parseInt(poolsizeStr);
! if(poolsize <= 0) {
System.out.println("invalid poolsize specified");
return;
Index: HTTPFormatException.java
===================================================================
RCS file: /cvsroot/jrevproxy/jRevProxy/src/cx/noe/jrevproxy/HTTPFormatException.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** HTTPFormatException.java 27 Mar 2003 15:53:57 -0000 1.4
--- HTTPFormatException.java 9 Dec 2003 22:28:57 -0000 1.4.2.1
***************
*** 24,28 ****
* HTTPFormatException
*
! * @author <a href="mailto:fre...@no..."> Frederik Noe </a>
* @version <tt>$Revision$</tt>
*/
--- 24,28 ----
* HTTPFormatException
*
! * @author <a href="mailto:fre...@no...">Frederik Noe</a>
* @version <tt>$Revision$</tt>
*/
|