package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.io.*; import java.util.*; import org.apache.nutch.searcher.*; import org.apache.nutch.parse.ParseData; import org.apache.nutch.metadata.Metadata; import org.apache.nutch.metadata.Nutch; import org.apache.hadoop.conf.Configuration; import org.apache.nutch.util.NutchConfiguration; public final class cached_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List _jspx_dependants; static { _jspx_dependants = new java.util.ArrayList(1); _jspx_dependants.add("/WEB-INF/taglibs-i18n.tld"); } private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fi18n_005fbundle_0026_005fbaseName_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fi18n_005fmessageArg_0026_005fvalue_005fnobody; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.AnnotationProcessor _jsp_annotationprocessor; public Object getDependants() { return _jspx_dependants; } public void _jspInit() { _005fjspx_005ftagPool_005fi18n_005fbundle_0026_005fbaseName_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fi18n_005fmessageArg_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName()); } public void _jspDestroy() { _005fjspx_005ftagPool_005fi18n_005fbundle_0026_005fbaseName_005fnobody.release(); _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.release(); _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey.release(); _005fjspx_005ftagPool_005fi18n_005fmessageArg_0026_005fvalue_005fnobody.release(); } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, false, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); out = pageContext.getOut(); _jspx_out = out; out.write('\n'); Configuration nutchConf = NutchConfiguration.get(application); NutchBean bean = NutchBean.get(application, nutchConf); bean.LOG.info("cache request from " + request.getRemoteAddr()); Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")), request.getParameter("id")); HitDetails details = bean.getDetails(hit); String id = "idx=" + hit.getIndexNo() + "&id=" + hit.getUniqueKey(); String language = ResourceBundle.getBundle("org.nutch.jsp.cached", request.getLocale()) .getLocale().getLanguage(); Metadata metaData = bean.getParseData(details).getContentMeta(); String content = null; String contentType = (String) metaData.get(Metadata.CONTENT_TYPE); if (contentType.startsWith("text/html")) { // FIXME : it's better to emit the original 'byte' sequence // with 'charset' set to the value of 'CharEncoding', // but I don't know how to emit 'byte sequence' in JSP. // out.getOutputStream().write(bean.getContent(details)) may work, // but I'm not sure. String encoding = (String) metaData.get("CharEncodingForConversion"); if (encoding != null) { try { content = new String(bean.getContent(details), encoding); } catch (UnsupportedEncodingException e) { // fallback to windows-1252 content = new String(bean.getContent(details), "windows-1252"); } } else content = new String(bean.getContent(details)); } out.write("\n"); out.write("\n"); out.write("\n"); out.flush(); out.write('\n'); out.write('\n'); if (_jspx_meth_i18n_005fbundle_005f0(_jspx_page_context)) return; out.write("\n"); out.write("

"); if (_jspx_meth_i18n_005fmessage_005f0(_jspx_page_context)) return; out.write("

\n"); out.write("

\n"); // i18n:message org.apache.taglibs.i18n.MessageTag _jspx_th_i18n_005fmessage_005f1 = (org.apache.taglibs.i18n.MessageTag) _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey.get(org.apache.taglibs.i18n.MessageTag.class); _jspx_th_i18n_005fmessage_005f1.setPageContext(_jspx_page_context); _jspx_th_i18n_005fmessage_005f1.setParent(null); // /cached.jsp(77,0) name = key type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_i18n_005fmessage_005f1.setKey("page"); int _jspx_eval_i18n_005fmessage_005f1 = _jspx_th_i18n_005fmessage_005f1.doStartTag(); if (_jspx_eval_i18n_005fmessage_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { if (_jspx_eval_i18n_005fmessage_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.pushBody(); _jspx_th_i18n_005fmessage_005f1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); _jspx_th_i18n_005fmessage_005f1.doInitBody(); } do { out.write('\n'); out.write(' '); out.write(' '); // i18n:messageArg org.apache.taglibs.i18n.MessageArgumentTag _jspx_th_i18n_005fmessageArg_005f0 = (org.apache.taglibs.i18n.MessageArgumentTag) _005fjspx_005ftagPool_005fi18n_005fmessageArg_0026_005fvalue_005fnobody.get(org.apache.taglibs.i18n.MessageArgumentTag.class); _jspx_th_i18n_005fmessageArg_005f0.setPageContext(_jspx_page_context); _jspx_th_i18n_005fmessageArg_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_i18n_005fmessage_005f1); // /cached.jsp(78,2) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_i18n_005fmessageArg_005f0.setValue(details.getValue("url")); int _jspx_eval_i18n_005fmessageArg_005f0 = _jspx_th_i18n_005fmessageArg_005f0.doStartTag(); if (_jspx_th_i18n_005fmessageArg_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fi18n_005fmessageArg_0026_005fvalue_005fnobody.reuse(_jspx_th_i18n_005fmessageArg_005f0); return; } _005fjspx_005ftagPool_005fi18n_005fmessageArg_0026_005fvalue_005fnobody.reuse(_jspx_th_i18n_005fmessageArg_005f0); out.write('\n'); int evalDoAfterBody = _jspx_th_i18n_005fmessage_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); if (_jspx_eval_i18n_005fmessage_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) { out = _jspx_page_context.popBody(); } } if (_jspx_th_i18n_005fmessage_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey.reuse(_jspx_th_i18n_005fmessage_005f1); return; } _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey.reuse(_jspx_th_i18n_005fmessage_005f1); out.write("\n"); out.write("

\n"); out.write("
\n"); out.write("\n"); String caching = details.getValue("cache"); String url = details.getValue("url"); if (caching != null && !caching.equals(Nutch.CACHING_FORBIDDEN_NONE)) { out.write("\n"); out.write("Display of this content was administratively prohibited by the webmaster.\n"); out.write("You may visit the original page instead: '); out.print(url); out.write(".\n"); return; } out.write('\n'); if (contentType.startsWith("text/html")) { out.write('\n'); out.write('\n'); if (content != null && !content.equals("")) { out.write('\n'); out.print( content ); out.write('\n'); } else { out.write('\n'); if (_jspx_meth_i18n_005fmessage_005f2(_jspx_page_context)) return; out.write('\n'); } out.write('\n'); out.write('\n'); } else { out.write("\n"); out.write("\n"); out.write("The cached content has mime type \""); out.print(contentType); out.write("\",\n"); out.write("click this link to download it directly.\n"); out.write("\n"); } out.write('\n'); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_i18n_005fbundle_005f0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // i18n:bundle org.apache.taglibs.i18n.BundleTag _jspx_th_i18n_005fbundle_005f0 = (org.apache.taglibs.i18n.BundleTag) _005fjspx_005ftagPool_005fi18n_005fbundle_0026_005fbaseName_005fnobody.get(org.apache.taglibs.i18n.BundleTag.class); _jspx_th_i18n_005fbundle_005f0.setPageContext(_jspx_page_context); _jspx_th_i18n_005fbundle_005f0.setParent(null); // /cached.jsp(74,0) name = baseName type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_i18n_005fbundle_005f0.setBaseName("org.nutch.jsp.cached"); int _jspx_eval_i18n_005fbundle_005f0 = _jspx_th_i18n_005fbundle_005f0.doStartTag(); if (_jspx_th_i18n_005fbundle_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fi18n_005fbundle_0026_005fbaseName_005fnobody.reuse(_jspx_th_i18n_005fbundle_005f0); return true; } _005fjspx_005ftagPool_005fi18n_005fbundle_0026_005fbaseName_005fnobody.reuse(_jspx_th_i18n_005fbundle_005f0); return false; } private boolean _jspx_meth_i18n_005fmessage_005f0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // i18n:message org.apache.taglibs.i18n.MessageTag _jspx_th_i18n_005fmessage_005f0 = (org.apache.taglibs.i18n.MessageTag) _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.i18n.MessageTag.class); _jspx_th_i18n_005fmessage_005f0.setPageContext(_jspx_page_context); _jspx_th_i18n_005fmessage_005f0.setParent(null); // /cached.jsp(75,38) name = key type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_i18n_005fmessage_005f0.setKey("title"); int _jspx_eval_i18n_005fmessage_005f0 = _jspx_th_i18n_005fmessage_005f0.doStartTag(); if (_jspx_th_i18n_005fmessage_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_i18n_005fmessage_005f0); return true; } _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_i18n_005fmessage_005f0); return false; } private boolean _jspx_meth_i18n_005fmessage_005f2(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // i18n:message org.apache.taglibs.i18n.MessageTag _jspx_th_i18n_005fmessage_005f2 = (org.apache.taglibs.i18n.MessageTag) _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.i18n.MessageTag.class); _jspx_th_i18n_005fmessage_005f2.setPageContext(_jspx_page_context); _jspx_th_i18n_005fmessage_005f2.setParent(null); // /cached.jsp(102,0) name = key type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_i18n_005fmessage_005f2.setKey("noContent"); int _jspx_eval_i18n_005fmessage_005f2 = _jspx_th_i18n_005fmessage_005f2.doStartTag(); if (_jspx_th_i18n_005fmessage_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_i18n_005fmessage_005f2); return true; } _005fjspx_005ftagPool_005fi18n_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_i18n_005fmessage_005f2); return false; } }