Package javax.ws.rs.core.Response

Examples of javax.ws.rs.core.Response.ResponseBuilder.location()


    public String isSecure(@Context UriInfo uriInfo) {
        if (!this.securityContext.isSecure()) {
            final ResponseBuilder rb = Response
                    .status(Status.MOVED_PERMANENTLY);
            rb.entity("You must use a secure connection");
            rb.location(uriInfo.getRequestUriBuilder().scheme("https").build());
            throw new WebApplicationException(rb.build());
        }
        return "wonderful! It's a secure request.";
    }
View Full Code Here


    try {
      URL absoluteUrl = new URL(baseUrl, uriString);
      final URI uri = absoluteUrl.toURI();
      ResponseBuilder responseBuilder = Response.status(Response.Status.SEE_OTHER);
      responseBuilder = responseBuilder.entity(htmlBody);
      responseBuilder = responseBuilder.location(uri);
      return responseBuilder.build();
    } catch (URISyntaxException ex) {
      throw new RuntimeException(ex);
    } catch (MalformedURLException ex) {
      throw new RuntimeException(ex);
View Full Code Here

        try {
            URL absoluteUrl = new URL(baseUrl, uriString);
            final URI uri = absoluteUrl.toURI();
            ResponseBuilder responseBuilder = Response.status(Response.Status.SEE_OTHER);
            responseBuilder = responseBuilder.entity(htmlBody);
            responseBuilder = responseBuilder.location(uri);
            return responseBuilder.build();
        } catch (URISyntaxException ex) {
            throw new RuntimeException(ex);
        } catch (MalformedURLException ex) {
            throw new RuntimeException(ex);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.