Java 类org.springframework.security.web.PortMapperImpl 实例源码

项目:onetwo    文件:AjaxSupportedAuthenticationEntryPoint.java   
@Override
public void afterPropertiesSet() throws Exception {
    if(defaultAuthenticationEntryPoint==null){
        LoginUrlAuthenticationEntryPoint entryPoint = new LoginUrlAuthenticationEntryPoint(securityConfig.getLoginUrl());
        entryPoint.setForceHttps(forceHttps);
        entryPoint.setPortMapper(new PortMapperImpl(){
            public Integer lookupHttpsPort(Integer httpPort) {
                Integer port = super.lookupHttpsPort(httpPort);
                return port==null?httpsPort:port;
            }
        });
        PropertyAccessorFactory.forDirectFieldAccess(entryPoint).setPropertyValue("redirectStrategy.contextRelative", contextRelative);
        this.defaultAuthenticationEntryPoint = entryPoint;
    }
}