public void nutchPerform(ComponentContext tileContext,
HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext) throws ServletException, IOException {
SearchResultBean hit = (SearchResultBean) request.getAttribute("hit");
if (hit != null) {
// Content-Type
String primaryType = hit.getDetails().getValue("primaryType");
String subType = hit.getDetails().getValue("subType");
String contentType = subType;
if (contentType == null)
contentType = primaryType;
if (contentType != null) {
request.setAttribute("contentType", contentType);
}
// Content-Length
String contentLength = hit.getDetails().getValue("contentLength");
if (contentLength != null) {
request.setAttribute("contentLength", contentLength);
}
// Last-Modified
String lastModified = hit.getDetails().getValue("lastModified");
if (lastModified != null) {
long millis = new Long(lastModified).longValue();
Date date = new Date(millis);
request.setAttribute("lastModified", date);
}