Update of /cvsroot/nutch/nutch/src/web/jsp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6372/src/web/jsp

Modified Files:
        more.jsp 
Added Files:
        text.jsp 
Log Message:
Added codes to provide "View as Plain Text" feature.


--- NEW FILE: text.jsp ---
<%@ page

  import="javax.servlet.*"
  import="javax.servlet.http.*"
  import="java.io.*"
  import="java.util.*"

  import="net.nutch.searcher.*"
  import="net.nutch.parse.ParseText"

%><%

  // show the content of a hit as plain text

  NutchBean bean = NutchBean.get(application);

  bean.LOG.info("text request from " + request.getRemoteAddr());

  Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),
                    Integer.parseInt(request.getParameter("id")), 0.0f, null);
  HitDetails details = bean.getDetails(hit);

  String text = bean.getParseText(details).getText();
  if (text.trim().equals(""))
    text = null;

  // 20041005, xing
  // This "CharEncodingForConversion" thing is only pertinent to
  // html parser (plugin parse-html) in current nutch. None of
  // other parser plugins are into it. So we worry it later.

%><base href="<%=details.getValue("url")%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%
  out.flush();
%>

<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n"; prefix="i18n" %>
<i18n:bundle baseName="org.nutch.jsp.text"/>
<h2 style="{color: rgb(255, 153, 0)}"><i18n:message key="title"/></h2>

<i18n:message key="note">
  <i18n:messageArg value="<%=details.getValue("url")%>"/>
</i18n:message>

<hr>

<% if (text != null) {%>
<pre>
<%= text %>
</pre>
<% } else { %>
<i18n:message key="noText"/>
<% } %>

Index: more.jsp
===================================================================
RCS file: /cvsroot/nutch/nutch/src/web/jsp/more.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** more.jsp    3 Oct 2004 22:23:31 -0000       1.1
--- more.jsp    7 Oct 2004 04:24:53 -0000       1.2
***************
*** 44,48 ****
  %>
  
! <% if (showMore) { %>
      <br><font size=-1><nobr><%=contentType%> <%=contentLength%> 
<%=lastModified%></nobr></font>
! <%  } %>
--- 44,52 ----
  %>
  
! <% if (showMore) {
!     if (primaryType.equalsIgnoreCase("text")) { %>
      <br><font size=-1><nobr><%=contentType%> <%=contentLength%> 
<%=lastModified%></nobr></font>
! <%  } else { %>
!     <br><font size=-1><nobr><%=contentType%> <%=contentLength%> <%=lastModified%> - 
<a href="/text.jsp?<%=id%>"><i18n:message key="viewAsText"/></a></nobr></font>
! <%  }
!   } %>



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nutch-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-cvs

Reply via email to