source: nutchez-0.1/tomcat/webapps/ROOT/explain.jsp @ 66

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