Permalink
Browse files

Add Faces#refresh() and #refreshWithQueryString().

  • Loading branch information...
BalusC committed Jul 17, 2015
1 parent 811a543 commit 572c118a0faa1ef63e1635ef1ba4451d4a3ad81b
Showing with 43 additions and 0 deletions.
  1. +27 −0 src/main/java/org/omnifaces/util/Faces.java
  2. +16 −0 src/main/java/org/omnifaces/util/FacesLocal.java
@@ -1171,6 +1171,33 @@ public static void redirectPermanent(String url, String... paramValues) {
FacesLocal.redirectPermanent(getContext(), url, paramValues);
}
/**
* Refresh the current page by a GET request. This basically sends a temporary (302) redirect to current request
* URI, without query string.
* @throws IOException Whenever something fails at I/O level. The caller should preferably not catch it, but just
* redeclare it in the action method. The servletcontainer will handle it.
* @see ExternalContext#redirect(String)
* @see HttpServletRequest#getRequestURI()
* @since 2.2
*/
public static void refresh() throws IOException {
FacesLocal.refresh(getContext());
}
/**
* Refresh the current page by a GET request, maintaining the query string. This basically sends a temporary (302)
* redirect to current request URI, with the current query string.
* @throws IOException Whenever something fails at I/O level. The caller should preferably not catch it, but just
* redeclare it in the action method. The servletcontainer will handle it.
* @see ExternalContext#redirect(String)
* @see HttpServletRequest#getRequestURI()
* @see HttpServletRequest#getQueryString()
* @since 2.2
*/
public static void refreshWithQueryString() throws IOException {
FacesLocal.refreshWithQueryString(getContext());
}
/**
* Sends a HTTP response error with the given status and message. This will end up in either a custom
* <code>&lt;error-page&gt;</code> whose <code>&lt;error-code&gt;</code> matches the given status, or in a servlet
@@ -887,6 +887,22 @@ public static void redirectPermanent(FacesContext context, String url, String...
context.responseComplete();
}
/**
* {@inheritDoc}
* @see Faces#refresh()
*/
public static void refresh(FacesContext context) throws IOException {
redirect(context, getRequestURI(context));
}
/**
* {@inheritDoc}
* @see Faces#refreshWithQueryString()
*/
public static void refreshWithQueryString(FacesContext context) throws IOException {
redirect(context, getRequestURIWithQueryString(context));
}
/**
* {@inheritDoc}
* @see Faces#responseSendError(int, String)

0 comments on commit 572c118

Please sign in to comment.