Log send type

This commit is contained in:
burke.davey
2011-05-11 14:55:53 +00:00
parent 6a46132ec6
commit cdcab027dc

View File

@@ -59,6 +59,7 @@ public class SendServlet extends HttpServlet {
resp.getWriter().println(ERROR_STATUS + " (Must specify url parameter)");
return;
}
logUrlType(url, sel);
String deviceName = reqInfo.getParameter("deviceName");
String[] deviceNames = deviceName != null ?
@@ -190,4 +191,17 @@ public class SendServlet extends HttpServlet {
new ChannelMessage(channelToken, url));
return true;
}
private void logUrlType(String url, String sel) {
String type = "link"; // default
if (sel != null && sel.matches("([Tt]el[:]?)?\\s?[+]?(\\(?[0-9|\\s|\\-|\\.]\\)?)+")) {
type = "phone number";
} else if (url.matches("http://maps\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?[/?].*") ||
url.matches("http://www\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?/maps.*")) {
type = "Maps";
} else if (url.matches("http://www\\.youtube\\.[a-z]{2,3}(\\.[a-z]{2})?/.*")) {
type = "YouTube";
}
log.info("URL type: " + type);
}
}