You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ek...@apache.org on 2015/06/08 11:45:24 UTC

[03/50] [abbrv] git commit: updated refs/heads/feature/vpc-ipv6 to 6140db5

utils: add findCookie value by key helping method in HttpUtils

finds cookie value from an array of cookie by key name

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit 78ea36d099371b9a59cbf1e3efd48b853ecc37ca)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ca3ac685
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ca3ac685
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ca3ac685

Branch: refs/heads/feature/vpc-ipv6
Commit: ca3ac68517199523f338b95e60f65b415039088a
Parents: 3e21c9b
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri May 29 15:27:31 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri May 29 15:42:21 2015 +0200

----------------------------------------------------------------------
 utils/src/com/cloud/utils/HttpUtils.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ca3ac685/utils/src/com/cloud/utils/HttpUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/HttpUtils.java b/utils/src/com/cloud/utils/HttpUtils.java
index 58768dc..2940985 100644
--- a/utils/src/com/cloud/utils/HttpUtils.java
+++ b/utils/src/com/cloud/utils/HttpUtils.java
@@ -21,6 +21,7 @@ package com.cloud.utils;
 
 import org.apache.log4j.Logger;
 
+import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 
@@ -49,6 +50,15 @@ public class HttpUtils {
         }
     }
 
+    public static String findCookie(final Cookie[] cookies, final String key) {
+        for (Cookie cookie: cookies) {
+            if (cookie != null && cookie.getName().equals(key)) {
+                return cookie.getValue();
+            }
+        }
+        return null;
+    }
+
     public static void writeHttpResponse(final HttpServletResponse resp, final String response,
                                          final Integer responseCode, final String responseType, final String jsonContentType) {
         try {