Package javax.ws.rs.core.Response

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


            builder.header("ServerReaderInterceptor", serverInterceptorHeader);
        }
        if (clientInterceptorHeader != null) {
            builder.header("ClientWriterInterceptor", clientInterceptorHeader);
        }
        return builder.build();
    }
   
    @POST
    @Path("/bookheaders/simple/")
    @CustomHeaderAdded
View Full Code Here


        }
        if (clientInterceptorHeader != null) {
            builder.header("ClientWriterInterceptor", clientInterceptorHeader);
        }
        builder.header("newmediatypeused", ct);
        return builder.build();
    }
   
    private ResponseBuilder getBookByHeaderSimpleBuilder(@HeaderParam("BOOK") String headerBook,
        @HeaderParam("Simple") String headerSimple) throws Exception {
       
View Full Code Here

            ResponseBuilder builder = Response.status(returnCode).header("BOOK-HEADER", msg);
           
            if (returnCode == 404) {
                builder.type("text/plain").entity(msg);
            }
            throw new WebApplicationException(builder.build());
        }
    
        if (!ignoreJaxrsClient) {
            if (!invocationInProcess) {
                invocationInProcess = true;
View Full Code Here

                                                   convertTypesToString(acceptContentTypes));
        if (!"OPTIONS".equalsIgnoreCase(httpMethod) && logNow) {
            LOG.warning(errorMsg.toString());
        }
        ResponseBuilder rb = createResponseBuilder(resource, status, methodMatched == 0);
        throw new WebApplicationException(rb.build());
       
    }   
   
    private static void logNoMatchMessage(OperationResourceInfo ori,
        String path, String httpMethod, MediaType requestType, List<MediaType> acceptContentTypes) {
View Full Code Here

           
            Object entity = readBody(currentResponse, conn, outMessage, responseClass, genericType,
                                     new Annotation[]{});
            rb.entity(entity);
           
            return rb.build();
        } catch (Throwable ex) {
            throw new WebApplicationException(ex);
        }
    }
   
View Full Code Here

        final String message = ex.getMessage();
        if (message != null) {
            builder.header(RestfulResponse.Header.WARNING.getName(), RestfulResponse.Header.WARNING.render(message));
        }
        return builder.build();
    }

    private static class ExceptionPojo {

        public static ExceptionPojo create(final Throwable ex) {
View Full Code Here

        if(ex instanceof Failure) {
            Failure failure = (Failure) ex;
            statusCode = HttpStatusCode.statusFor(failure.getErrorCode());
        }
        final ResponseBuilder builder = Response.status(statusCode.getJaxrsStatusType()).type(RestfulMediaType.APPLICATION_JSON_ERROR).entity(jsonFor(ex));
        return builder.build();
    }

    private static class ExceptionPojo {

        public static ExceptionPojo create(final Exception ex) {
View Full Code Here

            if (effectiveExposeHeaders != null) {
                addHeaders(rbuilder, CorsHeaderConstants.HEADER_AC_EXPOSE_HEADERS,
                           effectiveExposeHeaders, false);
            }
            // if someone wants to clear the cache, we can't help them.
            return rbuilder.build();
        } else {
            // 5.2.8 max-age
            String maValue = (String)m.getExchange().get(CorsHeaderConstants.HEADER_AC_MAX_AGE);
            if (maValue != null) {
                rbuilder.header(CorsHeaderConstants.HEADER_AC_MAX_AGE, maValue);
View Full Code Here

            List<String> rqAllowedHeaders = getHeadersFromInput(m,
                                                                CorsHeaderConstants.HEADER_AC_ALLOW_HEADERS);
            if (rqAllowedHeaders != null) {
                addHeaders(rbuilder, CorsHeaderConstants.HEADER_AC_ALLOW_HEADERS, rqAllowedHeaders, false);
            }
            return rbuilder.build();

        }
    }

    private boolean effectiveAllowAllOrigins(CrossOriginResourceSharing ann) {
View Full Code Here

            Object entity = readBody(currentResponse, outMessage, responseClass, genericType,
                                     new Annotation[]{});
            rb.entity(entity instanceof Response
                      ? ((Response)entity).getEntity() : entity);
           
            return rb.build();
        } catch (Throwable ex) {
            throw (ex instanceof ClientWebApplicationException) ? (ClientWebApplicationException)ex
                                                              : new ClientWebApplicationException(ex);
        } finally {
            ProviderFactory.getInstance(outMessage).clearThreadLocalProxies();
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.