SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 237 | Next

Larry Brown, Marty Hall, and Yaakov Chaikin

"Core Servlets and JavaServer Pages, Volume 2"

0 " +
"Transitional//EN\">\n";
String title = "Security Info";
out.println
(docType +
"\n" +
"" + title +<br>"\n" +
"\n" +
"

" + title + "

\n" +
"
    \n" +
    "
  • URL: " + currentURL + "\n" +
    "
  • Data: " + formData);
    boolean isSecure = request.isSecure();
    4.6 Example: Programmatic Security and SSL 199
    if (isSecure) {
    String keyAttribute =
    "javax.servlet.request.key_size";
    // Available only with servlets 2.3
    Integer keySize =
    (Integer)request.getAttribute(keyAttribute);
    String sizeString =
    replaceNull(keySize, "Unknown");
    String cipherAttribute =
    "javax.servlet.request.cipher_suite";
    // Available only with servlets 2.3
    String cipherSuite =
    (String)request.getAttribute(cipherAttribute);
    String cipherString =
    replaceNull(cipherSuite, "Unknown");
    String certAttribute =
    "javax.servlet.request.X509Certificate";
    // Available with servlets 2.2 and 2.3
    X509Certificate certificate =
    (X509Certificate)request.getAttribute(certAttribute);
    String certificateString =
    replaceNull(certificate, "None");
    out.println
    ("
  • SSL: true\n" +
    "
      \n" +
      "
    • Key Size: " + sizeString + "\n" +
      "
    • Cipher Suite: " + cipherString + "\n" +
      "
    • Client Certificate: " +
      certificateString + "\n" +
      "
    ");
    }
    out.println
    ("
\n" +
"");
}
}
// Given http://blah, return https://blah.
private String httpsURL(String origURL) {
int index = origURL.


Pages:
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249