WebObjects/Web 应用程序/开发/SSL
外观
用于检测 SSL 是否对当前请求有效的代码:据我所知,此代码无法与 IIS 配合使用
// Is this page being accessed securely? boolean secureMode = false; String header = context.request().headerForKey("https"); if( header == null ) { log.debug( "no https header, looking for server_port" ); header = context.request().headerForKey( "server_port" ); if( header == null ) { log.debug( "no server_port header found, assuming insecure connection" ); } else { log.debug( "server_port header found, using it" ); secureMode = header.equals( "443" ); } } else { log.debug( "https header found, using it" ); secureMode = header.equals( "on" ); } log.debug( "secure mode set to " + secureMode );