Package io.jans.as.server.util
Class ServerUtil
- java.lang.Object
-
- io.jans.as.server.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 obj)
static java.lang.String
asJsonSilently(java.lang.Object obj)
static java.lang.String
asPrettyJson(java.lang.Object obj)
static javax.ws.rs.core.CacheControl
cacheControl(boolean noStore)
static javax.ws.rs.core.CacheControl
cacheControl(boolean noStore, boolean noTransform)
static javax.ws.rs.core.CacheControl
cacheControlWithNoStoreTransformAndPrivate()
static int
calculateTtl(java.util.Date creationDate, java.util.Date expirationDate)
static io.jans.as.model.uma.UmaPermission
convert(io.jans.as.model.uma.persistence.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 io.jans.orm.model.base.CustomAttribute
getAttributeByName(java.util.List<io.jans.orm.model.base.CustomAttribute> list, java.lang.String attributeName)
static java.lang.String
getAttributeValueByName(java.util.List<io.jans.orm.model.base.CustomAttribute> list, java.lang.String 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 io.jans.orm.PersistenceEntryManager
getLdapManager()
static javax.servlet.http.HttpServletRequest
getRequestOrNull()
Safe retrieves http request from FacesContextstatic boolean
isSameRequestPath(java.lang.String url1, java.lang.String url2)
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 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 obj)
-
daemonThreadFactory
public static java.util.concurrent.ThreadFactory daemonThreadFactory()
-
asPrettyJson
public static java.lang.String asPrettyJson(java.lang.Object obj) throws java.io.IOException
- Throws:
java.io.IOException
-
asJson
public static java.lang.String asJson(java.lang.Object obj) throws java.io.IOException
- Throws:
java.io.IOException
-
cacheControl
public static javax.ws.rs.core.CacheControl cacheControl(boolean noStore)
-
cacheControl
public static javax.ws.rs.core.CacheControl cacheControl(boolean noStore, boolean 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 io.jans.orm.PersistenceEntryManager getLdapManager()
-
getAttributeByName
public static io.jans.orm.model.base.CustomAttribute getAttributeByName(java.util.List<io.jans.orm.model.base.CustomAttribute> list, java.lang.String attributeName)
-
getAttributeValueByName
public static java.lang.String getAttributeValueByName(java.util.List<io.jans.orm.model.base.CustomAttribute> list, java.lang.String attributeName)
-
urlDecode
public static java.lang.String urlDecode(java.lang.String str)
-
createExecutor
public static java.util.concurrent.ScheduledExecutorService createExecutor()
-
convert
public static io.jans.as.model.uma.UmaPermission convert(io.jans.as.model.uma.persistence.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)
-
-