@Test void testWebSubNull() { when(mockRequest.getMethod()).thenReturn(GET); when(mockResponse.getStatusInfo()).thenReturn(OK); final WebSubHeaderFilter filter = new WebSubHeaderFilter(); filter.filter(mockRequest, mockResponse); verify(mockResponse, never()).getHeaders(); }
@Override public void filter(final ContainerRequestContext req, final ContainerResponseContext res) { if ((GET.equals(req.getMethod()) || HEAD.equals(req.getMethod())) && SUCCESSFUL.equals(res.getStatusInfo().getFamily()) && hub != null) { res.getHeaders().add(LINK, fromUri(hub).rel("hub").build()); } }
WebSubHeaderFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext req, final ContainerResponseContext res) { if ((GET.equals(req.getMethod()) || HEAD.equals(req.getMethod())) && SUCCESSFUL.equals(res.getStatusInfo().getFamily()) && hub != null) { res.getHeaders().add(LINK, fromUri(hub).rel("hub").build()); } } }
WebSubHeaderFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext req, final ContainerResponseContext res) { if ((GET.equals(req.getMethod()) || HEAD.equals(req.getMethod())) && SUCCESSFUL.equals(res.getStatusInfo().getFamily()) && hub != null) { res.getHeaders().add(LINK, fromUri(hub).rel("hub").build()); } } WebSubHeaderFilter(); }
WebSubHeaderFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext req, final ContainerResponseContext res) { if ((GET.equals(req.getMethod()) || HEAD.equals(req.getMethod())) && SUCCESSFUL.equals(res.getStatusInfo().getFamily()) && hub != null) { res.getHeaders().add(LINK, fromUri(hub).rel("hub").build()); } } WebSubHeaderFilter(); void setHub(final String hub); @Override void filter(final ContainerRequestContext req, final ContainerResponseContext res); }
WebSubHeaderFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext req, final ContainerResponseContext res) { if ((GET.equals(req.getMethod()) || HEAD.equals(req.getMethod())) && SUCCESSFUL.equals(res.getStatusInfo().getFamily()) && hub != null) { res.getHeaders().add(LINK, fromUri(hub).rel("hub").build()); } } WebSubHeaderFilter(); void setHub(final String hub); @Override void filter(final ContainerRequestContext req, final ContainerResponseContext res); static final String CONFIG_HTTP_WEB_SUB_HUB; }