ProxyConfigImpl.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:OpenSDI-Manager2 作者:
/**
 * Reload proxy configuration reading {@link ProxyConfigImpl#locations}
 */
public void reloadProxyConfig() {
    if (locations != null) {
        for (Resource location : locations) {
            try {
                if (location.exists()) {
                    trackLocation(location);
                } else {
                    // Try to load from file system:
                    String path = null;
                    if (location instanceof ClassPathResource) {
                        // This instance is running without web context
                        path = ((ClassPathResource) location).getPath();
                    } else if (location instanceof ServletContextResource) {
                        // This instance is running in a web context
                        path = ((ServletContextResource) location)
                                .getPath();
                    }
                    if (path != null) {
                        Resource alternative = new UrlResource("file:/"
                                + path);
                        if (alternative.exists()) {
                            trackLocation(alternative);
                        }
                    }
                }
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE,
                        "Error overriding the proxy configuration ", e);
            }
        }
    } else {
        LOGGER.log(Level.SEVERE,
                "Can't observe locations for proxy configuration");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号