mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 23:15:43 +01:00
implement hook url detection
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user