32 lines
731 B
Java
32 lines
731 B
Java
package net.mindoverflow.comments.webapp.controllers;
|
|
|
|
import net.mindoverflow.comments.webapp.WebServer;
|
|
import ro.pippo.controller.Controller;
|
|
import ro.pippo.controller.GET;
|
|
import ro.pippo.controller.Path;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@Path("/comments")
|
|
public class CommentsController extends Controller
|
|
{
|
|
|
|
@GET
|
|
public void getComments()
|
|
{
|
|
List<String> lines = new ArrayList<>();
|
|
lines.add("Comments:");
|
|
|
|
for(String user : WebServer.userAndComment.keySet())
|
|
{
|
|
String comment = WebServer.userAndComment.get(user);
|
|
if(comment != null) lines.add(user + ": " + comment);
|
|
}
|
|
|
|
getRouteContext().text().send(lines);
|
|
}
|
|
|
|
|
|
}
|