/** * Append one more annotation (with default "value" property). * @param type Type of annotation * @param value Value to use for property * @return This object */ public Annotations append(final Class<?> type, final String value) { return this.append(type, "value", value); } }
/** * Make this cookie temporary, with 90 days age. * @return This object */ public CookieBuilder temporary() { // @checkstyle MagicNumber (1 line) this.days(90); return this; }
/** * Supplementary inset. * @return The inset */ @Inset.Runtime public final Inset insetSupplementary() { return new Inset() { @Override public void render(final BasePage<?, ?> page, final Response.ResponseBuilder builder) { builder.type(MediaType.TEXT_XML); builder.header(HttpHeaders.VARY, "Cookie"); } }; }
/** * 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(); }
@Override public void render(final BasePage<?, ?> page, final Response.ResponseBuilder builder) { if (!BaseRs.this.auth().identity().equals(Identity.ANONYMOUS)) { page.link(new Link("menu:home", "/")); page.link(new Link("menu:counters", "/counters")); page.link(new Link("menu:locks", "/k")); } } };
/** * Flash. * @return The inset with flash */ @Inset.Runtime public final FlashInset flash() { return new FlashInset(this); }
/** * Set URI Info. Should be called by JAX-RS implementation * because of {@code @Context} annotation. * @param info The info to inject */ @Context public final void setUriInfo(@NotNull final UriInfo info) { if (this.needsForwarding()) { this.uri = new ForwardedUriInfo(info, this.hdrs); } else { this.uri = info; } }
/** * Get SSL or non-SSL flag. * @return The flag */ @XmlAttribute public final boolean isSsl() { return this.home().securityContext().isSecure(); }
/** * Add new child XML element. * @param nam The name of child element * @return The child bundle (use {@link #up()} on it in order to get back to * the parent bundle) */ @NotNull public JaxbBundle add(@NotNull final String nam) { return this.add(nam, ""); }
@Override @NotNull public final Providers providers() { this.assertNotNull( this.iproviders, "%[type]s#providers was never injected by JAX-RS" ); return this.iproviders; }
/** * Flash. * @return The inset with flash */ @Inset.Runtime public final FlashInset flash() { return new FlashInset(this); }
/** * Supplementary inset. * @return The inset */ @Inset.Runtime public final Inset supplementary() { return new Inset() { @Override public void render(final BasePage<?, ?> page, final Response.ResponseBuilder builder) { builder.header("X-Sttc-Version", BaseRs.VERSION_LABEL); builder.type(MediaType.TEXT_XML); builder.header(HttpHeaders.VARY, "Cookie"); } }; }
@Override @NotNull public final UriInfo uriInfo() { this.assertNotNull( this.uri, "%[type]s#uriInfo was never injected by JAX-RS" ); return this.uri; }
@Override @NotNull public final HttpServletRequest httpServletRequest() { this.assertNotNull( this.req, "%[type]s#httpRequest was never injected by JAX-RS" ); return this.req; }