Examples of UrlMatcher


Examples of org.springframework.security.web.util.UrlMatcher

            patternType = DEF_PATH_TYPE_ANT;
        }

        boolean useRegex = patternType.equals(OPT_PATH_TYPE_REGEX);

        UrlMatcher matcher = new AntUrlPathMatcher();

        if (useRegex) {
            matcher = new RegexUrlPathMatcher();
        }
View Full Code Here

Examples of org.springframework.security.web.util.UrlMatcher

import com.loc.security.MySecurityMetadataSource;

public class MyTest{
  //@Test
  public void run() throws Exception{
    UrlMatcher urlMatcher = new AntUrlPathMatcher();
    String url="/**";
    String resURL="/index.jsp";
    boolean b = urlMatcher.pathMatchesUrl(resURL, url);
    System.out.println(b);
  }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

    public static void registerRegistryUsagePersistingListener(RegistryContext registryContext)
            throws RegistryException {
        HandlerManager handlerManager = registryContext.getHandlerManager();
        RegistryUsagePersistingListener handler = new RegistryUsagePersistingListener();
        URLMatcher anyUrlMatcher = new URLMatcher();
        anyUrlMatcher.setPattern(".*");
        String[] applyingFilters = new String[]{
                Filter.PUT, Filter.IMPORT, Filter.GET, Filter.DUMP, Filter.RESTORE,};

        handlerManager.addHandlerWithPriority(applyingFilters, anyUrlMatcher, handler,
                HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

                        registry.getRegistryContext() == null ||
                        registry.getRegistryContext().getHandlerManager() == null) {
                    String msg = "Error Initializing DLCM Eventing Handler";
                    log.error(msg);
                } else {
                    URLMatcher filter = new URLMatcher();
                    filter.setPutPattern(".*");
                    filter.setInvokeAspectPattern(".*");
                    DLCMEventingHandler handler = new DLCMEventingHandler();
                    registry.getRegistryContext().getHandlerManager().addHandler(null, filter, handler);
                    handler.init(registry.getEventingServiceURL(null));
                    log.info("Successfully Initialized the DLCM Eventing Handler");
                }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

                        registry.getRegistryContext() == null ||
                        registry.getRegistryContext().getHandlerManager() == null) {
                    String msg = "Error Initializing Governance Eventing Handler";
                    log.error(msg);
                } else {
                    URLMatcher filter = new URLMatcher();
                    filter.setPutPattern(".*");
                    filter.setInvokeAspectPattern(".*");
                    GovernanceEventingHandler handler = new GovernanceEventingHandler();
                    registry.getRegistryContext().getHandlerManager().addHandler(null, filter,
                            handler, HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);
                    handler.init(registry.getEventingServiceURL(null));
                    log.debug("Successfully Initialized the Governance Eventing Handler");
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

     * @param path the path at which the mount was added.
     *
     * @return the built filter instance.
     */
    public static URLMatcher getMountingMatcher(String path) {
        URLMatcher matcher = new MountingMatcher();
        String matchedWith = Pattern.quote(path) + "($|" + RegistryConstants.PATH_SEPARATOR + ".*)";
        matcher.setPattern(matchedWith);
        return matcher;
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

            public void put(RequestContext requestContext) throws RegistryException {
                testData.setHandlerExecuted(true);
            }
        };

        URLMatcher filter = new URLMatcher();
        filter.setPattern(".*");

        CurrentSession.setCallerTenantId(0);
        try {
            registry.getRegistryContext().getHandlerManager().addHandler(null, filter, handler,
                    HandlerLifecycleManager.COMMIT_HANDLER_PHASE);
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

            public void put(RequestContext requestContext) throws RegistryException {
                throw new RegistryException("Sample Test Failure");
            }
        };

        URLMatcher filter = new URLMatcher();
        filter.setPattern(".*");

        registry.getRegistryContext().getHandlerManager().addHandler(null, filter, handler1);

        filter = new URLMatcher();
        filter.setPattern(".*");

        CurrentSession.setCallerTenantId(0);
        try {
            registry.getRegistryContext().getHandlerManager().addHandler(null, filter, handler,
                    HandlerLifecycleManager.ROLLBACK_HANDLER_PHASE);
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

        RegistryContext registryContext = adminRegistry.getRegistryContext();
        MyPrivateHandler myPrivateHandler = new MyPrivateHandler();

        HandlerManager handlerManager = registryContext.getHandlerManager();

        URLMatcher myPrivateHandlerMatcher = new URLMatcher();
        myPrivateHandlerMatcher.setGetPattern(".*/to/my/private/handler");
        myPrivateHandlerMatcher.setPutPattern(".*/to/my/private/handler");
        handlerManager.addHandler(
                new String[] {Filter.GET, Filter.PUT} , myPrivateHandlerMatcher, myPrivateHandler);

        Resource r = adminRegistry.newResource();
        String originalContent = "original content";
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Operation Statistics Handler.");
        }
        // handler to record system statistics
        OperationStatisticsHandler systemStatisticsHandler = new OperationStatisticsHandler();
        URLMatcher systemStatisticsURLMatcher = new URLMatcher();
        systemStatisticsURLMatcher.setPattern(".*");
        handlerManager.addHandler(null, systemStatisticsURLMatcher, systemStatisticsHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Comment URL Handler.");
        }
        // this handler will return the comment for a path ending as ;comments:<number>
        CommentURLHandler commentURLHandler = new CommentURLHandler();
        URLMatcher commentURLMatcher = new URLMatcher();
        commentURLMatcher.setGetPattern(".+;comments:[0-9]+");
        commentURLMatcher.setDeletePattern(".+;comments:[0-9]+");
        handlerManager.addHandler(
                new String[]{Filter.GET, Filter.DELETE}, commentURLMatcher, commentURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Comment Collection URL Handler.");
        }
        // this will return all the comments for the path if the path ending as ;comments
        CommentCollectionURLHandler commentCollectionURLHandler = new CommentCollectionURLHandler();
        URLMatcher commentCollectionURLMatcher = new URLMatcher();
        commentCollectionURLMatcher.setGetPattern(".+;comments");
        handlerManager.addHandler(new String[]{Filter.GET},
                commentCollectionURLMatcher, commentCollectionURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Rating URL Handler.");
        }
        // this will return the rating of a user if the path is ending as ;ratings:<username>
        RatingURLHandler ratingURLHandler = new RatingURLHandler();
        URLMatcher ratingURLMatcher = new URLMatcher();
        ratingURLMatcher.setGetPattern(".+;ratings:.+");
        handlerManager.addHandler(new String[]{Filter.GET}, ratingURLMatcher, ratingURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Rating Collection URL Handler.");
        }
        // this will return all the ratings for a path if the path is ending as ;ratings
        RatingCollectionURLHandler ratingCollectionURLHandler = new RatingCollectionURLHandler();
        URLMatcher ratingCollectionURLMatcher = new URLMatcher();
        ratingCollectionURLMatcher.setGetPattern(".+;ratings");
        handlerManager.addHandler(
                new String[]{Filter.GET}, ratingCollectionURLMatcher, ratingCollectionURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Tag URL Handler.");
        }
        // this will return the tags for a path  if the path is ending as
        // ;tags:<tag-name>:<user-name>
        TagURLHandler tagURLHandler = new TagURLHandler();
        URLMatcher tagURLMatcher = new URLMatcher();
        tagURLMatcher.setGetPattern(".+;.+:.+:.+");
        handlerManager.addHandler(new String[]{Filter.GET}, tagURLMatcher, tagURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the SQL Query Handler.");
        }
        // this will return the results for a custom query if the resource has the
        // media type:SQL_QUERY_MEDIA_TYPE
        SQLQueryHandler sqlQueryHandler = new SQLQueryHandler();
        MediaTypeMatcher sqlMediaTypeMatcher =
                new MediaTypeMatcher(RegistryConstants.SQL_QUERY_MEDIA_TYPE);
        handlerManager.addHandler(
                new String[]{Filter.GET, Filter.PUT}, sqlMediaTypeMatcher, sqlQueryHandler);

        // Register Simulation Handler
        handlerManager.addHandler(null, new SimulationFilter(), new SimulationHandler(),
                HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Cashing Registry Handler.");
        }
        // handler to cache registry operation results.
        CachingHandler cachingHandler = new CachingHandler();
        URLMatcher cachingURLMatcher = new URLMatcher();
        cachingURLMatcher.setPattern(".*");

        handlerManager.addHandler(null, cachingURLMatcher, cachingHandler);
        handlerManager.addHandler(null, cachingURLMatcher, cachingHandler,
                HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the RegexBase Restriction Handler.");
        }
        // handler to validate registry root's immediate directory paths prior to move and rename operations
        Handler regexBaseRestrictionHandler =  new RegexBaseRestrictionHandler();
        URLMatcher logUrlMatcher = new URLMatcher();
        logUrlMatcher.setPattern(".*");

        handlerManager.addHandler(new String[] {Filter.RENAME, Filter.MOVE}, logUrlMatcher, regexBaseRestrictionHandler,
                HandlerLifecycleManager.DEFAULT_SYSTEM_HANDLER_PHASE);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.