/** * Public ctor, from exact values. * @param base Base URI where we're using it * @param message The message * @param level The level * @param msec Milliseconds consumed * @checkstyle ParameterNumber (5 lines) */ public Flash(@NotNull final URI base, @NotNull final String message, @NotNull final Level level, final long msec) { super( new CookieBuilder(base) .name(FlashInset.COOKIE) .value(FlashInset.Flash.encode(message, level, msec)) .temporary() .build() ); Validate.notBlank(message, "flash message can't be empty"); this.msg = message; this.lvl = level; Validate.isTrue( msec >= 0L || msec == -1L, "milliseconds can either be positive or equal to -1" ); this.millis = msec; } /**
/** * Authentication cookie. * @param identity The identity to wrap into the cookie * @return The cookie */ public NewCookie cookie(final Identity identity) { return new CookieBuilder(this.resource.uriInfo().getBaseUri()) .name(AuthInset.AUTH_COOKIE) .value(new Encrypted(identity, this.key).cookie()) .temporary() .build(); }