}
if( logTime.isLoggable(Level.FINEST) )
logTime(res.getRequest(), res);
} else if( actionCode==ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
Request req=(Request)param;
// Extract SSL certificate information (if requested)
MessageBytes certString = (MessageBytes)req.getNote(WorkerEnv.SSL_CERT_NOTE);
if( certString != null && !certString.isNull() ) {
ByteChunk certData = certString.getByteChunk();
ByteArrayInputStream bais =
new ByteArrayInputStream(certData.getBytes(),
certData.getStart(),
certData.getLength());
// Fill the first element.
X509Certificate jsseCerts[] = null;
try {
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
while(bais.available() > 0) {
X509Certificate cert = (X509Certificate)
cf.generateCertificate(bais);
if(jsseCerts == null) {
jsseCerts = new X509Certificate[1];
jsseCerts[0] = cert;
} else {
X509Certificate [] temp = new X509Certificate[jsseCerts.length+1];
System.arraycopy(jsseCerts,0,temp,0,jsseCerts.length);
temp[jsseCerts.length] = cert;
jsseCerts = temp;
}
}
} catch(java.security.cert.CertificateException e) {
log.log(Level.SEVERE, "Certificate convertion failed" , e );
return;
}
req.setAttribute(SSLSupport.CERTIFICATE_KEY,
jsseCerts);
}
} else if( actionCode==ActionCode.ACTION_REQ_HOST_ATTRIBUTE ) {
Request req=(Request)param;
// If remoteHost not set by JK, get it's name from it's remoteAddr
if( req.remoteHost().isNull()) {
try {
req.remoteHost().setString(InetAddress.getByName(
req.remoteAddr().toString()).
getHostName());
} catch(IOException iex) {
if(log.isLoggable(Level.FINEST)) {
log.finest("Unable to resolve "+req.remoteAddr());
}
}
}
} else if( actionCode==ActionCode.ACTION_ACK ) {
if( log.isLoggable(Level.FINEST) ) {
log.finest("ACK " );
}
} else if ( actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY ) {
if( log.isLoggable(Level.FINEST) ) {
log.finest("Replay ");
}
ByteChunk bc = (ByteChunk)param;
jkIS.setReplay(bc);
req.setContentLength(bc.getLength()); // reset so re-read
}
}