public class JsfUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JsfUtil.PersistAction |
| Constructor and Description |
|---|
JsfUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addErrorMessage(Exception ex,
String defaultMsg) |
static void |
addErrorMessage(String msg)
uses null as clientId
|
static void |
addErrorMessage(String clientId,
String msg) |
static void |
addErrorMessages(List<String> messages) |
static void |
addSuccessMessage(String msg)
Uses successInfo as client id
|
static void |
addSuccessMessage(String clientId,
String msg) |
static String |
contextPath() |
static Throwable |
deepestCause(Throwable t)
Deprecated.
|
static <T> T |
findInContext(Class<T> clazz)
Calls
findInContext(java.lang.String, java.lang.Class) with clazz.simpleName, first letter lowerCase |
static <T> T |
findInContext(String name,
Class<T> clazz) |
static <T> T |
findOrCreateInContext(String name,
Class<T> clazz) |
static Principal |
findPrinciple()
Deprecated.
inject
SecurityContext |
static String |
fullServletPath()
context path plus servlet path
|
static javax.faces.convert.Converter |
getConverter(Class clazz) |
static javax.faces.convert.Converter |
getConverter(String id,
Class clazz) |
static ResourceBundle |
getLocaleBundle(String bundle)
return a resource for the current locale (from faces context or default locale), or an empty bundle
|
static Object |
getObjectFromRequestParameter(String requestParameterName,
javax.faces.convert.Converter converter,
javax.faces.component.UIComponent component) |
static String |
getRequestParameter(String key) |
static javax.faces.model.SelectItem[] |
getSelectItems(List entities,
boolean selectOne) |
static void |
handleException(Exception ex,
String prefix)
Calls
FacesContext.validationFailed(), deepestCause(java.lang.Throwable) and addErrorMessage(java.lang.String) with the prefix and the
localized message from the exception. |
static boolean |
isValidationFailed() |
static void |
logout() |
static boolean |
mayEdit()
|
static boolean |
mayEdit(String role)
Deprecated.
inject
SecurityContext and use that |
static void |
registerConverter(String id,
Class clazz) |
static String |
split(String toSplit,
int index)
Deprecated.
|
static String |
split(String toSplit,
int index,
boolean ignorePatternAfterIndex)
Deprecated.
|
static String |
split(String toSplit,
String regex,
int index,
boolean ignorePatternAfterIndex)
Deprecated.
|
public static void handleException(Exception ex, String prefix)
FacesContext.validationFailed(), deepestCause(java.lang.Throwable) and addErrorMessage(java.lang.String) with the prefix and the
localized message from the exception. Logs the exception at level
WARNING.ex - prefix - public static javax.faces.model.SelectItem[] getSelectItems(List entities, boolean selectOne)
public static boolean isValidationFailed()
public static void addErrorMessage(String msg)
msg - public static void addSuccessMessage(String msg)
msg - public static Object getObjectFromRequestParameter(String requestParameterName, javax.faces.convert.Converter converter, javax.faces.component.UIComponent component)
public static <T> T findInContext(Class<T> clazz)
findInContext(java.lang.String, java.lang.Class) with clazz.simpleName, first letter lowerCaseT - clazz - public static javax.faces.convert.Converter getConverter(Class clazz)
public static String fullServletPath()
public static String contextPath()
@Deprecated public static String split(String toSplit, int index)
split(java.lang.String, int, boolean) with false.toSplit - index - @Deprecated public static String split(String toSplit, int index, boolean ignorePatternAfterIndex)
split(java.lang.String, java.lang.String, int, boolean)
with ": ?" as regex.toSplit - index - ignorePatternAfterIndex - @Deprecated public static String split(String toSplit, String regex, int index, boolean ignorePatternAfterIndex)
toSplit - index - ignorePatternAfterIndex - when true, occurring ": ?" patterns after
index will be ignored, so the return value will be the rest of the input
string.@Deprecated public static Throwable deepestCause(Throwable t)
public static Principal findPrinciple()
SecurityContextpublic static void logout()
throws javax.servlet.ServletException
javax.servlet.ServletExceptionpublic static ResourceBundle getLocaleBundle(String bundle)
bundle - public static boolean mayEdit()
public static boolean mayEdit(String role)
SecurityContext and use thatRolesAllowed setup.Copyright © 2018 Fryske Akademy. All rights reserved.