| Method from org.apache.coyote.tomcat3.CoyoteInterceptor2 Detail: |
public void engineInit(ContextManager cm) throws TomcatException {
super.engineInit( cm );
protocolNote = cm.getNoteId(ContextManager.MODULE_NOTE,
"coyote.protocol");
adapter=new Tomcat3Adapter(cm, this);
try {
Class c=Class.forName(processorClassName);
proto=(ProtocolHandler)c.newInstance();
setNote(protocolNote, proto);
} catch( Exception ex ) {
ex.printStackTrace();
}
this.setAttribute("jkHome", cm.getHome());
proto.setAdapter( adapter );
try {
Enumeration keys=attributes.keys();
while( keys.hasMoreElements() ) {
String k=(String)keys.nextElement();
Object o=attributes.get(k);
if( o instanceof String )
IntrospectionUtils.setProperty( proto, k, (String)o );
else
IntrospectionUtils.setAttribute( proto, k, o );
}
proto.init();
} catch( Exception ex ) {
throw new TomcatException( "Error setting protocol properties ", ex );
}
}
Called when the ContextManger is started |
public void engineShutdown(ContextManager cm) throws TomcatException {
try {
proto.destroy();
} catch( Exception ex ) {
throw new TomcatException( ex );
}
}
|
public void engineStart(ContextManager cm) throws TomcatException {
try {
proto.start();
} catch( Exception ex ) {
ex.printStackTrace();
throw new TomcatException( ex );
}
}
Called when the ContextManger is started |
public Object getInfo(Context ctx,
Request request,
int id,
String key) {
if( ! ( request instanceof Tomcat3Request ) )
return null;
Tomcat3Request httpReq=(Tomcat3Request)request;
if( httpReq == null || httpReq.getConnector() != this ) {
return null;
}
if(key!=null ){
org.apache.coyote.Request cReq = httpReq.getCoyoteRequest();
Object info = cReq.getAttribute(key);
if( info != null)
return info;
// XXX Should use MsgContext, pass the attribute we need.
// This will extract both
if(isSSLAttribute(key)) {
cReq.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE,
httpReq.getCoyoteRequest() );
// Only allowed a single cert under the 2.2 Spec.
Object [] value = (Object []) cReq.getAttribute(SSLSupport.CERTIFICATE_KEY);
if( value != null ) {
cReq.setAttribute(SSLSupport.CERTIFICATE_KEY, value[0]);
}
return cReq.getAttribute(key);
} else if(key.equals(REDIRECT_PORT_ATTR)) {
return new Integer(redirectPort);
}
return cReq.getAttribute( key );
}
return super.getInfo(ctx,request,id,key);
}
getInfo calls for SSL data |
public int getRedirectPort() {
return redirectPort;
}
|
public static boolean isSSLAttribute(String key) {
return SSLSupport.CIPHER_SUITE_KEY.equals(key) ||
SSLSupport.KEY_SIZE_KEY.equals(key) ||
SSLSupport.CERTIFICATE_KEY.equals(key) ||
SSLSupport.SESSION_ID_KEY.equals(key);
}
Check if a string is a reserved SSL attribute key. |
public int postRequest(Request request,
Response response) {
if(request instanceof Tomcat3Request) {
try {
Tomcat3Request httpReq=(Tomcat3Request)request;
org.apache.coyote.Request cReq = httpReq.getCoyoteRequest();
cReq.action( ActionCode.ACTION_POST_REQUEST , null);
} catch(Exception ex) {
log("Can't send ACK", ex);
}
}
return 0;
}
|
public int preService(Request request,
Response response) {
if(response instanceof Tomcat3Response) {
try {
((Tomcat3Response)response).sendAcknowledgement();
} catch(Exception ex) {
log("Can't send ACK", ex);
}
}
return 0;
}
Handle HTTP expectations. |
public void setAttribute(String prop,
Object value) {
attributes.put( translateAttributeName(prop), value );
}
|
public int setInfo(Context ctx,
Request request,
int id,
String key,
String object) {
if( ! ( request instanceof Tomcat3Request ) )
return DECLINED;
Tomcat3Request httpReq=(Tomcat3Request)request;
if(key!=null && httpReq!=null ){
org.apache.coyote.Request cReq = httpReq.getCoyoteRequest();
cReq.setAttribute(key, object);
return OK;
}
return super.setInfo(ctx, request, id, key, object);
}
|
public void setProcessorClassName(String pcn) {
processorClassName = pcn;
}
Set the class of the processor to use. |
public void setProperty(String prop,
String value) {
setAttribute( prop, value );
}
|
public void setRedirectPort(int rp) {
redirectPort = rp;
setAttribute("redirectPort", new Integer(rp));
}
|