Examples of URLHandler


Examples of org.apache.ivy.util.url.URLHandler

        assertTrue(resolver instanceof IvyRepResolver);
    }

    private void configureURLHandler() {
        URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
        URLHandler httpHandler = URLHandlerRegistry.getHttp();
        dispatcher.setDownloader("http", httpHandler);
        dispatcher.setDownloader("https", httpHandler);
        URLHandlerRegistry.setDefault(dispatcher);
    }
View Full Code Here

Examples of org.apache.ivy.util.url.URLHandler

    private void configureURLHandler() {
        // TODO : the credentialStore should also be scoped
        CredentialsStore.INSTANCE.addCredentials(getRealm(), getHost(), getUsername(), getPasswd());

        URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
        URLHandler httpHandler = URLHandlerRegistry.getHttp();
        dispatcher.setDownloader("http", httpHandler);
        dispatcher.setDownloader("https", httpHandler);
        URLHandlerRegistry.setDefault(dispatcher);
    }
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

     * @param uri
     * @return
     */
    @Override
    public URLHandler findURLHandlerByURI(String uri) {
        URLHandler urlHandler = lookupHandlerFromCache(uri);
        if (urlHandler instanceof NullURLHandler) {
            return null;
        } else {
            return urlHandler;
        }              
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        }      
        return key;
    }
   
    protected URLHandler checkForMatches(String requestURI) {
        URLHandler currentHandler = null;
        try {
            List<URLHandler> urlHandlers = findAllURLHandlers();
            for (URLHandler urlHandler : urlHandlers) {
                currentHandler = urlHandler;
                String incomingUrl = currentHandler.getIncomingURL();
                if (!incomingUrl.startsWith("^")) {
                    if (incomingUrl.startsWith("/")) {
                        incomingUrl = "^" + incomingUrl + "$";
                    } else {
                        incomingUrl = "^/" + incomingUrl + "$";
                    }
                }

                Pattern p = urlPatternMap.get(incomingUrl);
                if (p == null) {
                    p = Pattern.compile(incomingUrl);
                    urlPatternMap.put(incomingUrl, p);
                }
                Matcher m = p.matcher(requestURI);
                if (m.find()) {
                    String newUrl = m.replaceFirst(urlHandler.getNewURL());
                    if (newUrl.equals(urlHandler.getNewURL())) {
                        return urlHandler;
                    } else {
                        return new URLHandlerDTO(newUrl, urlHandler.getUrlRedirectType());
                    }
                }

            }
        } catch (RuntimeException re) {
            if (currentHandler != null) {
                // We don't want an invalid regex to cause tons of logging               
                if (LOG.isWarnEnabled()) {
                    LOG.warn("Error parsing URL Handler (incoming =" + currentHandler.getIncomingURL() + "), outgoing = ( "
                            + currentHandler.getNewURL() + "), " + requestURI);
                }
            }
        }

View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        statisticsService.addCacheStat(CacheStatType.URL_HANDLER_CACHE_HIT_RATE.toString(), false);
        return null;
    }

    protected URLHandler findURLHandlerByURIInternal(String uri) {
        URLHandler urlHandler = urlHandlerDao.findURLHandlerByURI(uri);
        if (urlHandler != null) {
            return urlHandler;
        }
        return null;
    }
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        if (request.getContextPath() != null) {
            requestURIWithoutContext = request.getRequestURI().substring(request.getContextPath().length());
        } else {
            requestURIWithoutContext = request.getRequestURI();
        }
        URLHandler handler = urlHandlerService.findURLHandlerByURI(requestURIWithoutContext);
       
        if (handler != null) {
            if (URLRedirectType.FORWARD == handler.getUrlRedirectType()) {             
                request.getRequestDispatcher(handler.getNewURL()).forward(request, response);              
            } else if (URLRedirectType.REDIRECT_PERM == handler.getUrlRedirectType()) {
                String url = UrlUtil.fixRedirectUrl(contextPath, handler.getNewURL());
                url = fixQueryString(request, url);
                response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
                response.setHeader( "Location", url);
                response.setHeader( "Connection", "close" );
            } else if (URLRedirectType.REDIRECT_TEMP == handler.getUrlRedirectType()) {
                String url = UrlUtil.fixRedirectUrl(contextPath, handler.getNewURL());
                url = fixQueryString(request, url);
                response.sendRedirect(url);            
            }          
        } else {
            filterChain.doFilter(request, response);
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        EasyMock.replay(handlerDao);
    }

    @Test
    public void testFoundSimpleUrl() {
        URLHandler h = handlerService.checkForMatches("/simple_url");
        assertTrue(h.getNewURL().equals("/NewSimpleUrl"));
    }
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        assertTrue(h.getNewURL().equals("/NewSimpleUrl"));
    }

    @Test
    public void testFoundRegExUrl() {
        URLHandler h = handlerService.checkForMatches("/simple_regex");
        assertTrue(h.getNewURL().equals("/NewSimpleRegex"));
    }
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        assertTrue(h.getNewURL().equals("/NewSimpleRegex"));
    }

    @Test
    public void testForSubPackageBadMatchSimpleUrl() {
        URLHandler h = handlerService.checkForMatches("/simple_url/test");
        assertTrue(h == null);
    }
View Full Code Here

Examples of org.broadleafcommerce.cms.url.domain.URLHandler

        assertTrue(h == null);
    }

    @Test
    public void testFoundBadMatchComplexUrl() {
        URLHandler h = handlerService.checkForMatches("/simple_regex/test");
        assertTrue(h == null);
    }
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.