Actually, it looks like the client JRE downloads JAR files and includes the JRE version number in the User-Agent string:
GET /hyperstat/normal_p_shade.jar HTTP/1.1
content-type: application/x-java-archive
accept-encoding: pack200-gzip,gzip
Host: davidmlane.com
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/4.0 (Windows XP 5.1)
Java/1.6.0_03
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Proxy-Connection: keep-alive
If-Modified-Since: Thu, 07 Sep 2006 17:23:00 GMT
Here is an example which checks each HTTP request. If the request contains "java/", it parses the first three digits in the version string and sets a pool based on the first two:
when HTTP_REQUEST {
Log debug messages to /var/log/ltm? 1=yes, 0=no
set java_version_debug 1
Check if the User-Agent header contains the string "java/"
if {[string tolower [HTTP::header value User-Agent]] contains "java"}{
Parse out the Java version from "some text java/1.6.0 some text" to "1.6.0"
switch -glob [string range [getfield [string tolower [HTTP::header value User-Agent]] "java/" 2] 0 4] {
1.6.* {
Log a debug message to /var/log/ltm
if {$java_version_debug}{log local0. "Matched 1.6.*"}
Set the pool to the v1.6 pool
pool java_1.6.x_pool
}
1.5.* {
if {$java_version_debug}{log local0. "Matched 1.5.*"}
pool java_1.5.x_pool
}
1.4.* {
if {$java_version_debug}{log local0. "Matched 1.4.*"}
pool java_1.4.x_pool
}
default {
if {$java_version_debug}{log local0. "Matched default"}
pool java_default_pool
}
}
}
}
This assumes that you don't need to send client requests to the same pool they may have requested without the Java string in the User-Agent header.
Here is a version with intermediate variables that might help if you want to follow the commands:
when RULE_INIT {
set user_agent "Mozilla/4.0 (Windows XP 5.1) Java/1.6.0_03 test"
set user_agent [string tolower $user_agent]
log local0. "\$user_agent: $user_agent"
set java_version_string [getfield $user_agent "java/" 2]
log local0. "\$java_version_string: $java_version_string"
set java_version [string range $java_version_string 0 4]
log local0. "\$java_version: $java_version"
log local0. "Test: [string range [getfield [string tolower $user_agent] "java/" 2] 0 4]"
}
Sample log output:
Rule : mozilla/4.0 (windows xp 5.1) java/1.6.0_03 test
Rule : $java_version_string: 1.6.0_03 test
Rule : $java_version: 1.6.0
Rule : Test: 1.6.0
Holler if you have questions...
Aaron