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

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

Introduction

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

Prototype

String getMethod() 

Source Link

Usage

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

/**
 * Reloading authority mapping information of secured resources
 *
 * @throws Exception//w ww.j a  va2  s .  co  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);
        }
    }
}