Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 
 package base.jee.servlet;
 
Show the most recent audit log events. Defaults to returning 2000 most recent log entries. Only includes debug messages if requested and if available.
public class AuditServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	public AuditServlet(JeeBase jeethrows IOException {
		super(jee);
	}
	@SuppressWarnings("unchecked")
	public void doGet(String tokenUser uHttpServletRequest requestHttpServletResponse responsethrows ServletExceptionIOException {
		String error = null;
		String type = request.getParameter("type");
		String uid = request.getParameter("uid");
		long limit = 2000;
		boolean debug = request.getParameter("debug") != null && request.getParameter("debug").equalsIgnoreCase("true");
		try {
			limit = Long.parseLong(request.getParameter("limit"));
catch(Exception e) {
			limit = 2000;
		}
		List<AuditLogEntryr = null;
		if(request.getParameter("person") != null) {
			r = .getAPI().getRecentLogEntriesByPerson(u, UUID.fromString(request.getParameter("person")), debuglimit);
else if(request.getParameter("ip") != null) {
			r = .getAPI().getRecentLogEntriesByIP(urequest.getParameter("ip"), debuglimit);
else {
			r = .getAPI().getRecentLogEntries(utypeuiddebuglimit);
		}
		ST page = .getPage(u"audit");
		page.add("audit"r);
		page.add("error"error);
		page.add("debug"debug);
		if(request.getParameter("person") != null) {
			page.add("filter""&person=" + StringHelper.urlEscape(request.getParameter("person")));
else if(request.getParameter("ip") != null) {
			page.add("filter""&ip=" + StringHelper.urlEscape(request.getParameter("ip")));
else {
			page.add("filter""");
		}
		page.add("debug_param"debug?"&debug=true":"");
		page.add("breadcrumbs"new Breadcrumb("Audit log"null));
		response.getWriter().write(page.render());
	}
New to GrepCode? Check out our FAQ X