BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.util.CookieUtil Class Reference

Static Public Member Functions

static Cookie getCookie (HttpServletRequest request, String name)
 
static void setCookie (HttpServletResponse response, String name, String value, String path, int age)
 
static void deleteCookie (HttpServletResponse response, String name, String path)
 
static void encryptCookie (HttpServletResponse response, String name, byte[] value, String path, int age)
 
static byte[] decryptCookieValue (Cookie cookie) throws IOException, DecoderException
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file CookieUtil.java.

Member Function Documentation

◆ decryptCookieValue()

static byte [] org.turro.elephant.impl.util.CookieUtil.decryptCookieValue ( Cookie  cookie) throws IOException, DecoderException
static

Definition at line 69 of file CookieUtil.java.

69  {
70  return cookie == null ? null : new Base64().decode(cookie.getValue().getBytes());
71  }
Here is the caller graph for this function:

◆ deleteCookie()

static void org.turro.elephant.impl.util.CookieUtil.deleteCookie ( HttpServletResponse  response,
String  name,
String  path 
)
static

Definition at line 53 of file CookieUtil.java.

53  {
54  Cookie cookie = new Cookie(name, null);
55  cookie.setPath(path);
56  cookie.setMaxAge(0);
57  response.addCookie(cookie);
58  }
Here is the caller graph for this function:

◆ encryptCookie()

static void org.turro.elephant.impl.util.CookieUtil.encryptCookie ( HttpServletResponse  response,
String  name,
byte[]  value,
String  path,
int  age 
)
static

Definition at line 60 of file CookieUtil.java.

60  {
61  Cookie cookie = new Cookie(name, new String(new Base64().encode(value)));
62  if(ElephantContext.getUseSSL()) cookie.setSecure(true);
63  cookie.setVersion(1);
64  cookie.setPath(path);
65  cookie.setMaxAge(age);
66  response.addCookie(cookie);
67  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCookie()

static Cookie org.turro.elephant.impl.util.CookieUtil.getCookie ( HttpServletRequest  request,
String  name 
)
static

Definition at line 36 of file CookieUtil.java.

36  {
37  Cookie[] cookies = request.getCookies();
38  if(cookies == null) return null;
39  for(int i = 0; i < cookies.length; i++)
40  if(cookies[i].getName().equals(name))
41  return cookies[i];
42  return null;
43  }
Here is the caller graph for this function:

◆ setCookie()

static void org.turro.elephant.impl.util.CookieUtil.setCookie ( HttpServletResponse  response,
String  name,
String  value,
String  path,
int  age 
)
static

Definition at line 45 of file CookieUtil.java.

45  {
46  Cookie cookie = new Cookie(name, value);
47  if(ElephantContext.getUseSSL()) cookie.setSecure(true);
48  cookie.setPath(path);
49  cookie.setMaxAge(age);
50  response.addCookie(cookie);
51  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: