## org.apache.mahout.cf.taste.web
Class RecommenderServlet

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              org.apache.mahout.cf.taste.web.RecommenderServlet

All Implemented Interfaces:
  Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public final class RecommenderServlet

extends javax.servlet.http.HttpServlet

A servlet which returns recommendations, as its name implies. The servlet accepts GET and POST HTTP requests, and looks for two parameters:

- userID: the user ID for which to produce recommendations
- howMany: the number of recommendations to produce
- debug: (optional) output a lot of information that is useful in debugging. Defaults to false, of course.

The response is text, and contains a list of the IDs of recommended items, in descending order of relevance, one per line.

For example, you can get 10 recommendations for user 123 from the following URL (assuming you are running taste in a web application running locally on port 8080):
`http://localhost:8080/taste/RecommenderServlet?userID=123&howMany=10`

This servlet requires one `init-param` in `web.xml`: it must find a parameter named "recommender-class" which is the name of a class that implements `Recommender` and has a no-arg constructor. The servlet will instantiate and use this `Recommender` to produce recommendations.

See Also:
  Serialized Form

Constructor Summary
`RecommenderServlet()`

Method Summary
`void` `doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
`void` `doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
`void` `init(javax.servlet.ServletConfig config)`
`String` `toString()`

Methods inherited from class javax.servlet.http.HttpServlet
`doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service`

Methods inherited from class javax.servlet.GenericServlet
`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### RecommenderServlet

    public RecommenderServlet()

Method Detail

### init

    public void init(javax.servlet.ServletConfig config)
              throws javax.servlet.ServletException

  Specified by:
    `init` in interface `javax.servlet.Servlet`
  Overrides:
    `init` in class `javax.servlet.GenericServlet`
  Throws:
    `javax.servlet.ServletException`

### doGet

    public void doGet(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException

  Overrides:
    `doGet` in class `javax.servlet.http.HttpServlet`
  Throws:
    `javax.servlet.ServletException`

### doPost

    public void doPost(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException

  Overrides:
    `doPost` in class `javax.servlet.http.HttpServlet`
  Throws:
    `javax.servlet.ServletException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.