/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * * @param cookie this is the cookie to be added to the response * * @return returns the cookie that has been set in the response */ public Cookie setCookie(Cookie cookie) { return response.setCookie(cookie); }
/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * * @param cookie this is the cookie to be added to the response * * @return returns the cookie that has been set in the response */ public Cookie setCookie(Cookie cookie) { return response.setCookie(cookie); }
/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * * @param cookie this is the cookie to be added to the response * * @return returns the cookie that has been set in the response */ public Cookie setCookie(Cookie cookie) { return response.setCookie(cookie); }
/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * This is a convenience method that avoids cookie creation. * * @param name this is the cookie to be added to the response * @param value this is the cookie value that is to be used * * @return returns the cookie that has been set in the response */ public Cookie setCookie(String name, String value) { return response.setCookie(name, value); }
/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * This is a convenience method that avoids cookie creation. * * @param name this is the cookie to be added to the response * @param value this is the cookie value that is to be used * * @return returns the cookie that has been set in the response */ public Cookie setCookie(String name, String value) { return response.setCookie(name, value); }
/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * This is a convenience method that avoids cookie creation. * * @param name this is the cookie to be added to the response * @param value this is the cookie value that is to be used * * @return returns the cookie that has been set in the response */ public Cookie setCookie(String name, String value) { return response.setCookie(name, value); }
@Override public Cookie setCookie( String name, String value ) { org.simpleframework.http.Cookie c = baseResponse.setCookie( name, value ); return new SimpletonCookie( c ); }
public void setCookie(String name, String value) { Cookie cookie = new Cookie(name, value); response.setCookie(cookie); }
@Override public RestxResponse addCookie(String cookie, String value, RestxSessionCookieDescriptor cookieDescriptor, Duration expiration) { Cookie c = new Cookie(cookie, value, "/"); c.setExpiry(expiration.getStandardSeconds() > 0 ? (int) expiration.getStandardSeconds() : -1); if(cookieDescriptor.getDomain().isPresent()) { c.setDomain(cookieDescriptor.getDomain().get()); } if(cookieDescriptor.getSecure().isPresent()) { c.setSecure(cookieDescriptor.getSecure().get().booleanValue()); } response.setCookie(c); return this; }
@Override public RestxResponse clearCookie(String cookie, RestxSessionCookieDescriptor cookieDescriptor) { Cookie c = new Cookie(cookie, ""); c.setPath("/"); c.setExpiry(0); if(cookieDescriptor.getDomain().isPresent()) { c.setDomain(cookieDescriptor.getDomain().get()); } if(cookieDescriptor.getSecure().isPresent()) { c.setSecure(cookieDescriptor.getSecure().get().booleanValue()); } response.setCookie(c); return this; }
@Override public RestxResponse clearCookie(String cookie, RestxSessionCookieDescriptor cookieDescriptor) { Cookie c = new Cookie(cookie, ""); c.setPath("/"); c.setExpiry(0); if(cookieDescriptor.getDomain().isPresent()) { c.setDomain(cookieDescriptor.getDomain().get()); } if(cookieDescriptor.getSecure().isPresent()) { c.setSecure(cookieDescriptor.getSecure().get().booleanValue()); } response.setCookie(c); return this; }
@Override public RestxResponse addCookie(String cookie, String value, RestxSessionCookieDescriptor cookieDescriptor, Duration expiration) { Cookie c = new Cookie(cookie, value, "/"); c.setExpiry(expiration.getStandardSeconds() > 0 ? (int) expiration.getStandardSeconds() : -1); if(cookieDescriptor.getDomain().isPresent()) { c.setDomain(cookieDescriptor.getDomain().get()); } if(cookieDescriptor.getSecure().isPresent()) { c.setSecure(cookieDescriptor.getSecure().get().booleanValue()); } response.setCookie(c); return this; }
public void createNewSession(Request request, Response response, Route route, SessionHandler sessionHandler, UnmarshallerProvider unmarshallerProvider) { Session session = new Session(); sessionHandler.onCreate(new SimpleHttpRequest(request, session, route, unmarshallerProvider)); sessions.put(session.getSessionId(), session); Cookie cookie = new Cookie(SESSION_COOKIE_NAME, session.getSessionId()); response.setCookie(cookie); } }
@Override public Cookie setCookie( Cookie cookie ) { if( cookie instanceof SimpletonCookie) { SimpletonCookie sc = (SimpletonCookie) cookie; baseResponse.setCookie( sc.getWrapped()); return cookie; } else { org.simpleframework.http.Cookie c = new org.simpleframework.http.Cookie( cookie.getName(), cookie.getValue()); c.setDomain( cookie.getDomain()); c.setExpiry( cookie.getExpiry()); c.setPath( cookie.getPath()); c.setSecure( cookie.getSecure()); c.setVersion( cookie.getVersion()); baseResponse.setCookie( c ); return new SimpletonCookie( c ); } }
@Override public void setCookie(Cookie newCookie) { CookieDate cookieDate = new CookieDate(); org.simpleframework.http.Cookie cookie = new org.simpleframework.http.Cookie(newCookie.name(), newCookie.value(), newCookie.path(), newCookie.isNew()) { @Override public String toString() { return getName() + "=" + getValue() + "; version=" + getVersion() + (getPath() == null ? "" : "; path=" + getPath()) + (getDomain() == null ? "" : "; domain=" + getDomain()) + (getExpiry() < 0 ? "" : "; expires=" + cookieDate.format(getExpiry())) + (getExpiry() < 0 ? "" : "; max-age=" + getExpiry()) + (isSecure() ? "; secure" : "") + (isProtected() ? "; httponly" : ""); } }; cookie.setExpiry(newCookie.expiry()); cookie.setVersion(newCookie.version()); cookie.setSecure(newCookie.isSecure()); cookie.setProtected(newCookie.isHttpOnly()); cookie.setDomain(newCookie.domain()); response.setCookie(cookie); }