Skip to content

Commit

Permalink
#53 Add cookie support
Browse files Browse the repository at this point in the history
  • Loading branch information
ldhasson committed Jul 15, 2024
1 parent 4ab1d1a commit 2a36ab2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wanda/web/RequestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,13 @@ public Object getAttribute(String name)
return _Req.getAttribute(name);
}

public String getCookie(String cookieName)
public Cookie getCookie(String cookieName)
{
Cookie[] cookies = _Req.getCookies();
if (cookies != null)
for (Cookie c : cookies)
if (c.getName().equals(cookieName) == true)
return c.getValue();
return c;
return null;
}
}
6 changes: 6 additions & 0 deletions src/wanda/web/ResponseUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.FileUtils;
Expand Down Expand Up @@ -202,4 +203,9 @@ public void success(String fileName, File f, String contentType)
FileUtils.copyFile(f, _Res.getOutputStream());
}

public void setCookie(Cookie c)
{
_Res.addCookie(c);
}

}

0 comments on commit 2a36ab2

Please sign in to comment.