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 StringasJson(Object obj)static StringasJsonSilently(Object obj)static StringasPrettyJson(Object obj)static jakarta.ws.rs.core.CacheControlcacheControl(boolean noStore)static jakarta.ws.rs.core.CacheControlcacheControl(boolean noStore, boolean noTransform)static jakarta.ws.rs.core.CacheControlcacheControlWithNoStoreTransformAndPrivate()static intcalculateTtl(Integer expirationDateAsSeconds)static intcalculateTtl(Date creationDate, Date expirationDate)static io.jans.as.model.uma.UmaPermissionconvert(io.jans.as.model.uma.persistence.UmaPermission permission, UmaScopeService umaScopeService)static ScheduledExecutorServicecreateExecutor()static com.fasterxml.jackson.databind.ObjectMappercreateJsonMapper()static ThreadFactorydaemonThreadFactory()static IntegerdateToSeconds(Date date)static io.jans.orm.model.base.CustomAttributegetAttributeByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)static StringgetAttributeValueByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)static StringgetFirstValue(Map<String,String[]> map, String key)static StringgetIpAddress(jakarta.servlet.http.HttpServletRequest httpRequest)static io.jans.orm.PersistenceEntryManagergetLdapManager()static jakarta.servlet.http.HttpServletRequestgetRequestOrNull()Safe retrieves http request from FacesContextstatic booleanisSameRequestPath(String url1, String url2)static com.fasterxml.jackson.databind.ObjectMapperjsonMapperWithUnwrapRoot()static com.fasterxml.jackson.databind.ObjectMapperjsonMapperWithWrapRoot()static GregorianCalendarnow()static intnowAsSeconds()static StringtoPrettyJson(org.json.JSONObject jsonObject)static StringurlDecode(String str)
-
-
-
Method Detail
-
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
-
-