Github user thammegowda commented on a diff in the pull request:

    https://github.com/apache/nutch/pull/89#discussion_r52835517
  
    --- Diff: 
src/plugin/urlfilter-ignoreexempt/src/java/org/apache/nutch/urlfilter/ignoreexempt/ExemptionUrlFilter.java
 ---
    @@ -0,0 +1,144 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nutch.urlfilter.ignoreexempt;
    +
    +import org.apache.commons.io.IOUtils;
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.nutch.net.URLExemptionFilter;
    +import org.apache.nutch.util.NutchConfiguration;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.util.Arrays;
    +import java.util.regex.Pattern;
    +import java.util.List;
    +import java.util.ArrayList;
    +
    +
    +/**
    + * This implementation of {@link org.apache.nutch.net.URLExemptionFilter} 
uses regex configuration
    + * to check if URL is eligible for exemption from 'db.ignore.external'.
    + * When this filter is enabled, urls will be checked against configured 
sequence of regex rules.
    + *<p>
    + * The exemption rule file defaults to db-ignore-external-exemptions.txt 
in the classpath but can be
    + * overridden using the property  
<code>"db.ignore.external.exemptions.file" in ./conf/nutch-*.xml</code>
    + *</p>
    + *
    + * The exemption rules are specified in plain text file where each line is 
a rule.
    + *
    + * When the url matches regex it is exempted from 
'db.ignore.external...'<br/>
    + * <h3>Examples:</h3>
    + * <ol>
    + *   <li>
    + *     <b>Exempt urls ending with .jpg or .png or gif</b>
    + *      <br/><code>.*\.(jpg|JPG|png$|PNG|gif|GIF)$</code><br/><br/>
    + *   </li>
    + * </ol>
    + </pre>
    + *
    + * @since Feb 10, 2016
    + * @version 1
    + * @see URLExemptionFilter
    + */
    +public class ExemptionUrlFilter implements URLExemptionFilter {
    +
    +  public static final String DB_IGNORE_EXTERNAL_EXEMPTIONS_FILE = 
"db.ignore.external.exemptions.file";
    +  private static final Logger LOG = 
LoggerFactory.getLogger(ExemptionUrlFilter.class);
    +  private static ExemptionUrlFilter INSTANCE;
    +
    +  private List<Pattern> exemptions;
    +  private Configuration conf;
    +  private boolean enabled;
    --- End diff --
    
    Will be removed.
    Thanks for pointing out.
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to