コード例 #1
0
 public static void redirect(FacesContext context, String path) {
   RedirectScope.setRedirectingPath(context, path);
   ExternalContext externalContext = context.getExternalContext();
   try {
     externalContext.redirect(externalContext.encodeActionURL(path));
   } catch (IOException e) {
     throw new FacesException(e.getMessage(), e);
   }
   context.responseComplete();
   context.renderResponse();
 }
コード例 #2
0
 // For S2JSF redirect, we do not need this check.
 public static void assertNotAlreadyRedirect(FacesContext context) {
   Map scope = RedirectScope.getOrCreateContext(context);
   List list = (List) scope.get(KEY);
   if (list == null) {
     list = new ArrayList();
     scope.put(KEY, list);
   }
   String viewId = context.getViewRoot().getViewId();
   if (list.contains(viewId)) {
     throw new AlreadyRedirectingException();
   }
   list.add(viewId);
 }