Refine search
@GET public Response redirectIndexHtml( @HeaderParam(X_FORWARDED_PROTO) String proto, @Context UriInfo uriInfo) { if (isNullOrEmpty(proto)) { proto = uriInfo.getRequestUri().getScheme(); } return Response.status(MOVED_PERMANENTLY) .location(uriInfo.getRequestUriBuilder().scheme(proto).path("/ui/").build()) .build(); } }
public Response.ResponseBuilder responseBuilder() { final Response.ResponseBuilder builder = Response.status(status).cacheControl(cacheControl).tag(eTag).entity(build()).type(APPLICATION_XML); final List<Link> c = getCreated(); final List<Link> u = getUpdated(); if (c.size() == 1 && u.isEmpty()) { builder.location(c.get(0).getHref()); } else if (u.size() == 1 && c.isEmpty()) { builder.location(u.get(0).getHref()); } return builder; }
/** Redirect to /networks if the user does not supply a network ID. */ @GET @Path(CoordConstsV2.RSC_NETWORK) public Response redirectNetwork() { _logger.info("WMS2:redirect network\n"); return Response.status(Status.MOVED_PERMANENTLY) .location(_uriInfo.getRequestUri().resolve(CoordConstsV2.RSC_NETWORKS)) .build(); }
public static Response formatRedirect( final URI uri, final Consumer<ResponseBuilder> builderModifier ) throws URISyntaxException { ResponseBuilder builder = Response.status( Status.MOVED_PERMANENTLY ).location( uri ); if ( builderModifier != null ) { builderModifier.accept( builder ); } return builder.build(); }
@GET @Path("screenshot/{pluginKey}.png") @Produces("image/png") public Response getScreenshot(@PathParam("pluginKey") String pluginKey) throws UnauthorizedAccessException, URISyntaxException { String user = userManager.getRemoteUsername(); String url = speakeasyService.getScreenshotUrl(pluginKey, user); return Response.status(301).location(new URI(url)).build(); }
@GET @Path("/logout") public Response logout(@Context UriInfo uriInfo, @Context RoutingContext ctx, @Context AppGlobals globals) { ctx.clearUser(); UriBuilder builder = uriInfo.getBaseUriBuilder(); URI rootUri = builder.path(globals.getMainClass()).build(); return Response.status(Status.FOUND).location(rootUri).build(); } }
@POST public Response redirectCreation(@Context UriInfo uriInfo) { ActiveMQRestLogger.LOGGER.debug("Handling POST request for \"" + uriInfo.getPath() + "\""); String id = generateDupId(); Response.ResponseBuilder res = Response.status(Response.Status.TEMPORARY_REDIRECT.getStatusCode()); res.location(uriInfo.getAbsolutePathBuilder().path(id).build()); return res.build(); } }
@POST public Response redirectCreation(@Context UriInfo uriInfo) { ActiveMQRestLogger.LOGGER.debug("Handling POST request for \"" + uriInfo.getPath() + "\""); String id = generateDupId(); Response.ResponseBuilder res = Response.status(Response.Status.TEMPORARY_REDIRECT.getStatusCode()); res.location(uriInfo.getAbsolutePathBuilder().path(id).build()); return res.build(); } }
/** * Construct a new redirection exception. * * @param status redirection status. Must be a {@code 3xx} redirection code. * @param location redirection URI placed into the response {@code Location} header. * @throws IllegalArgumentException in case the status code is {@code null} or is not from * {@link javax.ws.rs.core.Response.Status.Family#REDIRECTION} status code * family. */ public RedirectionException(Response.Status status, URI location) { super((Throwable) null, validate(Response.status(status).location(location).build(), Response.Status.Family.REDIRECTION)); }