Added utility to BaseServlet to determine number of path segments in request.
Moved header method from RunServlet to BaseServlet.
Moved JSON writer method from RunServlet to BaseServlet.