diff --git a/utils/src/com/cloud/utils/HttpUtils.java b/utils/src/com/cloud/utils/HttpUtils.java index 58768dcabf7..29409857880 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 {