public class RestUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FORM_ENCODING |
static String |
GUI_TOKEN_FOR_EMPTY_PROPERTY_VALUE |
static String |
RESPONSE_TYPE |
static String |
REST_TOKEN_COOKIE |
| Constructor and Description |
|---|
RestUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
appendEncodedSegment(String base,
String segment)
This method will encode append segment to base, encoding it so that a correct URL is returned.
|
static List<Map> |
buildChildEntityList(String parent,
String childType,
List skipList,
List includeList,
String id)
Given the parent URL and the desired childType, this method will build a List of Maps that contains each child
entities values.
|
static Map<String,String> |
buildDefaultValueMap(String endpoint) |
protected static jakarta.ws.rs.core.MultivaluedMap |
buildMultivalueMap(Map<String,Object> payload) |
protected static Map |
buildUseOnlyAttrMap(Map<String,Object> attrs,
List<String> onlyUseAttrs) |
static void |
checkStatusForSuccess(jakarta.ws.rs.core.Response cr) |
protected static Map<String,Object> |
convertNullValuesToFalse(Map<String,Object> attrs,
List<String> convertToFalse) |
static RestResponse |
delete(String address,
Map<String,Object> payload) |
static Boolean |
doesProxyExist(String endpoint) |
protected static Map<String,Object> |
fixKeyNames(Map<String,Object> map) |
static RestResponse |
get(String address) |
static RestResponse |
get(String address,
Map<String,Object> payload) |
static Map |
getAttributesMap(String endpoint) |
static List<String> |
getChildList(String endpoint)
Given the parent URL and the desired childType, this method will build a List of Strings that contains child
entity names.
|
static Map<String,String> |
getChildMap(String endpoint) |
static Map<String,String> |
getChildMap(String endpoint,
Map attrs) |
static List<String> |
getChildResourceList(String document) |
static Map<String,Object> |
getEntityAttrs(String endpoint,
String key) |
static jakarta.ws.rs.client.Client |
getJerseyClient() |
static String |
getPropValue(String endpoint,
String propName,
com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static jakarta.ws.rs.core.Response |
getRequestFromServlet(jakarta.servlet.http.HttpServletRequest request,
String endpoint,
Map<String,Object> attrs) |
static void |
getRestRequestFromServlet(jakarta.servlet.http.HttpServletRequest request,
String endpoint,
Map<String,Object> attrs,
boolean quiet,
boolean throwException) |
static String |
getRestToken()
This method returns the value of the REST token if it is successfully set in session scope.
|
static boolean |
hasWarning(Map responseMap) |
static jakarta.ws.rs.client.ClientBuilder |
initialize(jakarta.ws.rs.client.ClientBuilder clientBuilder) |
static Map |
maskOffPassword(Map<String,Object> attrs) |
static RestResponse |
options(String address,
String responseType) |
static Map<String,Object> |
parseResponse(RestResponse response,
com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx,
String endpoint,
Object attrs,
boolean quiet,
boolean throwException) |
static RestResponse |
post(String address,
Map<String,Object> payload) |
static RestResponse |
post(String address,
Object payload,
String contentType) |
static void |
postRestRequestFromServlet(jakarta.servlet.http.HttpServletRequest request,
String endpoint,
Map<String,Object> attrs,
boolean quiet,
boolean throwException) |
static RestResponse |
put(String address,
Map<String,Object> payload) |
protected static void |
removeSpecifiedAttrs(Map<String,Object> attrs,
List<String> removeList) |
static String |
resolveToken(String endpoint,
String token) |
static Map<String,Object> |
restRequest(String endpoint,
Map<String,Object> attrs,
String method,
com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx,
boolean quiet) |
static Map<String,Object> |
restRequest(String endpoint,
Map<String,Object> attrs,
String method,
com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx,
boolean quiet,
boolean throwException) |
static RestResponse |
sendCreateRequest(String endpoint,
Map<String,Object> attrs,
List<String> skipAttrs,
List<String> onlyUseAttrs,
List<String> convertToFalse) |
static RestResponse |
sendUpdateRequest(String endpoint,
Map<String,Object> attrs,
List<String> skipAttrs,
List<String> onlyUseAttrs,
List<String> convertToFalse) |
static jakarta.ws.rs.client.WebTarget |
targetWithQueryParams(jakarta.ws.rs.client.WebTarget target,
Map<String,Object> paramMap) |
static String |
upperCaseFirstLetter(String string)
Converts the first letter of the given string to Uppercase.
|
public static final String FORM_ENCODING
public static final String RESPONSE_TYPE
public static final String GUI_TOKEN_FOR_EMPTY_PROPERTY_VALUE
public static final String REST_TOKEN_COOKIE
public static jakarta.ws.rs.client.Client getJerseyClient()
public static String getPropValue(String endpoint, String propName, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static Map<String,Object> restRequest(String endpoint, Map<String,Object> attrs, String method, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, boolean quiet)
public static Map<String,Object> restRequest(String endpoint, Map<String,Object> attrs, String method, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, boolean quiet, boolean throwException)
public static Map<String,String> buildDefaultValueMap(String endpoint) throws ParserConfigurationException, SAXException, IOException
public static Map<String,Object> parseResponse(RestResponse response, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, String endpoint, Object attrs, boolean quiet, boolean throwException)
public static boolean hasWarning(Map responseMap)
public static String appendEncodedSegment(String base, String segment)
base - segment - protected static jakarta.ws.rs.core.MultivaluedMap buildMultivalueMap(Map<String,Object> payload)
public static RestResponse sendCreateRequest(String endpoint, Map<String,Object> attrs, List<String> skipAttrs, List<String> onlyUseAttrs, List<String> convertToFalse)
public static RestResponse sendUpdateRequest(String endpoint, Map<String,Object> attrs, List<String> skipAttrs, List<String> onlyUseAttrs, List<String> convertToFalse)
protected static void removeSpecifiedAttrs(Map<String,Object> attrs, List<String> removeList)
protected static Map buildUseOnlyAttrMap(Map<String,Object> attrs, List<String> onlyUseAttrs)
protected static Map<String,Object> convertNullValuesToFalse(Map<String,Object> attrs, List<String> convertToFalse)
public static String upperCaseFirstLetter(String string)
string - the input stringpublic static List<String> getChildResourceList(String document) throws SAXException, IOException, ParserConfigurationException
public static List<Map> buildChildEntityList(String parent, String childType, List skipList, List includeList, String id) throws Exception
parent - childType - skipList - Exceptionpublic static List<String> getChildList(String endpoint) throws Exception
endpoint - Exceptionpublic static Map<String,String> getChildMap(String endpoint) throws Exception
Exceptionpublic static Map<String,String> getChildMap(String endpoint, Map attrs) throws Exception
Exceptionpublic static String getRestToken()
This method returns the value of the REST token if it is successfully set in session scope.
public static jakarta.ws.rs.core.Response getRequestFromServlet(jakarta.servlet.http.HttpServletRequest request,
String endpoint,
Map<String,Object> attrs)
public static void getRestRequestFromServlet(jakarta.servlet.http.HttpServletRequest request,
String endpoint,
Map<String,Object> attrs,
boolean quiet,
boolean throwException)
public static jakarta.ws.rs.client.WebTarget targetWithQueryParams(jakarta.ws.rs.client.WebTarget target,
Map<String,Object> paramMap)
public static RestResponse get(String address)
public static RestResponse get(String address, Map<String,Object> payload)
public static RestResponse post(String address, Object payload, String contentType)
public static RestResponse post(String address, Map<String,Object> payload)
public static RestResponse put(String address, Map<String,Object> payload)
public static RestResponse delete(String address, Map<String,Object> payload)
public static RestResponse options(String address, String responseType)
public static void checkStatusForSuccess(jakarta.ws.rs.core.Response cr)
public static jakarta.ws.rs.client.ClientBuilder initialize(jakarta.ws.rs.client.ClientBuilder clientBuilder)
Copyright © 2017–2020 Eclipse Foundation. All rights reserved.