org.apache.nutch.searcher.response
Interface ResponseWriter

All Superinterfaces:
Configurable, Pluggable

public interface ResponseWriter
extends Pluggable, Configurable

Nutch extension point which allow writing search results in many different output formats.


Field Summary
static String X_POINT_ID
           
 
Method Summary
 void setContentType(String contentType)
          Sets the returned content MIME type.
 void writeResponse(SearchResults results, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Writes out the search results response to the HttpServletResponse.
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
 

Field Detail

X_POINT_ID

static final String X_POINT_ID
Method Detail

setContentType

void setContentType(String contentType)
Sets the returned content MIME type. Populated though variables set in the plugin.xml file of the ResponseWriter. This allows easily changing output content types, for example for JSON from text/plain during tesing and debugging to application/json in production.

Parameters:
contentType - The MIME content type to set.

writeResponse

void writeResponse(SearchResults results,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
                   throws IOException
Writes out the search results response to the HttpServletResponse.

Parameters:
results - The SearchResults object containing hits and other info.
request - The HttpServletRequest object.
response - The HttpServletResponse object.
Throws:
IOException - If an error occurs while writing out the response.


Copyright © 2006 The Apache Software Foundation