diff options
Diffstat (limited to 'sapi/servlet')
-rw-r--r-- | sapi/servlet/CREDITS | 2 | ||||
-rw-r--r-- | sapi/servlet/Makefile.in | 30 | ||||
-rw-r--r-- | sapi/servlet/README | 42 | ||||
-rw-r--r-- | sapi/servlet/config.m4 | 48 | ||||
-rw-r--r-- | sapi/servlet/cookies.php | 41 | ||||
-rw-r--r-- | sapi/servlet/date.php | 28 | ||||
-rw-r--r-- | sapi/servlet/formatter.java | 36 | ||||
-rw-r--r-- | sapi/servlet/jinfo.php | 5 | ||||
-rw-r--r-- | sapi/servlet/jver.php | 17 | ||||
-rw-r--r-- | sapi/servlet/reqheaders.php | 24 | ||||
-rw-r--r-- | sapi/servlet/reqinfo.php | 29 | ||||
-rw-r--r-- | sapi/servlet/reqparams.php | 35 | ||||
-rw-r--r-- | sapi/servlet/servlet.c | 407 | ||||
-rw-r--r-- | sapi/servlet/servlet.dsp | 290 | ||||
-rw-r--r-- | sapi/servlet/servlet.java | 188 | ||||
-rw-r--r-- | sapi/servlet/sessions.php | 60 | ||||
-rw-r--r-- | sapi/servlet/web.xml | 41 |
17 files changed, 0 insertions, 1323 deletions
diff --git a/sapi/servlet/CREDITS b/sapi/servlet/CREDITS deleted file mode 100644 index ae4e83e1e2..0000000000 --- a/sapi/servlet/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -Java Servlet -Sam Ruby diff --git a/sapi/servlet/Makefile.in b/sapi/servlet/Makefile.in deleted file mode 100644 index 940866b7fc..0000000000 --- a/sapi/servlet/Makefile.in +++ /dev/null @@ -1,30 +0,0 @@ - -LTLIBRARY_NAME = libsapi.la -LTLIBRARY_SOURCES = servlet.c java.c -LTLIBRARY_DEPENDENCIES = phpsrvlt.jar - -EXTRA_CFLAGS = $(JAVA_CFLAGS) -EXTRA_INCLUDES = $(JAVA_INCLUDE) - -include $(top_srcdir)/build/ltlib.mk - -java.c : ../../ext/java/java.c - @cp ../../ext/java/java.c . - -phpsrvlt.jar : servlet.java ../../ext/java/reflect.java - $(mkinstalldirs) net/php - @echo library=php4>net/php/reflect.properties - @echo library=php4>net/php/servlet.properties - @cp formatter.java net/php - @cp servlet.java net/php - @cp ../../ext/java/reflect.java net/php - javac net/php/reflect.java - @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac - javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) net/php/servlet.java - @test ! -f servlet.class || mv servlet.class net/php # bug in KJC javac - javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) net/php/formatter.java - @test ! -f formatter.class || mv formatter.class net/php # bug in KJC javac - $(JAVA_JAR) phpsrvlt.jar net/php/*.class net/php/*.properties - @rm net/php/servlet.* net/php/reflect.* net/php/formatter.* - @rmdir net/php - @rmdir net diff --git a/sapi/servlet/README b/sapi/servlet/README deleted file mode 100644 index 1a93186353..0000000000 --- a/sapi/servlet/README +++ /dev/null @@ -1,42 +0,0 @@ -What is PHP4 sapi/servlet? - - PHP4 sapi/servlet builds upon the mechanism defined by ext/java to enable - the entire PHP processor to be run as a servlet. The primary advanatage - of this from a PHP perspective is that web servers which support servlets - typically take great care in pooling and reusing JVMs. - - Notes: - - 1) While this code is intended to be able to run on any servlet engine, - it has only been tested on Apache's Jakarta/tomcat to date. Bug - reports, success stories and/or patches required to get this code - to run on other engines would be appreciated. - - 2) PHP has a habit of changing the working directory. Sapi/servlet will - eventually change it back, but while PHP is running the servlet engine - may not be able to load any classes from the CLASSPATH which are - specified using a relative directory syntax, or find the work directory - used for administration and JSP compilation tasks. - -Build and execution instructions: - - Most of the configuration hassles associated with ext/java are associated - with starting the JVM, and as such do not apply to sapi/servlet. In - particular, no updates to php.ini are required on any operating system. - - Unix: - Build: - ./configure --with-servlet --with-java - Execute: - add phpsrvlt.jar to CLASSPATH - add directory containing libphp4.so to LD_LIBRARY_PATH - merge/overwrite build/tomcat/examples/WEB-INF/web.xml from sapi/servlet - - Win32: - Build: - add jdsk (or d:\build\tomcat\classes) to CLASSPATH - build sapi\servlet\servlet.dsp - Execute: - add phpsrvlt.jar to CLASSPATH - add directory containing php4ts.dll and phpsrvlt.dll to PATH - merge/overwrite build\tomcat\examples\WEB-INF\web.xml from sapi\servlet diff --git a/sapi/servlet/config.m4 b/sapi/servlet/config.m4 deleted file mode 100644 index bc0badb53c..0000000000 --- a/sapi/servlet/config.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# $Id$ -# config.m4 for servlet sapi - -AC_MSG_CHECKING(for Servlet support) -AC_ARG_WITH(servlet, -[ --with-servlet[=DIR] Include servlet support. DIR is the base install - directory for the JSDK. This SAPI prereqs the - java extension must be built as a shared dl.], -[ - if test "$withval" != "no"; then - - if test "$withval" = "yes"; then - SERVLET_CLASSPATH=. - else - if test -f $withval/lib/servlet.jar; then - SERVLET_CLASSPATH=$withval/lib/servlet.jar - fi - - if test -f $withval/lib/jsdk.jar; then - SERVLET_CLASSPATH=$withval/lib/jsdk.jar - fi - - if test -d $withval/javax; then - SERVLET_CLASSPATH=$withval - fi - - if test -z "$SERVLET_CLASSPATH"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR(unable to find servlet libraries) - fi - fi - - AC_DEFINE(SAPI_SERVLET, 1, [Whether you use Servlet]) - - INSTALL_IT="\$(INSTALL) -m 0755 \$(srcdir)/sapi/servlet/phpsrvlt.jar \$(libdir)" - INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 $SAPI_SHARED \$(libdir)" - PHP_SAPI=servlet - PHP_BUILD_SHARED - PHP_BUILD_THREAD_SAFE - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) - -PHP_SUBST(SERVLET_CLASSPATH) diff --git a/sapi/servlet/cookies.php b/sapi/servlet/cookies.php deleted file mode 100644 index bcc4c40aae..0000000000 --- a/sapi/servlet/cookies.php +++ /dev/null @@ -1,41 +0,0 @@ -<html> -<body bgcolor="white"> -<head> -<title>Cookies Example</title> -</head> -<body> -<h3>Cookies Example</h3> - -<? - $cookies = $request->cookies; - - // print out cookies - - if (!current($cookies)) { - echo "Your browser isn't sending any cookies\n"; - } else { - echo "Your browser is sending the following cookies:<br>\n"; - - foreach ($cookies as $cookie) { - echo "Cookie Name: $cookie->name<br>Cookie value: $cookie->value<br>\n"; - } - } - - // set a cookie - - if ($cookieName) { - $response->addCookie(new Java("javax.servlet.http.Cookie", $cookieName, $cookieValue)); - echo "<p>You just sent the following cookie to your browser:<br>\n"; - echo "Name: $cookieName<br>Value: $cookieValue<P>\n"; - } - -?> -<P> -Create a cookie to send to your browser<br> -<form action="<?PHP echo $PHP_SELF ?>" method=POST> -Name: <input type=text length=20 name=cookieName><br> -Value: <input type=text length=20 name=cookieValue><br> -<input type=submit></form> -</body> -</html> - diff --git a/sapi/servlet/date.php b/sapi/servlet/date.php deleted file mode 100644 index 1146d31fab..0000000000 --- a/sapi/servlet/date.php +++ /dev/null @@ -1,28 +0,0 @@ -<html> -<!-- - Copyright (c) 1999 The Apache Software Foundation. All rights - reserved. ---> - -<body bgcolor="white"> -<?php $clock=new Java("dates.JspCalendar"); ?> - -<font size=4> -<ul> -<li> Day of month: is <?php echo $clock->dayOfMonth ?> -<li> Year: is <?php echo $clock->year ?> -<li> Month: is <?php echo $clock->month ?> -<li> Time: is <?php echo $clock->time ?> -<li> Date: is <?php echo $clock->date ?> -<li> Day: is <?php echo $clock->day ?> -<li> Day Of Year: is <?php echo $clock->dayOfYear ?> -<li> Week Of Year: is <?php echo $clock->weekOfYear ?> -<li> era: is <?php echo $clock->era ?> -<li> DST Offset: is <?php echo $clock->dSTOffset ?> -<li> Zone Offset: is <?php echo $clock->zoneOffset ?> -</ul> -</font> - -</body> -</html> - diff --git a/sapi/servlet/formatter.java b/sapi/servlet/formatter.java deleted file mode 100644 index 4827f14e6a..0000000000 --- a/sapi/servlet/formatter.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sam Ruby (rubys@us.ibm.com) | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -package net.php; - -import javax.servlet.*; -import javax.servlet.http.*; - -public class formatter extends servlet { - - public void service(HttpServletRequest request, - HttpServletResponse response) - throws ServletException - { - display_source_mode = true; - super.service(request, response); - } - -} diff --git a/sapi/servlet/jinfo.php b/sapi/servlet/jinfo.php deleted file mode 100644 index f20bbfb27d..0000000000 --- a/sapi/servlet/jinfo.php +++ /dev/null @@ -1,5 +0,0 @@ -<? - - phpinfo(); - -?> diff --git a/sapi/servlet/jver.php b/sapi/servlet/jver.php deleted file mode 100644 index e5e029c6e4..0000000000 --- a/sapi/servlet/jver.php +++ /dev/null @@ -1,17 +0,0 @@ -<html> -<? - - $system = new Java("java.lang.System"); - print "Java version=".$system->getProperty("java.version")." <br>\n"; - print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n"; - print "OS=".$system->getProperty("os.name")." ". - $system->getProperty("os.version")." on ". - $system->getProperty("os.arch")." <br>\n"; - - $formatter = new Java("java.text.SimpleDateFormat", - "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); - - print $formatter->format(new Java("java.util.Date"))."\n"; - -?> -</html> diff --git a/sapi/servlet/reqheaders.php b/sapi/servlet/reqheaders.php deleted file mode 100644 index db04aed3dc..0000000000 --- a/sapi/servlet/reqheaders.php +++ /dev/null @@ -1,24 +0,0 @@ -<html> -<body bgcolor="white"> -<head> -<title>Request Header Example</title> -</head> -<body> -<h3>Request Header Example</h3> -<table border=0> - -<?php - - $e = $request->headerNames; - while ($e->hasMoreElements()) { - $name = $e->nextElement(); - $value = $request->getHeader($name); - print "<tr><td bgcolor=\"#CCCCCC\">$name\n"; - print "</td><td>$value</td></tr>\n"; - } - -?> - -</table> -</body> -</html> diff --git a/sapi/servlet/reqinfo.php b/sapi/servlet/reqinfo.php deleted file mode 100644 index 37d453baf9..0000000000 --- a/sapi/servlet/reqinfo.php +++ /dev/null @@ -1,29 +0,0 @@ -<html> -<body> -<head> -<title>Request Information Example</title> -</head> -<body bgcolor="white"> -<h3>Request Information Example</h3> -<table border=0><tr><td> -Method: -</td><td> -<?php print $request->method ?> -</td></tr><tr><td> -Request URI: -</td><td> -<?php print $request->requestURI ?> -</td></tr><tr><td> -Protocol: -</td><td> -<?php print $request->protocol ?> -</td></tr><tr><td> -Path Info: -</td><td> -<?php print $request->pathInfo ?> -</td></tr><tr><td> -Remote Address: -</td><td> -<?php print $request->remoteAddr ?> -</table> - diff --git a/sapi/servlet/reqparams.php b/sapi/servlet/reqparams.php deleted file mode 100644 index f968b2753d..0000000000 --- a/sapi/servlet/reqparams.php +++ /dev/null @@ -1,35 +0,0 @@ -<html> -<body> -<head> -<title>Request Parameters Example</title> -</head> -<body bgcolor="white"> -<h3>Request Parameters Example</h3> -Parameters in this request:<br> -<?php - $e = $request->getParameterNames(); - - if (!$e->hasMoreElements()) { - echo "No Parameters, Please enter some"; - } - - while ($e->hasMoreElements()) { - $name = $e->nextElement(); - $value = $request->getParameter($name); - echo "$name = $value<br>\n"; - } - -?> -<P> -<form action="<?php echo $PHP_SELF ?>" method=POST> -First Name: -<input type=text size=20 name=firstname> -<br> -Last Name: -<input type=text size=20 name=lastname> -<br> -<input type=submit> -</form> -</body> -</html> - diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c deleted file mode 100644 index 4bec1bcd04..0000000000 --- a/sapi/servlet/servlet.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sam Ruby (rubys@us.ibm.com) | - +----------------------------------------------------------------------+ -*/ - -#include <jni.h> - -#include "php.h" -#include "php_globals.h" - -#include "SAPI.h" - -#include <stdio.h> -#include "php.h" -#ifdef PHP_WIN32 -#include "win32/time.h" -#include "win32/signal.h" -#include <process.h> -#else -#include "build-defs.h" -#endif -#if HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_SIGNAL_H -#include <signal.h> -#endif -#if HAVE_SETLOCALE -#include <locale.h> -#endif -#include "zend.h" -#include "php_ini.h" -#include "php_globals.h" -#include "php_main.h" -#include "fopen_wrappers.h" -#include "ext/standard/php_standard.h" -#include "ext/standard/php_dir.h" -#ifdef PHP_WIN32 -#include <io.h> -#include <fcntl.h> -#include "win32/php_registry.h" -#endif - -#include "zend_compile.h" -#include "zend_execute.h" -#include "zend_highlight.h" -#include "zend_indent.h" - -JNIEXPORT void JNICALL Java_net_php_reflect_setEnv - (JNIEnv *newJenv, jclass self); - -typedef struct { - JNIEnv *jenv; - jobject servlet; - char *cookies; -} servlet_request; - -extern zend_module_entry java_module_entry; - -static zend_module_entry *additional_php_extensions[] = { - &java_module_entry -}; - -#define EXTCOUNT (sizeof(additional_php_extensions)/sizeof(zend_module_entry *)) - -/***************************************************************************/ - -/* - * JNI convenience utilities - */ - -#define SETSTRING(target, source) \ - { const char *UTFString; \ - if (source) { \ - UTFString = (*jenv)->GetStringUTFChars(jenv, source, 0); \ - target = estrdup(UTFString); \ - (*jenv)->ReleaseStringUTFChars(jenv, source, UTFString); \ - } else { \ - target = 0; \ - } } - -#define FREESTRING(target) \ - { if (target) { efree(target); target=0; } } - -void ThrowIOException (JNIEnv *jenv, char *msg) { - jclass iox = (*jenv)->FindClass (jenv, "java/io/IOException"); - (*jenv)->ThrowNew (jenv, iox, (msg?msg:"null") ); -} - -void ThrowServletException (JNIEnv *jenv, char *msg) { - jclass sx = (*jenv)->FindClass (jenv, "javax/servlet/ServletException"); - (*jenv)->ThrowNew (jenv, sx, msg); -} - -/***************************************************************************/ - -/* - * sapi callbacks - */ - -static int sapi_servlet_ub_write(const char *str, uint str_length TSRMLS_DC) -{ - if (!SG(server_context)) { - fprintf(stderr, str); - return 0; - } - - { - JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv; - jobject servlet = ((servlet_request*)SG(server_context))->servlet; - - jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet); - jmethodID write = (*jenv)->GetMethodID(jenv, servletClass, "write", - "(Ljava/lang/String;)V"); - char *copy = malloc(str_length+1); - jstring arg; - memcpy(copy, str, str_length); - copy[str_length] = 0; - arg=(*jenv)->NewStringUTF(jenv, copy); - free(copy); - (*jenv)->CallVoidMethod(jenv, servlet, write, arg); - (*jenv)->DeleteLocalRef(jenv, arg); - return str_length; - } -} - - -static void sapi_servlet_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC) -{ - if (!sapi_header) return; - if (!SG(server_context)) return; - - { - JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv; - jobject servlet = ((servlet_request*)SG(server_context))->servlet; - - jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet); - jmethodID header = (*jenv)->GetMethodID(jenv, servletClass, "header", - "(Ljava/lang/String;)V"); - jstring arg=(*jenv)->NewStringUTF(jenv, sapi_header->header); - (*jenv)->CallVoidMethod(jenv, servlet, header, arg); - (*jenv)->DeleteLocalRef(jenv, arg); - } -} - - -static int sapi_servlet_read_post(char *buffer, uint count_bytes TSRMLS_DC) -{ - if (count_bytes == 0) { - return 0; - } else { - JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv; - jobject servlet = ((servlet_request*)SG(server_context))->servlet; - - jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet); - jmethodID readPost = (*jenv)->GetMethodID(jenv, servletClass, - "readPost", "(I)Ljava/lang/String;"); - jstring post = (*jenv)->CallObjectMethod(jenv, servlet, readPost, - count_bytes); - - const char *postAsUTF = (*jenv)->GetStringUTFChars(jenv, post, 0); - uint read_bytes=(*jenv)->GetStringLength(jenv, post); - if (read_bytes>count_bytes) read_bytes=count_bytes; - - memcpy(buffer, postAsUTF, read_bytes); - if (read_bytes<count_bytes) buffer[read_bytes]=0; - - (*jenv)->ReleaseStringUTFChars(jenv, post, postAsUTF); - - return read_bytes; - } -} - - -static char *sapi_servlet_read_cookies(TSRMLS_D) -{ - JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv; - jobject servlet = ((servlet_request*)SG(server_context))->servlet; - - jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet); - jmethodID readCookies = (*jenv)->GetMethodID(jenv, servletClass, - "readCookies", "()Ljava/lang/String;"); - jstring cookies = (*jenv)->CallObjectMethod(jenv, servlet, readCookies); - - SETSTRING( ((servlet_request*)SG(server_context))->cookies, cookies); - - return ((servlet_request*)SG(server_context))->cookies; -} - -/***************************************************************************/ - -/* - * sapi maintenance - */ - -static sapi_module_struct servlet_sapi_module = { - "java_servlet", /* name */ - "Java Servlet", /* pretty name */ - - php_module_startup, /* startup */ - php_module_shutdown_wrapper, /* shutdown */ - - NULL, /* activate */ - NULL, /* deactivate */ - - sapi_servlet_ub_write, /* unbuffered write */ - NULL, /* flush */ - NULL, /* get uid */ - NULL, /* getenv */ - - php_error, /* error handler */ - - NULL, /* header handler */ - NULL, /* send headers handler */ - sapi_servlet_send_header, /* send header handler */ - - sapi_servlet_read_post, /* read POST data */ - sapi_servlet_read_cookies, /* read Cookies */ - - NULL, /* register server variables */ - NULL, /* Log message */ - - NULL, /* Block interruptions */ - NULL, /* Unblock interruptions */ - - STANDARD_SAPI_MODULE_PROPERTIES -}; - - -JNIEXPORT void JNICALL Java_net_php_servlet_startup - (JNIEnv *jenv, jobject self) -{ - -#ifdef ZTS - tsrm_startup(1, 1, 0, NULL); -#endif - - sapi_startup(&servlet_sapi_module); - - if (php_module_startup(&servlet_sapi_module)==FAILURE) { - ThrowServletException(jenv,"module startup failure"); - return; - } - - if (php_startup_extensions(additional_php_extensions, EXTCOUNT)==FAILURE) { - ThrowServletException(jenv,"extension startup failure"); - return; - } - -} - - -JNIEXPORT void JNICALL Java_net_php_servlet_shutdown - (JNIEnv *jenv, jobject self) -{ - TSRMLS_FETCH(); - - php_module_shutdown(TSRMLS_C); -#ifdef ZTS - tsrm_shutdown(); -#endif - return; -} - -/***************************************************************************/ - -/* - * define a Java object to PHP - */ - -JNIEXPORT jlong JNICALL Java_net_php_servlet_define - (JNIEnv *jenv, jobject self, jstring name) -{ - pval *pzval; - jlong addr = 0; - const char *nameAsUTF = (*jenv)->GetStringUTFChars(jenv, name, 0); - TSRMLS_FETCH(); - - MAKE_STD_ZVAL(pzval); - addr = (jlong)(long) pzval; - - zend_hash_add(&EG(symbol_table), (char*)nameAsUTF, - strlen(nameAsUTF)+1, &pzval, sizeof(pval *), NULL); - (*jenv)->ReleaseStringUTFChars(jenv, name, nameAsUTF); - - return addr; -} - -/* - * execute a script - */ - -JNIEXPORT void JNICALL Java_net_php_servlet_send - (JNIEnv *jenv, jobject self, - jstring requestMethod, jstring queryString, - jstring requestURI, jstring pathTranslated, - jstring contentType, jint contentLength, - jstring authUser, jboolean display_source_mode) -{ - zend_file_handle file_handle; - int retval; -#ifndef VIRTUAL_DIR - char cwd[MAXPATHLEN]; -#endif - TSRMLS_FETCH(); - - zend_first_try { - SG(server_context) = emalloc(sizeof(servlet_request)); - ((servlet_request*)SG(server_context))->jenv=jenv; - ((servlet_request*)SG(server_context))->servlet=self; - ((servlet_request*)SG(server_context))->cookies=0; - - CG(extended_info) = 0; - - /* - * Initialize the request - */ - SETSTRING( SG(request_info).auth_user, authUser ); - SETSTRING( SG(request_info).request_method, requestMethod ); - SETSTRING( SG(request_info).query_string, queryString ); - SETSTRING( SG(request_info).request_uri, requestURI ); - SETSTRING( SG(request_info).content_type, contentType ); - SG(sapi_headers).http_response_code = 200; - SG(request_info).content_length = contentLength; - SG(request_info).auth_password = NULL; - if (php_request_startup(TSRMLS_C)==FAILURE) { - ThrowServletException(jenv,"request startup failure"); - return; - } - - /* - * Parse the file - */ - SETSTRING( SG(request_info).path_translated, pathTranslated ); -#ifdef VIRTUAL_DIR - retval = php_fopen_primary_script(&file_handle TSRMLS_CC); -#else - /* - * The java runtime doesn't like the working directory to be - * changed, so save it and change it back as quickly as possible - * in the hopes that Java doesn't notice. - */ - getcwd(cwd, MAXPATHLEN); - retval = php_fopen_primary_script(&file_handle TSRMLS_CC); - chdir(cwd); -#endif - - if (retval == FAILURE) { - php_request_shutdown((void *) 0); - php_module_shutdown(TSRMLS_C); - ThrowIOException(jenv, file_handle.filename); - return; - } - - /* - * Execute the request - */ - Java_net_php_reflect_setEnv(jenv, 0); - - if (display_source_mode) { - zend_syntax_highlighter_ini syntax_highlighter_ini; - - if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { - php_get_highlight_struct(&syntax_highlighter_ini); - sapi_send_headers(TSRMLS_C); - zend_highlight(&syntax_highlighter_ini TSRMLS_CC); - } - } else { - php_execute_script(&file_handle TSRMLS_CC); - php_header(); /* Make sure headers have been sent */ - } - - /* - * Clean up - */ - - FREESTRING(SG(request_info).request_method); - FREESTRING(SG(request_info).query_string); - FREESTRING(SG(request_info).request_uri); - FREESTRING(SG(request_info).path_translated); - FREESTRING(SG(request_info).content_type); - FREESTRING(((servlet_request*)SG(server_context))->cookies); - efree(SG(server_context)); - SG(server_context)=0; - - if (!display_source_mode) php_request_shutdown((void *) 0); - } zend_catch { - ThrowServletException(jenv,"bailout"); - } zend_end_try(); -} - diff --git a/sapi/servlet/servlet.dsp b/sapi/servlet/servlet.dsp deleted file mode 100644 index 9822557540..0000000000 --- a/sapi/servlet/servlet.dsp +++ /dev/null @@ -1,290 +0,0 @@ -# Microsoft Developer Studio Project File - Name="servlet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=servlet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak" CFG="servlet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "servlet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /out:"..\..\Release/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\TSRM" /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\TSRM" /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /out:"..\..\Release_TS/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "servlet - Win32 Release"
-# Name "servlet - Win32 Debug"
-# Name "servlet - Win32 Debug_TS"
-# Name "servlet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ext\java\java.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\..\..\win32\winutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\servlet.java
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Release
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac net\php\servlet.java
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\javac net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac -g net\php\servlet.java
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\javac -g net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac -g net\php\servlet.java
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\javac -g net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac net\php\servlet.java
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\javac net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.java
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/servlet/servlet.java b/sapi/servlet/servlet.java deleted file mode 100644 index 5e6887eaf3..0000000000 --- a/sapi/servlet/servlet.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sam Ruby (rubys@us.ibm.com) | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -package net.php; - -import java.io.IOException; -import java.net.URLEncoder; -import java.util.Enumeration; -import javax.servlet.*; -import javax.servlet.http.*; - -import java.lang.reflect.Method; - -public class servlet extends HttpServlet { - - char slash=System.getProperty("file.separator").charAt(0); - HttpServletRequest request; - HttpServletResponse response; - ServletInputStream stream; - - static int startup_count = 0; - - protected boolean display_source_mode = false; - private Method addHeader; - - /******************************************************************/ - /* native methods */ - /******************************************************************/ - - public native void startup(); - public native long define(String name); - public native void send(String requestMethod, String queryString, - String pathInfo, String pathTranslated, - String contentType, int contentLength, String authUser, - boolean display_source_mode); - public native void shutdown(); - - /******************************************************************/ - /* sapi callbacks */ - /******************************************************************/ - - public String readPost(int bytes) { - String result; - if (!request.getMethod().equals("POST")) { - result = request.getQueryString(); - } else { - Enumeration e = request.getParameterNames(); - result=""; - String concat=""; - while (e.hasMoreElements()) { - String name = (String)e.nextElement(); - String value = request.getParameter(name); - result+=concat+name+"="+URLEncoder.encode(value); - concat="&"; - } - } - if (result == null) return ""; - return result; - } - - public String readCookies() { - reflect.setResult(define("request"), request); - reflect.setResult(define("response"), response); - reflect.setResult(define("PHP_SELF"), request.getRequestURI()); - return request.getHeader("cookie"); - } - - public void header(String data) { - - // try to send the header using the most specific servlet API - // as possible (some servlet engines will add a content type - // header unless the setContentType method is called). - try { - if (data.startsWith("Content-type: ")) { - response.setContentType(data.substring(data.indexOf(" ")+1)); - } else if (data.startsWith("Location: ")) { - response.sendRedirect(data.substring(data.indexOf(" ")+1)); - } else { - int colon = data.indexOf(": "); - if (colon > 0) { - try { - addHeader.invoke(response, new Object[] - { data.substring(0,colon), data.substring(colon+2) } ); - } catch (Exception e) { - e.printStackTrace(System.err); - } - } else { - write(data); - } - } - } catch (IOException e) { - e.printStackTrace(System.err); - } - - } - - public void write(String data) { - try { - response.getWriter().print(data); - } catch (IOException e) { - e.printStackTrace(System.err); - } - } - - /******************************************************************/ - /* servlet interface */ - /******************************************************************/ - - public void init(ServletConfig config) throws ServletException { - super.init(config); - - // first time in, initialize native code - if (0 == startup_count++) { - reflect.loadLibrary("servlet"); - startup(); - } - - // try to find the addHeader method (added in the servlet API 2.2) - // otherwise settle for the setHeader method - try { - Class c = Class.forName("javax.servlet.http.HttpServletResponse"); - Method method[] = c.getDeclaredMethods(); - for (int i=0; i<method.length; i++) { - if (method[i].getName().equals("addHeader")) { - addHeader = method[i]; - break; - } - if (method[i].getName().equals("setHeader")) { - addHeader = method[i]; - } - } - } catch (Exception e) { - e.printStackTrace(System.err); - } - } - - public void service(HttpServletRequest request, - HttpServletResponse response, - String contextPath) - throws ServletException - { - this.request=request; - this.response=response; - - send(request.getMethod(), request.getQueryString(), - request.getRequestURI(), contextPath, - request.getContentType(), request.getContentLength(), - request.getRemoteUser(), display_source_mode); - - try { - if (stream != null) stream.close(); - } catch (IOException e) { - throw new ServletException(e.toString()); - } - } - - public void service(HttpServletRequest request, - HttpServletResponse response) - throws ServletException - { - String servletPath=request.getServletPath(); - String contextPath=getServletContext().getRealPath(servletPath); - service(request, response, contextPath); - } - - public void destroy() { - if (0 == --startup_count) shutdown(); - super.destroy(); - } - -} diff --git a/sapi/servlet/sessions.php b/sapi/servlet/sessions.php deleted file mode 100644 index 463b1b5e92..0000000000 --- a/sapi/servlet/sessions.php +++ /dev/null @@ -1,60 +0,0 @@ -<html> -<body bgcolor="white"> -<head> -<title>Sessions Example</title> -</head> -<body> -<h3>Sessions Example</h3> -<?php - - // print session info - - $session = $request->session; - $created = new Java("java.util.Date", $session->creationTime); - $accessed = new Java("java.util.Date", $session->lastAccessedTime); - - print "Session ID: $session->id<br>\n"; - print "Created: " . $created->toString() . "<br>\n"; - print "Last Accessed: " . $accessed->toString() . "<br>\n"; - - // set session info if needed - - if ($dataName) $session->setAttribute($dataName, $dataValue); - - // print session contents - - print "<P>\n"; - print "The following data is in your session:<br>\n"; - $e = $session->attributeNames; - while ($e->hasMoreElements()) { - $name = $e->nextElement(); - $value = $session->getAttribute($name); - print "$name = $value<br>\n"; - } - -?> -<P> -<form action="<?php echo $PHP_SELF ?>" method=POST> -Name of Session Attribute: -<input type=text size=20 name=dataName> -<br> -Value of Session Attribute: -<input type=text size=20 name=dataValue> -<br> -<input type=submit> -</form> -<P>GET based form:<br> -<form action="<?php echo $PHP_SELF ?>" method=GET> -Name of Session Attribute: -<input type=text size=20 name=dataName> -<br> -Value of Session Attribute: -<input type=text size=20 name=dataValue> -<br> -<input type=submit> -</form> -<p><a href="<?php echo $PHP_SELF ?>?dataName=foo&dataValue=bar" >URL encoded </a> -</body> -</html> -</body> -</html> diff --git a/sapi/servlet/web.xml b/sapi/servlet/web.xml deleted file mode 100644 index 9efa2fd091..0000000000 --- a/sapi/servlet/web.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" - "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd"> - -<web-app> - <servlet> - <servlet-name> - php - </servlet-name> - <servlet-class> - net.php.servlet - </servlet-class> - </servlet> - <servlet-mapping> - <servlet-name> - php - </servlet-name> - <url-pattern> - *.php - </url-pattern> - </servlet-mapping> - - <servlet> - <servlet-name> - php-formatter - </servlet-name> - <servlet-class> - net.php.formatter - </servlet-class> - </servlet> - <servlet-mapping> - <servlet-name> - php-formatter - </servlet-name> - <url-pattern> - *.phps - </url-pattern> - </servlet-mapping> -</web-app> |