public void redirect() throws IllegalStateException { String referer = getReferer(); try { ResourceMethod method = router.parse(referer, HttpMethod.GET, request); executeMethod(method, result.use(logic()).redirectTo(method.getResource().getType())); } catch (ResourceNotFoundException e) { result.use(page()).redirect(referer); } catch (MethodNotAllowedException e) { result.use(page()).redirect(referer); } }
private void tryMovePermanentlyTo(RequestInfo requestInfo, String newUri) { router.parse(newUri, HttpMethod.of(requestInfo.getRequest()), requestInfo.getRequest()); result.permanentlyRedirectTo(newUri); }