summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-05-14 17:31:31 +0000
committerianb <devnull@localhost>2005-05-14 17:31:31 +0000
commit9708b10a1aa731f142010f9bff6a82c2751e89bf (patch)
tree49a96b8446d37e687cd752ce0019427061e982a0 /paste
parent0db5755d9b56a440cc5986c21cc55f10b48ed19b (diff)
downloadpaste-9708b10a1aa731f142010f9bff6a82c2751e89bf.tar.gz
Added AJP servers from flup
Diffstat (limited to 'paste')
-rw-r--r--paste/servers/ajp_fork_server.py12
-rw-r--r--paste/servers/ajp_threaded_server.py55
2 files changed, 67 insertions, 0 deletions
diff --git a/paste/servers/ajp_fork_server.py b/paste/servers/ajp_fork_server.py
new file mode 100644
index 0000000..469fce7
--- /dev/null
+++ b/paste/servers/ajp_fork_server.py
@@ -0,0 +1,12 @@
+from ajp_threaded_server import *
+
+def serve(conf, app):
+ from flup.server.ajp_fork import WSGIServer
+ return serve_server(conf, app, WSGIServer)
+
+description = """\
+An AJP (Apache Jarkarta Tomcat Connector) forking (multiprocess)
+server. For more about AJP see
+<http://jakarta.apache.org/tomcat/connectors-doc/>. This server is
+from flup <http://www.saddi.com/software/flup/>
+"""
diff --git a/paste/servers/ajp_threaded_server.py b/paste/servers/ajp_threaded_server.py
new file mode 100644
index 0000000..37637fa
--- /dev/null
+++ b/paste/servers/ajp_threaded_server.py
@@ -0,0 +1,55 @@
+from paste.util import thirdparty
+thirdparty.add_package('flup')
+
+def serve(conf, app):
+ from flup.server.ajp import WSGIServer
+ return serve_server(conf, app, WSGIServer)
+
+def serve_server(conf, app, server_class):
+ server = server_class(
+ app,
+ scriptName=conf.get('root_url', ''),
+ bindAddress=(conf.get('host', 'localhost'),
+ int(conf.get('port', 8009))),
+ allowedServers=make_allowed_servers(conf.get('allowed_servers', None)))
+ return server.run()
+
+def make_allowed_servers(option):
+ if not option:
+ return None
+ if isinstance(option, (str, unicode)):
+ option = option.split(',')
+ return [s.strip() for s in option]
+
+options = {
+ 'host': 'The host name to bind to (default localhost). Note, if binding to localhost, only local connections will be allowed.',
+ 'port': 'The port to bind to (default 8009).',
+ 'root_url': 'The URL level to expect for incoming connections; if not set and this is not bound to /, then SCRIPT_NAME and PATH_INFO may be incorrect.',
+ 'allow_servers': 'A list of servers to allow connections from.',
+ }
+
+description = """\
+An AJP (Apache Jarkarta Tomcat Connector) threaded server. For more
+about AJP see <http://jakarta.apache.org/tomcat/connectors-doc/>.
+This server is from flup: <http://www.saddi.com/software/flup/>.
+"""
+
+help = """\
+When configuring, you would set worker.properties to something like
+(for mod_jk):
+
+ worker.list=foo
+ worker.foo.port=8009
+ worker.foo.host=localhost
+ worker.foo.type=ajp13
+
+Example httpd.conf (for mod_jk):
+
+ JkWorkersFile /path/to/workers.properties
+ JkMount /* foo
+
+If your ajp application is not on the root, you SHOULD specify
+root_url so that SCRIPT_NAME and PATH_INFO are correct.
+"""
+
+# @@: TODO: handle the logging level, or integrate logging