Implements the interface with the APR library. This is for internal-use
only. The goal is to use 'natural' mappings for user code - for example
java.net.Socket for unix-domain sockets, etc.
addJkHandler
public void addJkHandler(String type,
JkHandler cb)
Add a Handler for jni callbacks.
createJavaContext
public static Object createJavaContext(String type,
long cContext)
createJkHandler
public long createJkHandler(long xEnv,
String compName)
getBuffer
public static byte[] getBuffer(Object ctx,
int id)
Return a buffer associated with the ctx.
getJkEnv
public long getJkEnv()
getJkHandler
public long getJkHandler(long xEnv,
String compName)
Get a native component
- 0 if the component is not found.
init
public void init()
throws IOException
Should register the request types it can handle,
same style as apache2.
- init in interface JkHandler
initialize
public int initialize()
Initialize APR
isLoaded
public boolean isLoaded()
jkDestroy
public int jkDestroy(long xEnv,
long componentP)
jkGetAttribute
public String jkGetAttribute(long xEnv,
long componentP,
String name)
jkInit
public int jkInit(long xEnv,
long componentP)
jkInvoke
public static int jkInvoke(long xEnv,
long componentP,
long endpointP,
int code,
data[] ,
int off,
int len,
int raw)
Send the packet to the C side. On return it contains the response
or indication there is no response. Asymetrical because we can't
do things like continuations.
jkRecycle
public void jkRecycle(long xEnv,
long endpointP)
Recycle an endpoint after use.
jkSetAttribute
public int jkSetAttribute(long xEnv,
long componentP,
String name,
String val)
jniInvoke
public static int jniInvoke(long jContext,
Object ctx)
jniMode
public static void jniMode()
loadNative
public void loadNative()
throws Throwable
This method of loading the libs doesn't require setting
LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
or a correct build all files will be in their right place.
The burden is on our code to deal with platform specific
extensions and to keep the paths consistent - not easy, but
worth it if it avoids one extra step for the user.
Of course, this can change to System.load() and putting the
libs in LD_LIBRARY_PATH.
loadNative
public void loadNative(String libPath)
releaseJkEnv
public void releaseJkEnv(long xEnv)
Clean the temp pool, put back the env in the pool
setAprHome
public void setAprHome(String s)
setBaseDir
public void setBaseDir(String s)
Native libraries are located based on base dir.
XXX Add platform, version, etc
setErr
public static void setErr(String filename)
Sets the System.err stream
setJniModeSo
public void setJniModeSo(String jniModeSo)
Name of the so used in inprocess mode
setNativeSo
public void setNativeSo(String nativeSo)
name of the so used by java. If not set we'll loadLibrary("jkjni" ),
if set we load( nativeSo )
setOut
public static void setOut(String filename)
Sets the System.out stream
setSoExt
public void setSoExt(String s)
terminate
public int terminate()