Wednesday, June 3, 2009

[Linux] 解決 Nutch 中 Cache 亂碼的問題

Edit cache.jsp
--- cached.jsp.orig 2009-02-18 12:17:25.000000000 -0500
+++ cached.jsp.patched 2009-02-18 12:43:26.000000000 -0500
@@ -40,6 +40,7 @@
.getLocale().getLanguage();

Metadata metaData = bean.getParseData(details).getContentMeta();
+ Metadata parseMetaData = bean.getParseData(details).getParseMeta();

String content = null;
String contentType = (String) metaData.get(Metadata.CONTENT_TYPE);
@@ -49,7 +50,7 @@
// 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");
+ String encoding = (String) parseMetaData.get("CharEncodingForConversion");
if (encoding != null) {
try {
content = new String(bean.getContent(details), encoding);

Reference:
Nutch缓存乱码解决方案

No comments:

Post a Comment