Package javax.ws.rs.core

Examples of javax.ws.rs.core.Request


        service.setLastModified(DATE_OLD);
    }

    @Test
    public void testUnconditional200() {
        final Request request = getRequest();
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    }
View Full Code Here


    }

    @Test
    public void testIfModified200() {
        service.setLastModified(DATE_NEW);
        final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, DATE_FMT_822.format(DATE_OLD));
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    }
View Full Code Here

        Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    }

    @Test
    public void testIfNoneMatch304() {
        final Request request = getRequest(HttpHeaders.IF_NONE_MATCH, ETAG_OLD.toString());
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
    }
View Full Code Here

        Assert.assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
    }

    @Test
    public void testIfNoneMatch200() {
        final Request request = getRequest(HttpHeaders.IF_NONE_MATCH, ETAG_NEW.toString());
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    }
View Full Code Here

        Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
    }

    @Test
    public void testIfModified304() {
        final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, DATE_FMT_822.format(DATE_NEW));
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
    }
View Full Code Here

        Assert.assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
    }

    @Test
    public void testIfNoneMatchIfModified304() {
        final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, DATE_FMT_822.format(DATE_OLD),
                                           HttpHeaders.IF_NONE_MATCH, ETAG_OLD.toString());
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
    }
View Full Code Here

        // RFC 2616 / section 14.26
        // "If none of the entity tags match, then the server MAY perform the requested method as
        // if the If-None-Match header field did not exist, but MUST also ignore any If-Modified-Since
        // header field(s) in the request. That is, if no entity tags match, then the server MUST NOT
        // return a 304 (Not Modified) response."
        final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, DATE_FMT_822.format(DATE_OLD),
                                           HttpHeaders.IF_NONE_MATCH, ETAG_NEW.toString()); // ETags don't
                                                                                            // match,
                                                                                            // If-Modified-Since
                                                                                            // must be ignored
        final Response response = service.perform(request);
View Full Code Here

        // in the response to a similar GET request (without the If-None-Match header) on that resource,
        // or if "*" is given and any current entity exists for that resource, then the server MUST NOT
        // perform the requested method, unless required to do so because the resource's modification date
        // fails to match that supplied in an If-Modified-Since header field in the request"
        service.setLastModified(DATE_NEW);
        final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, DATE_FMT_822.format(DATE_OLD),
                                           HttpHeaders.IF_NONE_MATCH, ETAG_NEW.toString()); // ETags match,
                                                                                            // but resource
                                                                                            // has new date
        final Response response = service.perform(request);
        Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
View Full Code Here

        // binding context fields
        for (Field field : cri.getContextFields()) {
            Class<?> type = field.getType();
            if (Request.class.equals(type)) {
                Request binding = JAXRSUtils.createContextValue(exchange.getInMessage(), null, Request.class);
                ThreadLocalContextManager.REQUEST.set(binding);
            } else if (UriInfo.class.equals(type)) {
                UriInfo binding = JAXRSUtils.createContextValue(exchange.getInMessage(), null, UriInfo.class);
                ThreadLocalContextManager.URI_INFO.set(binding);
            } else if (HttpHeaders.class.equals(type)) {
View Full Code Here

        EXCHANGE.set(exchange); // used in lazy mode by RESTResourceFinder if cdi beans uses @Context, === initThreadLocal
        CdiAppContextsService.pushRequestReleasable(CleanUpThreadLocal.INSTANCE);

        for (final Class<?> type : types) {
            if (Request.class.equals(type)) {
                final Request binding = JAXRSUtils.createContextValue(exchange.getInMessage(), null, Request.class);
                ThreadLocalContextManager.REQUEST.set(binding);
            } else if (UriInfo.class.equals(type)) {
                final UriInfo binding = JAXRSUtils.createContextValue(exchange.getInMessage(), null, UriInfo.class);
                ThreadLocalContextManager.URI_INFO.set(binding);
            } else if (HttpHeaders.class.equals(type)) {
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.Request

Copyright © 2018 www.massapicom. 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.