static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put( "jar:file:/F:/eclipse-jee-mars-1-win32-x86_64/java_git/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/INTERHASH/WEB-INF/lib/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153352682000L)); _jspx_dependants.put("/WEB-INF/lib/jstl-1.2.jar", Long.valueOf(1461320330785L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/lib/struts2-core-2.3.20.jar", Long.valueOf(1432692682481L)); _jspx_dependants.put( "jar:file:/C:/Users/TRAN%20HUU%20DAT/Documents/NetBeansProjects/BKLibraryManagement/build/web/WEB-INF/lib/struts2-core-2.3.20.jar!/META-INF/struts-tags.tld", Long.valueOf(1416579274000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/lib/jstl-1.2.jar", Long.valueOf(1427350192179L)); _jspx_dependants.put( "jar:file:/E:/Development/WorkSpace/EclipseWorkSpaceX/ajoa/WebContent/WEB-INF/lib/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153356282000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(4); _jspx_dependants.put("/admin/../foot.jsp", Long.valueOf(1350283935831L)); _jspx_dependants.put("/admin/../taglib.jsp", Long.valueOf(1345552994159L)); _jspx_dependants.put("/admin/../top.jsp", Long.valueOf(1350305382989L)); _jspx_dependants.put("/admin/left.jsp", Long.valueOf(1350298710763L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(4); _jspx_dependants.put("/WEB-INF/taglib/fmt.tld", Long.valueOf(1298367396000L)); _jspx_dependants.put("/WEB-INF/taglib/fn.tld", Long.valueOf(1298367396000L)); _jspx_dependants.put("/WEB-INF/taglib/c.tld", Long.valueOf(1298367396000L)); _jspx_dependants.put("/jsp/common/taglibs.jsp", Long.valueOf(1384842742068L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/lib/jstl-1.2.jar", Long.valueOf(1433489594000L)); _jspx_dependants.put( "jar:file:/Users/bagjaemin/Documents/workspace/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/acm/WEB-INF/lib/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153352682000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/lib/jstl-1.2.jar", Long.valueOf(1448512529422L)); _jspx_dependants.put( "jar:file:/C:/Users/건호/Desktop/DB설계/2015_2_DBDesign-Team5-/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/DBdesign_t5_V0.01/WEB-INF/lib/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153352682000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/lib/standard.jar", Long.valueOf(1439529924450L)); _jspx_dependants.put( "jar:file:/C:/kosaswcourse/workspace-web/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/mysns/WEB-INF/lib/standard.jar!/META-INF/c.tld", Long.valueOf(1098678690000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(5); _jspx_dependants.put("/WEB-INF/template/pagefoot.jsp", Long.valueOf(1346922488000L)); _jspx_dependants.put("/WEB-INF/template/content_title.jsp", Long.valueOf(1346922488000L)); _jspx_dependants.put("/WEB-INF/tld/customized-tags.tld", Long.valueOf(1346922428000L)); _jspx_dependants.put("/common/jsLib.jsp", Long.valueOf(1346922494000L)); _jspx_dependants.put("/common/header.jsp", Long.valueOf(1346922494000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(5); _jspx_dependants.put("/WEB-INF/views/include/taglib.jsp", Long.valueOf(1430867052000L)); _jspx_dependants.put("/WEB-INF/tags/sys/message.tag", Long.valueOf(1430867052000L)); _jspx_dependants.put("/WEB-INF/tlds/fns.tld", Long.valueOf(1430867052000L)); _jspx_dependants.put("/WEB-INF/tlds/shiros.tld", Long.valueOf(1430867052000L)); _jspx_dependants.put("/WEB-INF/tlds/fnc.tld", Long.valueOf(1430867052000L)); }
/** * {@code #revNumber}의 이전 리비전에 해당하는 커밋 정보를 번환한다. * * @param revNumber * @return */ @Override public Commit getParentCommitOf(String revNumber) { Long rev = Long.parseLong(revNumber) - 1; try { return getCommit(rev.toString()); } catch (Exception e) { throw new RuntimeException(e); } }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put( "file:/Users/gracelilac/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar", Long.valueOf(1426668402000L)); _jspx_dependants.put( "jar:file:/Users/gracelilac/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153352682000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put( "jar:file:/Users/SunskyXH/.m2/repository/org/springframework/spring-webmvc/3.2.2.RELEASE/spring-webmvc-3.2.2.RELEASE.jar!/META-INF/spring-form.tld", Long.valueOf(1363154214000L)); _jspx_dependants.put( "file:/Users/SunskyXH/.m2/repository/org/springframework/spring-webmvc/3.2.2.RELEASE/spring-webmvc-3.2.2.RELEASE.jar", Long.valueOf(1450357466000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(4); _jspx_dependants.put( "file:/Users/Songhee/.m2/repository/jstl/jstl/1.2/jstl-1.2.jar", Long.valueOf(1439902589000L)); _jspx_dependants.put( "jar:file:/Users/Songhee/.m2/repository/jstl/jstl/1.2/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153352682000L)); _jspx_dependants.put("/./commons/_head.jspf", Long.valueOf(1438154010000L)); _jspx_dependants.put("/./commons/_top.jspf", Long.valueOf(1438750134000L)); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // POST method only used for tracked login operation HttpSession session = request.getSession(); response.setContentType("text/plain"); PrintWriter out = response.getWriter(); // Get the username and password from request String username = request.getParameter("id"); String password = request.getParameter("pwd"); Long id = 0L; try { id = Long.parseLong(username); } catch (Exception ex) { } if (username != null && password != null) { // Login into tracked system CTracked ctracked = db.loginTrackedFromMobile(id, password).getResult(); if (ctracked != null) { // Login successful out.print("OK," + ctracked.getUsername()); session.setAttribute("device_id", ctracked.getUsername()); log.info(ctracked + " : logined!"); } } }
private void getPositions(HttpServletRequest request, Role item) { String[] pos = request.getParameterValues("positions"); item.clearPositions(); for (int i = 0; i < pos.length; i++) { item.addPosition(Long.parseLong(pos[i])); } }
private void getPermissions(HttpServletRequest request, Role item) { String[] per = request.getParameterValues("permissions"); item.clearPermissions(); for (int i = 0; i < per.length; i++) { item.addPermission(Long.parseLong(per[i])); } }
public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String uri = request.getParameter("uri"); response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); String rLastEdit = request.getParameter("lastEdit"); if (rLastEdit == null) return; long userLastEdit = Long.parseLong(rLastEdit); if (clipStatus.hasAccess(request.getSession().getId(), uri)) { Connection con = dbCon.getConnection(); try { Clip clip = ClipAgent.getInstance().loadClip(uri, con); if (clip != null) { DateFormat df = DateFormat.getDateTimeInstance(); String textAreaValue = clip.getValue(); Pattern p = Pattern.compile("</\\s*textarea", Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(textAreaValue); textAreaValue = m.replaceAll("textarea"); response.getOutputStream().write(textAreaValue.getBytes("UTF-8")); } } finally { dbCon.returnConnection(con); } } else { response.getOutputStream().print(""); } response.getOutputStream().flush(); }
/** * Gets the value of the given parameter from the request converted to an {@code long}. If * the parameter is not set or not parseable, the default value is returned. * * @param pReq the servlet request * @param pName the parameter name * @param pDefault the default value * @return the value of the parameter converted to an {@code long}, or the default value, if the * parameter is not set. */ public static long getLongParameter( final ServletRequest pReq, final String pName, final long pDefault) { String str = pReq.getParameter(pName); try { return str != null ? Long.parseLong(str) : pDefault; } catch (NumberFormatException nfe) { return pDefault; } }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(7); _jspx_dependants.put("/WEB-INF/jspf/header.jsp", Long.valueOf(1436751310777L)); _jspx_dependants.put("/WEB-INF/tags/fn.tld", Long.valueOf(1436751312186L)); _jspx_dependants.put("/WEB-INF/tags/c.tld", Long.valueOf(1436751312151L)); _jspx_dependants.put("/WEB-INF/jspf/taglibs.jspf", Long.valueOf(1436751310780L)); _jspx_dependants.put("/WEB-INF/tags/airad.tld", Long.valueOf(1436751312149L)); _jspx_dependants.put("/WEB-INF/tags/elfuncs.tld", Long.valueOf(1436751312147L)); _jspx_dependants.put("/WEB-INF/tags/fmt.tld", Long.valueOf(1436751312188L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(7); _jspx_dependants.put("/WEB-INF/jspf/header.jsp", Long.valueOf(1432864556750L)); _jspx_dependants.put("/WEB-INF/tags/fn.tld", Long.valueOf(1432864557963L)); _jspx_dependants.put("/WEB-INF/tags/c.tld", Long.valueOf(1432864557958L)); _jspx_dependants.put("/WEB-INF/jspf/taglibs.jspf", Long.valueOf(1432864556754L)); _jspx_dependants.put("/WEB-INF/tags/airad.tld", Long.valueOf(1432864557957L)); _jspx_dependants.put("/WEB-INF/tags/elfuncs.tld", Long.valueOf(1432864557955L)); _jspx_dependants.put("/WEB-INF/tags/fmt.tld", Long.valueOf(1432864557964L)); }
@Override public HttpSession getSession() { long key = 0; if (getCookies().length == 0) { key = System.nanoTime(); THttpSessionStore.set(key); } else { key = Long.parseLong(getCookies()[0].getValue()); } return THttpSessionStore.get(key); }
/** * Helper method which performs an EJB call and gets the subscription value object for the given * subscription key. * * @param key the (hex)-key of the subscription. * @return the subscription value object. */ private VOSubscription getSubscription(ServiceAccess serviceAccess, String key) { SubscriptionService subscriptionService = serviceAccess.getService(SubscriptionService.class); List<VOUserSubscription> list = subscriptionService.getSubscriptionsForCurrentUser(); if (list != null) { for (VOSubscription vo : list) { if (key.equals(Long.toHexString(vo.getKey()))) { return vo; } } } return null; }
/** * Retrieves long value from parameters map. * * @param key Key. * @param params Parameters map. * @param dfltVal Default value. * @return Long value from parameters map or {@code dfltVal} if null or not exists. * @throws GridException If parsing failed. */ @Nullable private static Long longValue(String key, Map<String, Object> params, Long dfltVal) throws GridException { assert key != null; String val = (String) params.get(key); try { return val == null ? dfltVal : Long.valueOf(val); } catch (NumberFormatException ignore) { throw new GridException("Failed to parse parameter of Long type [" + key + "=" + val + "]"); } }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(6); _jspx_dependants.put("/WEB-INF/tags/fn.tld", Long.valueOf(1423808915303L)); _jspx_dependants.put("/WEB-INF/tags/c.tld", Long.valueOf(1423808915249L)); _jspx_dependants.put("/WEB-INF/jspf/taglibs.jspf", Long.valueOf(1423808914293L)); _jspx_dependants.put("/WEB-INF/tags/airad.tld", Long.valueOf(1423808915245L)); _jspx_dependants.put("/WEB-INF/tags/elfuncs.tld", Long.valueOf(1423808915242L)); _jspx_dependants.put("/WEB-INF/tags/fmt.tld", Long.valueOf(1423808915307L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(7); _jspx_dependants.put( "jar:file:/Users/Thomas/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar!/META-INF/fn.tld", Long.valueOf(1153352682000L)); _jspx_dependants.put( "jar:file:/Users/Thomas/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153352682000L)); _jspx_dependants.put("/include/header.jspf", Long.valueOf(1442135091000L)); _jspx_dependants.put("/include/tags.jspf", Long.valueOf(1442135091000L)); _jspx_dependants.put("/WEB-INF/tlds/next-functions.tld", Long.valueOf(1442135091000L)); _jspx_dependants.put( "jar:file:/Users/Thomas/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar!/META-INF/fmt.tld", Long.valueOf(1153352682000L)); _jspx_dependants.put( "file:/Users/Thomas/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar", Long.valueOf(1442134652000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(1); _jspx_dependants.put("/WEB-INF/commons/taglibs.jsp", Long.valueOf(1392094676000L)); }
static { _jspx_dependants = new java.util.HashMap<java.lang.String, java.lang.Long>(2); _jspx_dependants.put("/WEB-INF/kk.tld", Long.valueOf(1378962218000L)); _jspx_dependants.put("/WEB-INF/jsp/Taglibs.jsp", Long.valueOf(1378962218000L)); }
public void _jspService( final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=GBK"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n"); out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n"); out.write("<meta http-equiv=\"pragma\" content=\"no-cache\" />\r\n"); out.write("<meta http-equiv=\"cache-control\" content=\"no-cache\" />\r\n"); out.write("<meta http-equiv=\"expires\" content=\"0\" /> \r\n"); out.write(" \r\n"); out.write("<title>超市管理系统</title>\r\n"); out.write("<script type=text/javascript>\r\n"); out.write(" function check(form){\r\n"); out.write("\t if(form.supplierid.value==\"\"){\r\n"); out.write("\t\talert(\"编号不能为空\"); \r\n"); out.write("\t\treturn false;\r\n"); out.write("\t }\r\n"); out.write("\t if(form.suppliername.value==\"\"){\r\n"); out.write("\t\talert(\"供应商名称不能为空\"); \r\n"); out.write("\t\treturn false;\r\n"); out.write("\t }\r\n"); out.write("\t if(form.supplierdescription.value==\"\"){\r\n"); out.write("\t\talert(\"供应商描述不能为空\"); \r\n"); out.write("\t\treturn false;\r\n"); out.write("\t }\r\n"); out.write("\t if(form.linkedman.value==\"\"){\r\n"); out.write("\t\talert(\"联系人不能为空\"); \r\n"); out.write("\t\treturn false;\r\n"); out.write("\t }\r\n"); out.write("\t if(form.telphone.value==\"\"){\r\n"); out.write("\t\talert(\"电话不能为空\"); \r\n"); out.write("\t\treturn false;\r\n"); out.write("\t }\r\n"); out.write("\t if(form.address.value==\"\"){\r\n"); out.write("\t\talert(\"地址不能为空\"); \r\n"); out.write("\t\treturn false;\r\n"); out.write("\t }\r\n"); out.write("\t if(!window.confirm(\"确定更改?\")){\r\n"); out.write("\t\t return false;\r\n"); out.write("\t }\r\n"); out.write("\t return true;\r\n"); out.write(" }\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("</head>\r\n"); if (session.getAttribute("username") == null) { out.println("<script type=\"text/javascript\">"); out.println("alert(\"您还没有登陆!请登陆!\");"); out.println("open(\"index.jsp\",\"_parent\");"); out.println("</script>"); return; } out.write('\r'); out.write('\n'); request.setCharacterEncoding("gbk"); long supplierid = Long.valueOf(request.getParameter("supplierid")); String suppliername = request.getParameter("suppliername"); String supplierdescription = request.getParameter("supplierdescription"); String linkedman = request.getParameter("linkedman"); String telphone = request.getParameter("telphone"); String address = request.getParameter("address"); pageContext.setAttribute("supplierid", supplierid); pageContext.setAttribute("suppliername", suppliername); pageContext.setAttribute("supplierdescription", supplierdescription); pageContext.setAttribute("linkedman", linkedman); pageContext.setAttribute("telphone", telphone); pageContext.setAttribute("address", address); if (request.getParameter("change") != null) { Supplier supplier = new Supplier(); supplier.setSupplierid(supplierid); supplier.setSuppliername(suppliername); supplier.setSupplierdescription(supplierdescription); supplier.setLinkedman(linkedman); supplier.setTelphone(telphone); supplier.setAddress(address); boolean consequence = new SupplierOperation().supplierinfochange(supplier); if (consequence) { out.println("<script type=\"text/javascript\">"); out.println("alert(\"更新成功!\");"); out.println("open(\"suppliermanage.jsp\",\"_self\");"); out.println("</script>"); return; } else { out.println("<script type=\"text/javascript\">"); out.println("alert(\"更新失败!\");"); out.println("open(\"suppliermanage.jsp\",\"_self\");"); out.println("</script>"); return; } } out.write("\r\n"); out.write("<body>\r\n"); out.write( " <form action=supplierinfochange.jsp method=post onSubmit=\"return check(this);\">\r\n"); out.write(" <input type=hidden name=change />\r\n"); out.write(" <div style=\"border:10px solid #4169E1;width:80%;\" >\r\n"); out.write(" <table>\r\n"); out.write(" <tr><td><pre> </pre></td><td><input name=supplierid type=\"hidden\" value="); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${supplierid}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write(" /></td></tr>\r\n"); out.write(" <tr><td>供应商名称:</td><td><input name=suppliername type=\"text\" value="); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${suppliername}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write(" /></td></tr>\r\n"); out.write(" \r\n"); out.write("<tr><td>供应商描述:</td><td><textarea name=supplierdescription>"); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${supplierdescription}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write("</textarea></td></tr>\r\n"); out.write(" <tr><td>联系人:</td><td><input name=linkedman type=\"text\" value="); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${linkedman}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write(" /></td></tr>\r\n"); out.write(" <tr><td>电话:</td><td><input name=telphone type=\"text\" value="); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${telphone}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write(" /></td></tr>\r\n"); out.write(" <tr><td>地址:</td><td><textarea name=address >"); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${address}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write("</textarea></td></tr>\r\n"); out.write(" </table>\r\n"); out.write(" </div>\r\n"); out.write( " <input onclick=\"window.open('suppliermanage.jsp','_self')\" type=\"button\" value=返回 /><input type=\"submit\" value=修改数据 /><input onclick=\"window.open('supplierdelete.jsp?supplierid="); out.write( (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate( "${supplierid}", java.lang.String.class, (javax.servlet.jsp.PageContext) _jspx_page_context, null, false)); out.write("','_self')\" type=button value=删除 />\r\n"); out.write("</form>\r\n"); out.write("</body>\r\n"); out.write("</html>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); // All request in GET method must be certificated Object obj = session.getAttribute("device_id"); if (!(obj instanceof Long)) { // Client must be login first, then use Mobile service response.setStatus(404); return; } response.setContentType("text/plain"); PrintWriter out = response.getWriter(); // Here is tracked's id Long device_id = (Long) obj; // Determine operation type String op = request.getParameter("op"); if (op == null) op = ""; // Get current track Long track_id = null; obj = session.getAttribute("track_id"); if (obj instanceof Long) { track_id = (Long) obj; } if (op.equals("logout")) { // Client request a logout operation session.removeAttribute("device_id"); session.removeAttribute("track_id"); out.print("OK," + device_id); } else if (op.equals("latlng")) { // Client insert update it's location in latitude/longitude // If it's a first waypoint, create a new track if (track_id == null) { track_id = db.newTrack(device_id).getResult().getTrackID(); session.setAttribute("track_id", track_id); } // Parse latitude, longitude from request double lat = Double.parseDouble(request.getParameter("lat")); double lng = Double.parseDouble(request.getParameter("lng")); long speed = -1L; try { // Try to get speed from request speed = Long.parseLong(request.getParameter("spd")); } catch (Exception ex) { } if (speed < 0) { // Client don't send speed to server try { // Calculate speed manually double lastLat = (Double) session.getAttribute("latitude"); double lastLng = (Double) session.getAttribute("longitude"); long time = (Long) session.getAttribute("time"); long distance = Utils.getDistance(lastLat, lastLng, lat, lng); speed = distance * 1000 / Math.abs(time - System.currentTimeMillis()); } catch (Exception ex) { speed = 0L; } } // Insert new point into server ServiceResult<CWaypoint> result = db.insertWaypoint(track_id, lat, lng, speed); CWaypoint cwaypoint = result.getResult(); if (result.isOK()) { // OK,latitude,longitude,speed(m/s),time,trackid session.setAttribute("latitude", lat); session.setAttribute("longitude", lng); session.setAttribute("time", cwaypoint.getTime().getTime()); out.print( "OK," + cwaypoint.getLat() + "," + cwaypoint.getLng() + "," + cwaypoint.getSpeed() + "," + cwaypoint.getTime().getTime() + "," + cwaypoint.getTrackID()); } } else if (op.equals("cellid")) { // Client send it's location by cellular technique if (track_id == null) { track_id = db.newTrack(device_id).getResult().getTrackID(); session.setAttribute("track_id", track_id); } try { int cell = Integer.parseInt(request.getParameter("cell")); int lac = Integer.parseInt(request.getParameter("lac")); Geocode geocode = Utils.getLocation(cell, lac); out.println(geocode.getLatitude() + "," + geocode.getLongitude()); } catch (Exception ex) { } // TODO Implements cellular method to calculate location of a mobile out.println("Not implement"); } else if (op.equals("newtrack")) { // Client request to create a new track track_id = db.newTrack(device_id).getResult().getTrackID(); session.setAttribute("track_id", track_id); out.print("OK," + track_id); } else if (op.equals("changepass")) { String newpass = request.getParameter("newpass"); if (newpass != null) { CTracked ctracked = new CTracked(); ctracked.setUsername(device_id); ctracked.setPassword(newpass); if (db.updateTracked(ctracked).isOK()) { out.println("OK," + device_id); } } } else if (op.equals("config")) { CTracked ctracked = db.getTracked(device_id).getResult(); Integer interval = ctracked.getIntervalGps(); if (interval == null) interval = 10; out.print("OK," + interval + ","); byte[] b = ctracked.getSchedule(); if (b == null) { for (int i = 0; i < 23; i++) { out.print("1."); } out.println(1); } else { for (int i = 0; i < 23; i++) { out.print(b[i] + "."); } out.println(b[23]); } } else if (op.equals("amilogin")) { out.println("OK"); } }