public class FacesUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_DOWNLOAD_TOKEN |
| Constructor and Description |
|---|
FacesUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addCookie(String name,
String value)
Add Cookie no HttpServletResponse
|
static void |
addToSession(String attributeName,
Object value)
Add the object in Http session map
|
static void |
clearComponent(javax.faces.component.UIComponent pComponent)
Método responsável por limpar os valores de um determinado componente Ex:
ao passar um form o método vai limpar seus componentes "filhos"
|
static void |
download(byte[] bytes,
String contentType,
String fileName)
Generates a file to download.
|
static void |
download(byte[] bytes,
String contentType,
String fileName,
boolean attachment)
Generates a file to download.
|
static void |
download(InputStream inputStream,
String contentType,
String fileName)
Generates a file to download.
|
static void |
download(InputStream inputStream,
String contentType,
String fileName,
boolean attachment)
Generates a file to download.
|
static <T> T |
evaluateExpressionGet(String expression)
Get a bean form EL context
|
static javax.faces.component.UIComponent |
findComponent(javax.faces.component.UIComponent base,
String id) |
static javax.faces.component.UIComponent |
findComponentInRoot(String id)
Method to find a component in ViewRoot
|
static <T> T |
getBeanByEl(String beanName)
Get a bean form EL context.
|
static String |
getBrowser() |
static javax.servlet.http.Cookie |
getCookie(String cookieName) |
static String |
getCookieValue(String cookieName) |
static javax.faces.context.FacesContext |
getFacesContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Create the FacesContext.
|
static Object |
getFromSession(String attributeName)
Get a object from Http Session
|
static String |
getHtml(javax.faces.component.UIComponent component)
Return generated HTML from component.
|
static String |
getIP() |
static String |
getParameter(String parameterName)
Get the value of the parameter in request callin
HttpServletRequest.getParameter.
|
static String |
getRealPath(String caminho) |
static javax.servlet.http.HttpServletRequest |
getRequest()
Get the current Http request from JSF "ExternalContext"
|
static javax.servlet.http.HttpServletResponse |
getResponse()
Get the current Http response from JSF "ExternalContext"
|
static javax.servlet.ServletContext |
getServletContext()
Get the ServletContext from JSF "ExternalContext
|
static void |
invalidateSession()
Invalidate the current Http session using HttpSession.invalidate()
|
static void |
redirect(String url) |
static void |
removeCookie(String nomeCookie)
Removes Cookie
|
static void |
removeFromSession(String attributeName)
Remove a object from session
|
static void |
setNewValueBean(String beanName,
String attribute,
Object newValue) |
static void |
setValueEl(String expression,
Object newValue) |
public static final String FILE_DOWNLOAD_TOKEN
public static String getHtml(javax.faces.component.UIComponent component)
component - public static Object getFromSession(String attributeName)
attributeName - Object name in sessionpublic static String getParameter(String parameterName)
parameterName - public static void addToSession(String attributeName, Object value)
attributeName - value - public static void removeFromSession(String attributeName)
attributeName - public static void invalidateSession()
public static javax.servlet.http.HttpServletRequest getRequest()
public static javax.servlet.http.HttpServletResponse getResponse()
public static javax.servlet.ServletContext getServletContext()
public static void redirect(String url)
public static <T> T getBeanByEl(String beanName)
T - beanName - public static <T> T evaluateExpressionGet(String expression)
T - expression - public static void setNewValueBean(String beanName, String attribute, Object newValue)
public static void clearComponent(javax.faces.component.UIComponent pComponent)
pComponent - public static void addCookie(String name, String value)
name - value - public static String getBrowser()
public static javax.servlet.http.Cookie getCookie(String cookieName)
public static void removeCookie(String nomeCookie)
nomeCookie - public static javax.faces.component.UIComponent findComponentInRoot(String id)
id - public static javax.faces.component.UIComponent findComponent(javax.faces.component.UIComponent base,
String id)
public static void download(byte[] bytes,
String contentType,
String fileName)
bytes - contentType - fileName - public static void download(byte[] bytes,
String contentType,
String fileName,
boolean attachment)
bytes - contentType - fileName - attachment - indicates attachment in headerpublic static void download(InputStream inputStream, String contentType, String fileName)
inputStream - contentType - fileName - public static void download(InputStream inputStream, String contentType, String fileName, boolean attachment)
inputStream - contentType - fileName - attachment - public static String getIP()
public static javax.faces.context.FacesContext getFacesContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
request - response - Copyright © 2015. All rights reserved.