code: @SuppressWarnings("unchecked")
  	private void setCookie(NativeObject result, HttpServletResponse response) {
  		Map<String, String> cookieMap = ScriptableObject.getTypedProperty(
  				result, "cookie", Map.class);
  		if (cookieMap == null) {
  			return;
  		}
  
  		Iterator<Entry<String, String>> iterator = cookieMap.entrySet()
  				.iterator();
  		while (iterator.hasNext()) {
  			String name = iterator.next().getKey();
  			Cookie cookie = new Cookie(name, cookieMap.get(name));
  			response.addCookie(cookie);
  		}
  	}
docs: set cookie from result of handler to HttpServletResponse
  
  @param result
  return object of handler
  @param response
  HttpServletResponse