Examples

Apache Software Foundation | Jakarta Project | Apache Tomcat

## Examples

print-friendly
version
print-friendly
version

Sockets

The examples below are working when the Tomcat is configured according the examples described in the configtc file.

/example using normal socket

Map /examples to the Tomcat /examples context using a normal socket. Note the IP instead localhost (The JVM listens on the IPV4 address not no the IPV6).

    [shm]
    file=${serverRoot}/logs/shm.file
    size=1048576

    # Example socket channel, override port and host.
    [channel.socket:localhost:8019]
    port=8019
    host=127.0.0.1

    # define the worker
    [ajp13:localhost:8019]
    channel=channel.socket:localhost:8019

    # Uri mapping
    [uri:/examples/*]
    worker=ajp13:localhost:8019

/jkstatus

Map /jkstatus to the status worker.

    [shm]
    file=${serverRoot}/logs/shm.file
    size=1048576

    # define the worker
    [status:status]

    # Uri mapping
    [uri:/jkstatus/*]
    worker=status:status

/example using AF_UNIX socket

Map /examples to the Tomcat /examples context using a AF_UNIX socket. Socket file is create by the Tomcat becarefull when the Web Server runs in a different user than the Tomcat with the permission of the socket file:

    apache20@jfcexpert:~/apache> ls -l /home1/jakarta/jakarta-tomcat-4.1/dist/work/jk2.socket
    srw-rw----    1 jakarta  jakarta         0 Jun 20 08:27 /home1/jakarta/jakarta-tomcat-4.1/dist/work/jk2.socket

Here the Tomcat user and the Web Server user must be in the same group.

    [shm]
    file=${serverRoot}/logs/shm.file
    size=1048576

    # Example unixsocket channel.
    [channel.un:unixsocket]
    file=/home1/jakarta/jakarta-tomcat-4.1/dist/work/jk2.socket

    # define the worker
    [ajp13:unixsocket]
    channel=channel.un:unixsocket

    # Uri mapping
    [uri:/examples/*]
    worker=ajp13:unixsocket

JNI