@Test public void shouldHandle405() throws IOException, InterceptionException { EnumSet<HttpMethod> allowedMethods = EnumSet.of(HttpMethod.GET); when(translator.translate(info)).thenThrow(new MethodNotAllowedException(allowedMethods, HttpMethod.POST.toString())); lookup.intercept(null, null, null); verify(methodNotAllowedHandler).deny(info, allowedMethods); }
public void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance) throws InterceptionException { try { ResourceMethod method = translator.translate(requestInfo); methodInfo.setResourceMethod(method); stack.next(method, resourceInstance); } catch (ResourceNotFoundException e) { resourceNotFoundHandler.couldntFind(requestInfo); } catch (MethodNotAllowedException e) { LOGGER.debug(e.getMessage(), e); methodNotAllowedHandler.deny(requestInfo, e.getAllowedMethods()); } }
ResourceLookupInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance) throws InterceptionException { try { ResourceMethod method = translator.translate(requestInfo); methodInfo.setResourceMethod(method); stack.next(method, resourceInstance); } catch (ResourceNotFoundException e) { resourceNotFoundHandler.couldntFind(requestInfo); } catch (MethodNotAllowedException e) { LOGGER.debug(e.getMessage(), e); methodNotAllowedHandler.deny(requestInfo, e.getAllowedMethods()); } } }
ResourceLookupInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance) throws InterceptionException { try { ResourceMethod method = translator.translate(requestInfo); methodInfo.setResourceMethod(method); stack.next(method, resourceInstance); } catch (ResourceNotFoundException e) { resourceNotFoundHandler.couldntFind(requestInfo); } catch (MethodNotAllowedException e) { LOGGER.debug(e.getMessage(), e); methodNotAllowedHandler.deny(requestInfo, e.getAllowedMethods()); } } ResourceLookupInterceptor(UrlToResourceTranslator translator, MethodInfo methodInfo,
			ResourceNotFoundHandler resourceNotFoundHandler, MethodNotAllowedHandler methodNotAllowedHandler,
			RequestInfo requestInfo); }
ResourceLookupInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance) throws InterceptionException { try { ResourceMethod method = translator.translate(requestInfo); methodInfo.setResourceMethod(method); stack.next(method, resourceInstance); } catch (ResourceNotFoundException e) { resourceNotFoundHandler.couldntFind(requestInfo); } catch (MethodNotAllowedException e) { LOGGER.debug(e.getMessage(), e); methodNotAllowedHandler.deny(requestInfo, e.getAllowedMethods()); } } ResourceLookupInterceptor(UrlToResourceTranslator translator, MethodInfo methodInfo,
			ResourceNotFoundHandler resourceNotFoundHandler, MethodNotAllowedHandler methodNotAllowedHandler,
			RequestInfo requestInfo); void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance); boolean accepts(ResourceMethod method); }
ResourceLookupInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance) throws InterceptionException { try { ResourceMethod method = translator.translate(requestInfo); methodInfo.setResourceMethod(method); stack.next(method, resourceInstance); } catch (ResourceNotFoundException e) { resourceNotFoundHandler.couldntFind(requestInfo); } catch (MethodNotAllowedException e) { LOGGER.debug(e.getMessage(), e); methodNotAllowedHandler.deny(requestInfo, e.getAllowedMethods()); } } ResourceLookupInterceptor(UrlToResourceTranslator translator, MethodInfo methodInfo,
			ResourceNotFoundHandler resourceNotFoundHandler, MethodNotAllowedHandler methodNotAllowedHandler,
			RequestInfo requestInfo); void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance); boolean accepts(ResourceMethod method);  }