add other sip

This commit is contained in:
Sola
2015-12-13 21:22:49 +08:00
parent 0c7f27b0dd
commit 584331329b
2 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
package love.sola.netsupport.api.test;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
/**
* ***********************************************
* Created by Sola on 2014/8/20.
* Don't modify this source without my agreement
* ***********************************************
*/
@WebServlet(name = "TestSession", urlPatterns = "/api/testsession", loadOnStartup = 11)
public class TestSession extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-type", "text/plain;charset=utf-8");
PrintWriter out = response.getWriter();
HttpSession httpSession = request.getSession(false);
if (httpSession == null) {
out.println(httpSession);
} else {
out.println(httpSession.getId());
}
out.close();
}
}

View File

@@ -15,7 +15,9 @@ public enum ISP {
TELECOM(1, "^1[3|4|5|7|8][0-9]{9}$"), TELECOM(1, "^1[3|4|5|7|8][0-9]{9}$"),
UNICOM(2, "ZSZJLAN[0-9]{10}@16900\\.gd"), UNICOM(2, "ZSZJLAN[0-9]{10}@16900\\.gd"),
CHINAMOBILE(3, "^1[3|4|5|7|8][0-9]{9}@139\\.gd$"),; CHINAMOBILE(3, "^1[3|4|5|7|8][0-9]{9}@139\\.gd$"),
OTHER(4, ".*"),
;
private static final Map<String, ISP> NAME_MAP = new HashMap<>(); private static final Map<String, ISP> NAME_MAP = new HashMap<>();
private static final Map<Integer, ISP> ID_MAP = new HashMap<>(); private static final Map<Integer, ISP> ID_MAP = new HashMap<>();