Fork me on GitHub


Full javadoc is available.


Add a dependency towards the library:


Create a servlet fetching your items, serializing them and sending the summary over the wire:

public class SummaryServlet extends HttpServlet {

  private static final long serialVersionUID = 8629863338196207094L;

  private Set<XXX> items = /* where do your items come from? */;
  private final Summarizer summarizer = SummarizerFromItems.simple(items, new Serializer<XXX>() {

    public byte[] serialize(XXX t) {
      return /* how to serialize individual items on the wire? */;

  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    int level;
    try {
      String path = request.getPathInfo();
      String levelStr = path.substring(path.lastIndexOf('/') + 1);
      level = Integer.parseInt(levelStr);
    } catch(NumberFormatException e) {
      throw new ServletException("Failed to parse level", e);

And bind this servlet in your web.xml:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "" >
  <display-name>My awesome webapp</display-name>

The servlet can be extended to expose session-specific summaries.