i have written the next code:
public void delete(MyType instance) {
List<MyType> myList = this.getAll();
Cookie[] cookies = request.getCookies();
List<Cookie> cookieList = new ArrayList<Cookie>();
cookieList = Arrays.asList(cookies);
for(Cookie cookie:cookieList) {
if(Long.valueOf(cookie.getValue()) == instance.getId()) {
cookieList.remove(cookie);
}
}
myList.remove(instance);
cookies = (Cookie[]) cookieList.toArray();
}
the issue is next: when i delete the cookie from the cookielist, how i can put the updated cookielist (without deleted cookie) back to the client? request or response don't have any *.setCookies();
methods.
or cookies will update automatically?
best regards.