Example usage for org.springframework.security.web.access.intercept RequestKey getUrl

List of usage examples for org.springframework.security.web.access.intercept RequestKey getUrl

Introduction

In this page you can find the example usage for org.springframework.security.web.access.intercept RequestKey getUrl.

Prototype

String getUrl() 

Source Link

Usage

From source file:org.springframework.security.web.access.intercept.AnyframeReloadableDefaultFilterInvocationSecurityMetadataSource.java

/**
 * Reloading authority mapping information of secured resources
 *
 * @throws Exception//from  w w  w . java  2 s . c  o m
 */
public void reloadRequestMap() throws Exception {

    try {
        Map reloadedMap = securedObjectService.getRolesAndUrl();

        Iterator iterator = reloadedMap.entrySet().iterator();

        // ? ?? 
        Map mapToUse = getRequestMapForHttpMethod(null);
        mapToUse.clear();

        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator.next();
            RequestKey reqKey = (RequestKey) entry.getKey();
            addSecureUrl(reqKey.getUrl(), reqKey.getMethod(), (List<ConfigAttribute>) entry.getValue());
        }

        if (logger.isInfoEnabled()) {
            logger.info("Secured Url Resources - Role Mappings reloaded at Runtime!");
        }

    } catch (Exception e) {
        logger.error(getMessageSource().getMessage(
                "[SecuredObject Service] SecuredObject Service [" + "Reload RequestMap"
                        + "]: Fail to get SecuredObject Data from Database.",
                new Object[] {}, Locale.getDefault()), e);
        if (e instanceof BaseException) {
            throw (BaseException) e;
        } else {
            throw new BaseException(getMessageSource(), "[SecuredObject Service] SecuredObject Service ["
                    + e.getMessage() + "]: Fail to get SecuredObject Data from Database.", new Object[] {}, e);
        }
    }
}