implement hook url detection

This commit is contained in:
Sebastian Sdorra
2012-06-02 14:42:46 +02:00
parent 193d25c962
commit 5f5fe1cf58
2 changed files with 228 additions and 14 deletions

View File

@@ -93,6 +93,9 @@ public class HgHookCallbackServlet extends HttpServlet
/** Field description */
private static final String PARAM_NODE = "node";
/** Field description */
private static final String PARAM_PING = "ping";
/** Field description */
private static final Pattern REGEX_URL =
Pattern.compile("^/hook/hg/([^/]+)$");
@@ -131,6 +134,32 @@ public class HgHookCallbackServlet extends HttpServlet
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param request
* @param response
*
* @throws IOException
* @throws ServletException
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String ping = request.getParameter(PARAM_PING);
if (Util.isNotEmpty(ping) && Boolean.parseBoolean(ping))
{
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
}
else
{
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
}
/**
* Method description
*