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) |
static <T> T |
findInContext(String name,
Class<T> clazz) |
static <T> T |
findOrCreateInContext(String name,
Class<T> clazz) |
static Principal |
findPrinciple() |
static String |
fullServletPath()
context path plus servlet path
|
static <T extends javax.faces.convert.Converter> |
getConverter(String id,
Class<T> clazz) |
static ResourceBundle |
getLocaleBundle(String bundle)
return a resource for the current locale
|
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)
checks if user has the role, which allows editing.
|
static <T extends javax.faces.convert.Converter> |
registerConverter(String id,
Class<T> 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 extends javax.faces.convert.Converter> void registerConverter(String id, Class<T> clazz)
public static <T extends javax.faces.convert.Converter> T getConverter(String id, Class<T> 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.public static Principal findPrinciple()
public 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)
Copyright © 2018 Fryske Akademy. All rights reserved.