indexOf(":");
StringBuffer newURL = new StringBuffer(origURL);
newURL.insert(index, 's');
return(newURL.toString());
}
Listing 4.6 SecurityInfo.java (continued)
Chapter 4 ?– Programmatic Security 200
// If the first argument is null, return the second argument.
// Otherwise, convert first argument to a String and
// return that String.
private String replaceNull(Object obj, String fallback) {
if (obj == null) {
return(fallback);
} else {
return(obj.toString());
}
}
}
Listing 4.7 web.xml (from securityInfo Web app)
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
SecurityInfo
coreservlets.SecurityInfo
SecurityInfo
/securityInfo
Listing 4.6 SecurityInfo.java (continued)
4.6 Example: Programmatic Security and SSL 201
Figure 4??“6 New certificate page for Firefox. Examine and accept the certificate
permanently to suppress future warnings. For details on creating self-signed certificates for
use with Tomcat, see Section 3.7 (Signing a Server Certificate). Again, self-signed
certificates would not be trusted in real-world applications; they are for testing purposes
only.
Pages:
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250