Examples of UrlMatcher


Examples of ch.entwine.weblounge.common.url.UrlMatcher

    // Nothing is in the cache, let's see if this is simply the first time
    // that this action is being called
    int maxMatchLength = 0;
    for (Entry<UrlMatcher, ActionPool> entry : actions.entrySet()) {
      UrlMatcher matcher = entry.getKey();
      if (matcher.matches(url, flavor)) {
        ActionPool pool = entry.getValue();
        int matchLength = matcher.getMountpoint().length();
        if (matchLength > maxMatchLength) {
          maxMatchLength = matchLength;
          actionPool = pool;
        }
      }
View Full Code Here

Examples of ch.entwine.weblounge.common.url.UrlMatcher

  public void register(Action action) {
    if (action == null)
      throw new IllegalArgumentException("Action configuration cannot be null");

    // Create a url matcher
    UrlMatcher matcher = new UrlMatcherImpl(action);
    ActionPool pool = new ActionPool(action);
    StringBuffer registration = new StringBuffer(new WebUrlImpl(action.getSite(), action.getPath()).normalize());

    // Register the action
    synchronized (actions) {
View Full Code Here

Examples of ch.entwine.weblounge.common.url.UrlMatcher

  public boolean unregister(Action action) {
    ActionPool pool = null;

    // Remove the pool from the actions registry
    synchronized (actions) {
      UrlMatcher matcher = new UrlMatcherImpl(action);
      pool = actions.remove(matcher);
      if (pool == null) {
        logger.warn("Tried to unregister unknown action '{}'", action);
        return false;
      }
View Full Code Here

Examples of com.google.common.labs.matcher.UrlMatcher

   * @param includePatterns
   * @param excludePatterns
   */
  public FilePatternMatcher(Iterable<String> includePatterns,
          Iterable<String> excludePatterns) {
    include = new UrlMatcher(false /* disable cache */);

    addPatterns(include, includePatterns);

    exclude = new UrlMatcher(false /* disable cache */);
    addPatterns(exclude, excludePatterns);
  }
View Full Code Here

Examples of net.sf.regain.crawler.config.UrlMatcher

    if ((! alreadyAccepted) && (! alreadyIgnored)) {
      // Check whether the url matches an entry in the whitelist and not an entry in the blacklist
      // We assume that the caller of addJob() detected the correct values for shouldBeParsed
      // and shouldBeIndexed.
      UrlMatcher urlMatch = mUrlChecker.isUrlAccepted(url);
      boolean accepted;
      if( urlMatch.getShouldBeParsed() || urlMatch.getShouldBeIndexed() )
        accepted = true;
      else
        accepted = false;
     
      int mMaxCycleCount = mConfiguration.getMaxCycleCount();
View Full Code Here

Examples of net.sf.regain.crawler.config.UrlMatcher

    if( rawDocument.hasLinks() ){
      // Iterate over all found links in the document
      for (Iterator iter = rawDocument.getLinks().entrySet().iterator(); iter.hasNext();){
        Map.Entry entry = (Map.Entry)iter.next();
        // The intention of this call is only to determine the link-extraction and indexing property
        UrlMatcher urlMatch = mUrlChecker.isUrlAccepted((String)entry.getKey());
        // Add the job
        addJob((String)entry.getKey(), rawDocument.getUrl(),
          urlMatch.getShouldBeParsed(), urlMatch.getShouldBeIndexed(), (String)entry.getValue());
      }
    }
  }
View Full Code Here

Examples of net.sf.regain.crawler.config.UrlMatcher

   * @param url Die zu prüfende URL.
   * @return Ob die URL von der Schwarzen und Weißen Liste akzeptiert wird.
   */
  public UrlMatcher isUrlAccepted(String url) {
   
    UrlMatcher urlMatchResult = new UrlMatcherResult(false, false);
    mLog.debug("isUrlAccepted for url: " + url);
    // check whether this URL matches to a white list prefix
    for (int i = 0; i < mWhiteListEntryArr.length; i++) {
      if (mWhiteListEntryArr[i].shouldBeUpdated()) {
        UrlMatcher matcher = mWhiteListEntryArr[i].getUrlMatcher();
        if (matcher.matches(url)) {
          // get the values for link extraction and indexing
          // from the current matcher hit
          urlMatchResult.setShouldBeParsed(matcher.getShouldBeParsed());
          urlMatchResult.setShouldBeIndexed(matcher.getShouldBeIndexed());
          mLog.debug("Whitelist matches for url: " + url);
          break;
        }
      }
    }
View Full Code Here

Examples of net.sf.regain.crawler.config.UrlMatcher

    if (url.startsWith("file://")) {
      // This is a file URL -> We have no information whether this file exists
      // since we didn't remember whether it was accepted or not.
     
      // Check whether the url is accepted by the white and black list
      UrlMatcher urlMatch = isUrlAccepted(url);
      if (! urlMatch.getShouldBeIndexed() ) {
        // This file is not accepted -> Remove it from the index
        return false;
      }
     
      // Check whether the file exists
View Full Code Here

Examples of org.expressme.webwind.UrlMatcher

public class UrlMatcherTest {

    @Test
    public void testMatchRoot() {
        UrlMatcher m = new UrlMatcher("/");
        assertEquals(0, m.orders.length);
        assertArrayEquals(toArray(), m.getMatchedParameters("/"));
        assertNull(m.getMatchedParameters(""));
        assertNull(m.getMatchedParameters("//"));
        assertNull(m.getMatchedParameters("/abc"));
    }
View Full Code Here

Examples of org.expressme.webwind.UrlMatcher

        assertNull(m.getMatchedParameters("/abc"));
    }

    @Test
    public void testMatch1Parameter() {
        UrlMatcher m = new UrlMatcher("/abc/$1/xyz");
        assertEquals(1, m.orders.length);
        assertEquals(0, m.orders[0]);
        // matched url:
        assertArrayEquals(toArray("123"), m.getMatchedParameters("/abc/123/xyz"));
        assertArrayEquals(toArray("QQQ"), m.getMatchedParameters("/abc/QQQ/xyz"));
        assertArrayEquals(toArray("---"), m.getMatchedParameters("/abc/---/xyz"));
        assertArrayEquals(toArray(""), m.getMatchedParameters("/abc//xyz"));
        // not matched url:
        assertNull(m.getMatchedParameters("/"));
        assertNull(m.getMatchedParameters("/abc/xyz"));
        assertNull(m.getMatchedParameters("/abc/123/"));
        assertNull(m.getMatchedParameters("/123/xyz"));
        assertNull(m.getMatchedParameters("/abc/123/xyz/"));
        assertNull(m.getMatchedParameters("/abc//---//xyz"));
        assertNull(m.getMatchedParameters("/abc/---//xyz"));
        assertNull(m.getMatchedParameters("/abc//---/xyz"));
    }
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.