Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.bmtargoss.smart.webadmin;
- import javax.servlet.http.Cookie;
- import javax.servlet.http.HttpServletRequest;
- public class CookieUtils {
- public static int getServerId(HttpServletRequest hreq) {
- int result = -1;
- /*
- * Get cookie which includes the database id.
- */
- Cookie[] cookies = hreq.getCookies();
- if (cookies != null) {
- for (Cookie ck : cookies) {
- if ("database".equals(ck.getName())) {
- result = Integer.parseInt(ck.getValue());
- }
- }
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement