KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > admingui > servlet > HelpWindowFilter


1 /*
2  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  * Use is subject to license terms.
4  */

5
6 package com.sun.enterprise.tools.admingui.servlet;
7
8 import java.io.*;
9 import javax.servlet.*;
10 import javax.servlet.http.*;
11 import java.security.NoSuchAlgorithmException JavaDoc;
12 import java.security.KeyManagementException JavaDoc;
13
14 import com.sun.enterprise.tools.admingui.util.JSSE;
15
16 public final class HelpWindowFilter implements Filter {
17
18       private FilterConfig filterConfig = null;
19
20       public void init(FilterConfig filterConfig) throws ServletException {
21           this.filterConfig = filterConfig;
22       }
23     
24       public void destroy() {
25           this.filterConfig = null;
26       }
27       public void doFilter(ServletRequest request, ServletResponse response,
28                                FilterChain chain) throws IOException, ServletException {
29
30       if (filterConfig == null) {
31           return;
32     }
33       if(!request.isSecure()) {
34     chain.doFilter(request, response);
35     return;
36       }
37     try {
38         JSSE.trustAnyServerCertificate();
39     }
40     catch(KeyManagementException JavaDoc ex) {
41         //Ignore
42
ex.printStackTrace();
43     }
44     catch(NoSuchAlgorithmException JavaDoc ex) {
45         //Ignore
46
ex.printStackTrace();
47     }
48
49       chain.doFilter(request, response);
50     }
51
52 }
53
54
Popular Tags