@Test(dataProvider = "methods") public void testRequestUnmodifiedWithNoOverride(String method) { OverrideMethodFilter filter = new OverrideMethodFilter(); ContainerRequest request = new ContainerRequest( URI.create("http: URI.create("http: method, new MockSecurityContext(), new MockPropertiesDelegate()); filter.filter(request); assertEqualsIgnoreCase(request.getMethod(), method); }
@Override public void filter(ContainerRequestContext request) { String method = request.getHeaders().getFirst(HEADER); if (Strings.isNullOrEmpty(method)) { method = request.getUriInfo().getQueryParameters().getFirst(METHOD_PARAM); } if (!Strings.isNullOrEmpty(method)) { if (request.getMethod().equalsIgnoreCase("POST")) { request.setMethod(method); } else { throw new WebApplicationException(Response.Status.BAD_REQUEST); } } }
OverrideMethodFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext request) { String method = request.getHeaders().getFirst(HEADER); if (Strings.isNullOrEmpty(method)) { method = request.getUriInfo().getQueryParameters().getFirst(METHOD_PARAM); } if (!Strings.isNullOrEmpty(method)) { if (request.getMethod().equalsIgnoreCase("POST")) { request.setMethod(method); } else { throw new WebApplicationException(Response.Status.BAD_REQUEST); } } } }
OverrideMethodFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext request) { String method = request.getHeaders().getFirst(HEADER); if (Strings.isNullOrEmpty(method)) { method = request.getUriInfo().getQueryParameters().getFirst(METHOD_PARAM); } if (!Strings.isNullOrEmpty(method)) { if (request.getMethod().equalsIgnoreCase("POST")) { request.setMethod(method); } else { throw new WebApplicationException(Response.Status.BAD_REQUEST); } } }  }
OverrideMethodFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext request) { String method = request.getHeaders().getFirst(HEADER); if (Strings.isNullOrEmpty(method)) { method = request.getUriInfo().getQueryParameters().getFirst(METHOD_PARAM); } if (!Strings.isNullOrEmpty(method)) { if (request.getMethod().equalsIgnoreCase("POST")) { request.setMethod(method); } else { throw new WebApplicationException(Response.Status.BAD_REQUEST); } } }  @Override void filter(ContainerRequestContext request); }
OverrideMethodFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext request) { String method = request.getHeaders().getFirst(HEADER); if (Strings.isNullOrEmpty(method)) { method = request.getUriInfo().getQueryParameters().getFirst(METHOD_PARAM); } if (!Strings.isNullOrEmpty(method)) { if (request.getMethod().equalsIgnoreCase("POST")) { request.setMethod(method); } else { throw new WebApplicationException(Response.Status.BAD_REQUEST); } } }  @Override void filter(ContainerRequestContext request); static final String HEADER; static final String METHOD_PARAM; }