use of javax.ws.rs.core.Request in project cxf by apache.
the class EvaluatePreconditionsTest method testUnconditional200.
@Test
public void testUnconditional200() {
final Request request = getRequest();
final Response response = service.perform(request);
Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
}
use of javax.ws.rs.core.Request in project cxf by apache.
the class EvaluatePreconditionsTest method testIfNoneMatchIfModified304.
@Test
public void testIfNoneMatchIfModified304() {
final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, dateFormat.format(DATE_OLD), HttpHeaders.IF_NONE_MATCH, ETAG_OLD.toString());
final Response response = service.perform(request);
Assert.assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
}
use of javax.ws.rs.core.Request in project cxf by apache.
the class EvaluatePreconditionsTest method testIfModified200.
@Test
public void testIfModified200() {
service.setLastModified(DATE_NEW);
final Request request = getRequest(HttpHeaders.IF_MODIFIED_SINCE, dateFormat.format(DATE_OLD));
final Response response = service.perform(request);
Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
}
use of javax.ws.rs.core.Request in project cxf by apache.
the class EvaluatePreconditionsTest method testIfNoneMatchIfModified200.
@Test
public void testIfNoneMatchIfModified200() {
// 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, dateFormat.format(DATE_OLD), HttpHeaders.IF_NONE_MATCH, // ETags don't
ETAG_NEW.toString());
// match,
// If-Modified-Since
// must be ignored
final Response response = service.perform(request);
Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
}
Aggregations