anchor.diff:    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.
  ---%><%@ page import="org.apache.jackrabbit.j2ee.RepositoryAccessServlet,
  -                 org.apache.jackrabbit.util.Text,
  -                 javax.jcr.Node,
  -                 javax.jcr.Repository,
  -                   javax.jcr.Session,
  -                   javax.jcr.SimpleCredentials,
  -                   javax.swing.text.AttributeSet,
  -                   javax.swing.text.html.HTML,
  -                   javax.swing.text.html.HTMLDocument,
  -                   javax.swing.text.html.HTMLEditorKit,
  -                   java.io.FilterInputStream,
  -                   java.io.IOException,
  -                   java.io.InputStream,
  -                   java.io.InputStreamReader,
  -                   java.net.URL,
  -                   java.net.URLConnection,
  -                   java.net.URLDecoder,
  -                   java.net.URLEncoder,
  -                   java.util.ArrayList,
  -                   java.util.Arrays,
  -                   java.util.Calendar,
  -                   java.util.Collections,
  -                   java.util.Iterator,
  -                   java.util.List"
  +--%><%@ page import="java.io.FilterInputStream,
  +                     java.io.IOException,
  +                     java.io.InputStream,
  +                     java.io.InputStreamReader,
  +                     java.net.URL,
  +                     java.net.URLConnection,
  +                     java.net.URLDecoder,
  +                     java.net.URLEncoder,
  +                     java.util.ArrayList,
  +                     java.util.Arrays,
  +                     java.util.Calendar,
  +                     java.util.Collections,
  +                     java.util.Iterator,
  +                     java.util.List,
  +                     javax.jcr.Node,
  +                     javax.jcr.Repository,
  +                     javax.jcr.Session,
  +                     javax.jcr.SimpleCredentials,
  +                     javax.swing.text.AttributeSet,
  +                     javax.swing.text.html.HTML,
  +                     javax.swing.text.html.HTMLDocument,
  +                     javax.swing.text.html.HTMLEditorKit,
  +                     org.apache.jackrabbit.j2ee.RepositoryAccessServlet,
  +                     org.apache.jackrabbit.util.Text"
    %><%@ page contentType="text/html;charset=UTF-8" %><%
       Repository rep;
       Session jcrSession;
  
positive.code:                                     try {
                                          String info = fileName + " (" + host + ")";
                                          URLConnection con = currentURL.openConnection();
                                          con.setReadTimeout(10000); // 10 seconds
                                          InputStream in = con.getInputStream();
                                          try {
                                              synchronized (fOut) {
  
negative.code:             this.start = start;
          }
  
          public URL[] getURLs() throws Exception {
              List urls = new ArrayList();
              String query = term + " filetype:" + filetype;
              URL google = new URL("http://www.google.com/search?q=" +
                      URLEncoder.encode(query, "UTF-8") + "&start=" + start);
              URLConnection con = google.openConnection();
              con.setRequestProperty("User-Agent", "");
              InputStream in = con.getInputStream();
              try {
                  HTMLEditorKit kit = new HTMLEditorKit();
                  HTMLDocument doc = new HTMLDocument();
                  doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
                  kit.read(new InputStreamReader(in, "UTF-8"), doc, 0);
                  HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
                  while (it.isValid()) {
                      AttributeSet attr = it.getAttributes();
                      if (attr != null) {
                          String href = (String) attr.getAttribute(HTML.Attribute.HREF);
                          if (href != null && href.endsWith("." + filetype)) {
                              URL url = new URL(new URL("http", "www.google.com", "dummy"), href);
                              if (url.getHost().indexOf("google") == -1) {
                                  urls.add(url);
                              }
                          }
                      }
                      it.next();
                  }
              } finally {
                  in.close();
              }
              return (URL[]) urls.toArray(new URL[urls.size()]);
          }
      }
  
  