source: nutchez-0.1/tomcat/webapps/ROOT/text.jsp @ 98

Last change on this file since 98 was 66, checked in by waue, 16 years ago

NutchEz - an easy way to nutch

File size: 2.3 KB
Line 
1<%--
2  Licensed to the Apache Software Foundation (ASF) under one or more
3  contributor license agreements.  See the NOTICE file distributed with
4  this work for additional information regarding copyright ownership.
5  The ASF licenses this file to You under the Apache License, Version 2.0
6  (the "License"); you may not use this file except in compliance with
7  the License.  You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16--%>
17<%@ page
18  session="false"
19
20  import="java.io.*"
21  import="java.util.*"
22
23  import="org.apache.nutch.searcher.*"
24  import="org.apache.nutch.parse.ParseText"
25  import="org.apache.hadoop.conf.Configuration"
26  import="org.apache.nutch.util.NutchConfiguration"
27
28%><%
29
30  // show the content of a hit as plain text
31  Configuration nutchConf = NutchConfiguration.get(application);
32  NutchBean bean = NutchBean.get(application, nutchConf);
33
34  bean.LOG.info("text request from " + request.getRemoteAddr());
35
36  Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),
37                    Integer.parseInt(request.getParameter("id")));
38  HitDetails details = bean.getDetails(hit);
39
40  String text = bean.getParseText(details).getText();
41  if (text.trim().equals(""))
42    text = null;
43
44  // 20041005, xing
45  // This "CharEncodingForConversion" thing is only pertinent to
46  // html parser (plugin parse-html) in current nutch. None of
47  // other parser plugins are into it. So we worry it later.
48
49%><base href="<%=details.getValue("url")%>">
50<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
51<%
52  out.flush();
53%>
54
55<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n" prefix="i18n" %>
56<i18n:bundle baseName="org.nutch.jsp.text"/>
57<h2 style="{color: rgb(255, 153, 0)}"><i18n:message key="title"/></h2>
58
59<i18n:message key="note">
60  <i18n:messageArg value="<%=details.getValue("url")%>"/>
61</i18n:message>
62
63<hr>
64
65<% if (text != null) {%>
66<pre>
67<%= text %>
68</pre>
69<% } else { %>
70<i18n:message key="noText"/>
71<% } %>
Note: See TracBrowser for help on using the repository browser.