@Test public void whenThereIsNoRefererShouldThrowExceptionOnForward() throws Exception { when(request.getHeader("Referer")).thenReturn(null); try { refererResult.forward(); fail("Expected IllegalStateException"); } catch (IllegalStateException e) { } }
public void forward() throws IllegalStateException { String referer = getReferer(); try { ResourceMethod method = router.parse(referer, HttpMethod.GET, request); executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType())); } catch (ResourceNotFoundException e) { result.use(page()).forwardTo(referer); } catch (MethodNotAllowedException e) { result.use(page()).forwardTo(referer); } }
DefaultRefererResult implements RefererResult { public void forward() throws IllegalStateException { String referer = getReferer(); try { ResourceMethod method = router.parse(referer, HttpMethod.GET, request); executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType())); } catch (ResourceNotFoundException e) { result.use(page()).forwardTo(referer); } catch (MethodNotAllowedException e) { result.use(page()).forwardTo(referer); } } }
DefaultRefererResult implements RefererResult { public void forward() throws IllegalStateException { String referer = getReferer(); try { ResourceMethod method = router.parse(referer, HttpMethod.GET, request); executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType())); } catch (ResourceNotFoundException e) { result.use(page()).forwardTo(referer); } catch (MethodNotAllowedException e) { result.use(page()).forwardTo(referer); } } DefaultRefererResult(Result result, MutableRequest request, Router router,
				ParametersProvider provider, Localization localization); }
DefaultRefererResult implements RefererResult { public void forward() throws IllegalStateException { String referer = getReferer(); try { ResourceMethod method = router.parse(referer, HttpMethod.GET, request); executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType())); } catch (ResourceNotFoundException e) { result.use(page()).forwardTo(referer); } catch (MethodNotAllowedException e) { result.use(page()).forwardTo(referer); } } DefaultRefererResult(Result result, MutableRequest request, Router router,
				ParametersProvider provider, Localization localization); void forward(); void redirect(); }
DefaultRefererResult implements RefererResult { public void forward() throws IllegalStateException { String referer = getReferer(); try { ResourceMethod method = router.parse(referer, HttpMethod.GET, request); executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType())); } catch (ResourceNotFoundException e) { result.use(page()).forwardTo(referer); } catch (MethodNotAllowedException e) { result.use(page()).forwardTo(referer); } } DefaultRefererResult(Result result, MutableRequest request, Router router,
				ParametersProvider provider, Localization localization); void forward(); void redirect();  }