source: nutchez-0.1/tomcat/webapps/ROOT/anchors.jsp @ 224

Last change on this file since 224 was 66, checked in by waue, 15 years ago

NutchEz - an easy way to nutch

File size: 3.0 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  contentType="text/html; charset=UTF-8"
20  pageEncoding="UTF-8"
21
22  import="java.io.*"
23  import="java.util.*"
24
25  import="org.apache.nutch.html.Entities"
26  import="org.apache.nutch.searcher.*"
27  import="org.apache.hadoop.conf.Configuration"
28  import="org.apache.nutch.util.NutchConfiguration"
29%><%
30  Configuration nutchConf = NutchConfiguration.get(application);
31  NutchBean bean = NutchBean.get(application, nutchConf);
32  // set the character encoding to use when interpreting request values
33  request.setCharacterEncoding("UTF-8");
34  bean.LOG.info("anchors request from " + request.getRemoteAddr());
35  Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),
36                    request.getParameter("id"));
37  HitDetails details = bean.getDetails(hit);
38  String language =
39    ResourceBundle.getBundle("org.nutch.jsp.anchors", request.getLocale())
40    .getLocale().getLanguage();
41  String requestURI = HttpUtils.getRequestURL(request).toString();
42  String base = requestURI.substring(0, requestURI.lastIndexOf('/'));
43%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
44<%
45  // To prevent the character encoding declared with 'contentType' page
46  // directive from being overriden by JSTL (apache i18n), we freeze it
47  // by flushing the output buffer.
48  // see http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/
49  out.flush();
50%>
51<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n" prefix="i18n" %>
52<i18n:bundle baseName="org.nutch.jsp.anchors"/>
53<html lang="<%= language %>">
54<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
55<head>
56<title>Nutch: <i18n:message key="title"/></title>
57<jsp:include page="/include/style.html"/>
58<base href="<%= base + "/" + language + "/" %>">
59</head>
60
61<body>
62
63<jsp:include page="<%= language + \"/include/header.html\"%>"/>
64
65<h3>
66<i18n:message key="page">
67  <i18n:messageArg value="<%=details.getValue(\"url\")%>"/>
68</i18n:message>
69</h3>
70
71<h3><i18n:message key="anchors"/></h3>
72
73<ul>
74<%
75  String[] anchors = bean.getAnchors(details);
76  if (anchors != null) {
77    for (int i = 0; i < anchors.length; i++) {
78%><li><%=Entities.encode(anchors[i])%>
79<%   } %>
80<% } %>
81</ul>
82     
83<jsp:include page="/include/footer.html"/>
84
85</body>     
86</html>
Note: See TracBrowser for help on using the repository browser.