Package org.gluu.oxauth.util
Class ServerUtil
- java.lang.Object
-
- org.gluu.oxauth.util.ServerUtil
-
public class ServerUtil extends java.lang.Object
- Version:
- 0.9, 26/12/2012
- Author:
- Yuriy Zabrovarnyy, Yuriy Movchan
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
asJson(java.lang.Object p_object)
static java.lang.String
asJsonSilently(java.lang.Object p_object)
static java.lang.String
asPrettyJson(java.lang.Object p_object)
static javax.ws.rs.core.CacheControl
cacheControl(boolean p_noStore)
static javax.ws.rs.core.CacheControl
cacheControl(boolean p_noStore, boolean p_noTransform)
static javax.ws.rs.core.CacheControl
cacheControlWithNoStoreTransformAndPrivate()
static int
calculateTtl(java.util.Date creationDate, java.util.Date expirationDate)
static UmaPermission
convert(UmaPermission permission, UmaScopeService umaScopeService)
static java.util.concurrent.ScheduledExecutorService
createExecutor()
static com.fasterxml.jackson.databind.ObjectMapper
createJsonMapper()
static java.util.concurrent.ThreadFactory
daemonThreadFactory()
static java.lang.Integer
dateToSeconds(java.util.Date date)
static org.gluu.persist.model.base.CustomAttribute
getAttributeByName(java.util.List<org.gluu.persist.model.base.CustomAttribute> p_list, java.lang.String p_attributeName)
static java.lang.String
getAttributeValueByName(java.util.List<org.gluu.persist.model.base.CustomAttribute> p_list, java.lang.String p_attributeName)
static java.lang.String
getFirstValue(java.util.Map<java.lang.String,java.lang.String[]> map, java.lang.String key)
static java.lang.String
getIpAddress(javax.servlet.http.HttpServletRequest httpRequest)
static org.gluu.persist.PersistenceEntryManager
getLdapManager()
static javax.servlet.http.HttpServletRequest
getRequestOrNull()
Safe retrieves http request from FacesContextstatic boolean
isFalse(java.lang.Boolean booleanObject)
static boolean
isSameRequestPath(java.lang.String url1, java.lang.String url2)
static boolean
isTrue(java.lang.Boolean booleanObject)
static com.fasterxml.jackson.databind.ObjectMapper
jsonMapperWithUnwrapRoot()
static com.fasterxml.jackson.databind.ObjectMapper
jsonMapperWithWrapRoot()
static java.util.GregorianCalendar
now()
static java.lang.String
toPrettyJson(org.json.JSONObject jsonObject)
static java.lang.String
urlDecode(java.lang.String p_str)
-
-
-
Method Detail
-
now
public static java.util.GregorianCalendar now()
-
calculateTtl
public static int calculateTtl(java.util.Date creationDate, java.util.Date expirationDate)
-
asJsonSilently
public static java.lang.String asJsonSilently(java.lang.Object p_object)
-
daemonThreadFactory
public static java.util.concurrent.ThreadFactory daemonThreadFactory()
-
isTrue
public static boolean isTrue(java.lang.Boolean booleanObject)
-
isFalse
public static boolean isFalse(java.lang.Boolean booleanObject)
-
asPrettyJson
public static java.lang.String asPrettyJson(java.lang.Object p_object) throws java.io.IOException
- Throws:
java.io.IOException
-
asJson
public static java.lang.String asJson(java.lang.Object p_object) throws java.io.IOException
- Throws:
java.io.IOException
-
cacheControl
public static javax.ws.rs.core.CacheControl cacheControl(boolean p_noStore)
-
cacheControl
public static javax.ws.rs.core.CacheControl cacheControl(boolean p_noStore, boolean p_noTransform)
-
cacheControlWithNoStoreTransformAndPrivate
public static javax.ws.rs.core.CacheControl cacheControlWithNoStoreTransformAndPrivate()
-
createJsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper createJsonMapper()
-
jsonMapperWithWrapRoot
public static com.fasterxml.jackson.databind.ObjectMapper jsonMapperWithWrapRoot()
-
jsonMapperWithUnwrapRoot
public static com.fasterxml.jackson.databind.ObjectMapper jsonMapperWithUnwrapRoot()
-
toPrettyJson
public static java.lang.String toPrettyJson(org.json.JSONObject jsonObject) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getLdapManager
public static org.gluu.persist.PersistenceEntryManager getLdapManager()
-
getAttributeByName
public static org.gluu.persist.model.base.CustomAttribute getAttributeByName(java.util.List<org.gluu.persist.model.base.CustomAttribute> p_list, java.lang.String p_attributeName)
-
getAttributeValueByName
public static java.lang.String getAttributeValueByName(java.util.List<org.gluu.persist.model.base.CustomAttribute> p_list, java.lang.String p_attributeName)
-
urlDecode
public static java.lang.String urlDecode(java.lang.String p_str)
-
createExecutor
public static java.util.concurrent.ScheduledExecutorService createExecutor()
-
convert
public static UmaPermission convert(UmaPermission permission, UmaScopeService umaScopeService)
-
getFirstValue
public static java.lang.String getFirstValue(java.util.Map<java.lang.String,java.lang.String[]> map, java.lang.String key)
-
getIpAddress
public static java.lang.String getIpAddress(javax.servlet.http.HttpServletRequest httpRequest)
- Parameters:
httpRequest
- interface to provide request information for HTTP servlets.- Returns:
- IP address of client
- See Also:
- Getting IP address of client
-
getRequestOrNull
public static javax.servlet.http.HttpServletRequest getRequestOrNull()
Safe retrieves http request from FacesContext- Returns:
- http
-
isSameRequestPath
public static boolean isSameRequestPath(java.lang.String url1, java.lang.String url2) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
dateToSeconds
public static java.lang.Integer dateToSeconds(java.util.Date date)
-
-