Revision 1599
Added by Jing Tao over 21 years ago
src/edu/ucsb/nceas/metacat/MetacatReplication.java | ||
---|---|---|
51 | 51 |
*/ |
52 | 52 |
public void init(ServletConfig config) throws ServletException |
53 | 53 |
{ |
54 |
//initialize db connections to handle any update requests |
|
54 |
//initialize db connections to handle any update requests
|
|
55 | 55 |
MetaCatUtil util = new MetaCatUtil(); |
56 | 56 |
deltaT = util.getOption("deltaT"); |
57 | 57 |
//the default deltaT can be set from metacat.properties |
58 | 58 |
//create a thread to do the delta-T check but don't execute it yet |
59 | 59 |
replicationDaemon = new Timer(true); |
60 |
java.net.URL.setURLStreamHandlerFactory( |
|
61 |
new java.net.URLStreamHandlerFactory() |
|
62 |
{ |
|
63 |
public java.net.URLStreamHandler createURLStreamHandler( |
|
64 |
final String protocol) |
|
65 |
{ |
|
66 |
if ("http".equals(protocol)) |
|
67 |
{ |
|
68 |
try |
|
69 |
{ |
|
70 |
URLStreamHandler urlsh = new HTTPClient.http.Handler(); |
|
71 |
MetaCatUtil.debugMessage("Using HttpClient Protocol Handler for http", 45); |
|
72 |
return urlsh; |
|
73 |
} |
|
74 |
catch (Exception e) |
|
75 |
{ |
|
76 |
MetaCatUtil.debugMessage( |
|
77 |
"Error setting URL StreamHandler!", 30); |
|
78 |
return null; |
|
79 |
} |
|
80 |
}//if |
|
81 |
else if ("https".equals(protocol)) |
|
82 |
{ |
|
83 |
try |
|
84 |
{ |
|
85 |
URLStreamHandler urlsh = new HTTPClient.https.Handler(); |
|
86 |
MetaCatUtil.debugMessage("Using HttpClient Protocol Handler for https", 45); |
|
87 |
return urlsh; |
|
88 |
} |
|
89 |
catch (Exception e) |
|
90 |
{ |
|
91 |
MetaCatUtil.debugMessage( |
|
92 |
"Error setting URL StreamHandler!", 30); |
|
93 |
return null; |
|
94 |
} |
|
95 |
} |
|
96 |
return null; |
|
97 |
}//createURLStreamHandler |
|
98 |
}); |
|
99 |
|
|
60 | 100 |
} |
61 | 101 |
|
62 | 102 |
public void destroy() |
Also available in: Unified diff
Using httpclient as http and https protocol handler.