Package io.jans.as.server.util
Class ServerUtil
- java.lang.Object
-
- io.jans.as.server.util.ServerUtil
-
public class ServerUtil extends 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 String
asJson(Object obj)
static String
asJsonSilently(Object obj)
static String
asPrettyJson(Object obj)
static jakarta.ws.rs.core.CacheControl
cacheControl(boolean noStore)
static jakarta.ws.rs.core.CacheControl
cacheControl(boolean noStore, boolean noTransform)
static jakarta.ws.rs.core.CacheControl
cacheControlWithNoStoreTransformAndPrivate()
static int
calculateTtl(Integer expirationDateAsSeconds)
static int
calculateTtl(Date creationDate, Date expirationDate)
static io.jans.as.model.uma.UmaPermission
convert(io.jans.as.model.uma.persistence.UmaPermission permission, UmaScopeService umaScopeService)
static ScheduledExecutorService
createExecutor()
static com.fasterxml.jackson.databind.ObjectMapper
createJsonMapper()
static ThreadFactory
daemonThreadFactory()
static Integer
dateToSeconds(Date date)
static io.jans.orm.model.base.CustomAttribute
getAttributeByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)
static String
getAttributeValueByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)
static String
getFirstValue(Map<String,String[]> map, String key)
static String
getIpAddress(jakarta.servlet.http.HttpServletRequest httpRequest)
static io.jans.orm.PersistenceEntryManager
getLdapManager()
static jakarta.servlet.http.HttpServletRequest
getRequestOrNull()
Safe retrieves http request from FacesContextstatic boolean
isSameRequestPath(String url1, String url2)
static com.fasterxml.jackson.databind.ObjectMapper
jsonMapperWithUnwrapRoot()
static com.fasterxml.jackson.databind.ObjectMapper
jsonMapperWithWrapRoot()
static GregorianCalendar
now()
static int
nowAsSeconds()
static Map<String,String[]>
prepareForLogs(Map<String,String[]> parameters)
static String
toPrettyJson(org.json.JSONObject jsonObject)
static String
urlDecode(String str)
-
-
-
Method Detail
-
prepareForLogs
public static Map<String,String[]> prepareForLogs(Map<String,String[]> parameters)
-
now
public static GregorianCalendar now()
-
nowAsSeconds
public static int nowAsSeconds()
-
calculateTtl
public static int calculateTtl(Integer expirationDateAsSeconds)
-
daemonThreadFactory
public static ThreadFactory daemonThreadFactory()
-
asPrettyJson
public static String asPrettyJson(Object obj) throws IOException
- Throws:
IOException
-
asJson
public static String asJson(Object obj) throws IOException
- Throws:
IOException
-
cacheControl
public static jakarta.ws.rs.core.CacheControl cacheControl(boolean noStore)
-
cacheControl
public static jakarta.ws.rs.core.CacheControl cacheControl(boolean noStore, boolean noTransform)
-
cacheControlWithNoStoreTransformAndPrivate
public static jakarta.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 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(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)
-
getAttributeValueByName
public static String getAttributeValueByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)
-
createExecutor
public static ScheduledExecutorService createExecutor()
-
convert
public static io.jans.as.model.uma.UmaPermission convert(io.jans.as.model.uma.persistence.UmaPermission permission, UmaScopeService umaScopeService)
-
getIpAddress
public static String getIpAddress(jakarta.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 jakarta.servlet.http.HttpServletRequest getRequestOrNull()
Safe retrieves http request from FacesContext- Returns:
- http
-
isSameRequestPath
public static boolean isSameRequestPath(String url1, String url2) throws MalformedURLException
- Throws:
MalformedURLException
-
-