}
if( logTime.isDebugEnabled() )
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 all elements.
X509Certificate jsseCerts[] = null;
try {
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
int i = 0;
while (bais.available() > 0) {
X509Certificate cert = (X509Certificate)
cf.generateCertificate(bais);
if (jsseCerts == null) {
jsseCerts = new X509Certificate[1];
} else {
X509Certificate tmpJsseCerts[] =
new X509Certificate[jsseCerts.length + 1];
System.arraycopy(jsseCerts, 0,
tmpJsseCerts, 0,
jsseCerts.length);
jsseCerts = tmpJsseCerts;
}
jsseCerts[i++] = cert;
}
} catch(java.security.cert.CertificateException e) {
log.error("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.isDebugEnabled())
log.debug("Unable to resolve "+req.remoteAddr());
}
}
} else if( actionCode==ActionCode.ACTION_ACK ) {
if( log.isTraceEnabled() )
log.trace("ACK " );
} else if ( actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY ) {
if( log.isTraceEnabled() )
log.trace("Replay ");
ByteChunk bc = (ByteChunk)param;
req.setContentLength(bc.getLength());
jkIS.setReplay(bc);
}
}