Class RestUtil
java.lang.Object
org.glassfish.admingui.common.util.RestUtil
- Author:
- anilam
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringappendEncodedSegment(String base, String segment) This method will encode append segment to base, encoding it so that a correct URL is returned.Given the parent URL and the desired childType, this method will build a List of Maps that contains each child entities values.buildDefaultValueMap(String endpoint) protected static jakarta.ws.rs.core.MultivaluedMapbuildMultivalueMap(Map<String, Object> payload) protected static Mapstatic voidcheckStatusForSuccess(jakarta.ws.rs.core.Response cr) static RestResponsestatic BooleandoesProxyExist(String endpoint) fixKeyNames(Map<String, Object> map) static RestResponsestatic RestResponsestatic MapgetAttributesMap(String endpoint) getChildList(String endpoint) Given the parent URL and the desired childType, this method will build a List of Strings that contains child entity names.getChildMap(String endpoint) getChildMap(String endpoint, Map attrs) getChildResourceList(String document) getEntityAttrs(String endpoint, String key) static jakarta.ws.rs.client.Clientstatic StringgetPropValue(String endpoint, String propName, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) static jakarta.ws.rs.core.ResponsegetRequestFromServlet(jakarta.servlet.http.HttpServletRequest request, String endpoint, Map<String, Object> attrs) static voidgetRestRequestFromServlet(jakarta.servlet.http.HttpServletRequest request, String endpoint, Map<String, Object> attrs, boolean quiet, boolean throwException) static StringThis method returns the value of the REST token if it is successfully set in session scope.static booleanhasWarning(Map responseMap) static jakarta.ws.rs.client.ClientBuilderinitialize(jakarta.ws.rs.client.ClientBuilder clientBuilder) static MapmaskOffPassword(Map<String, Object> attrs) static RestResponseparseResponse(RestResponse response, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, String endpoint, Object attrs, boolean quiet, boolean throwException) static RestResponsestatic RestResponsestatic voidpostRestRequestFromServlet(jakarta.servlet.http.HttpServletRequest request, String endpoint, Map<String, Object> attrs, boolean quiet, boolean throwException) static RestResponseprotected static voidstatic StringresolveToken(String endpoint, String token) restRequest(String endpoint, Map<String, Object> attrs, String method, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, boolean quiet) restRequest(String endpoint, Map<String, Object> attrs, String method, com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, boolean quiet, boolean throwException) static RestResponsesendCreateRequest(String endpoint, Map<String, Object> attrs, List<String> skipAttrs, List<String> onlyUseAttrs, List<String> convertToFalse) static RestResponsesendUpdateRequest(String endpoint, Map<String, Object> attrs, List<String> skipAttrs, List<String> onlyUseAttrs, List<String> convertToFalse) static jakarta.ws.rs.client.WebTargettargetWithQueryParams(jakarta.ws.rs.client.WebTarget target, Map<String, Object> paramMap) static StringupperCaseFirstLetter(String string) Converts the first letter of the given string to Uppercase.
-
Field Details
-
FORM_ENCODING
- See Also:
-
RESPONSE_TYPE
- See Also:
-
GUI_TOKEN_FOR_EMPTY_PROPERTY_VALUE
- See Also:
-
REST_TOKEN_COOKIE
- See Also:
-
-
Constructor Details
-
RestUtil
public RestUtil()
-
-
Method Details
-
getJerseyClient
public static jakarta.ws.rs.client.Client getJerseyClient() -
getPropValue
-
resolveToken
-
restRequest
-
restRequest
-
maskOffPassword
-
buildDefaultValueMap
public static Map<String,String> buildDefaultValueMap(String endpoint) throws ParserConfigurationException, SAXException, IOException -
getAttributesMap
-
getEntityAttrs
-
parseResponse
-
hasWarning
-
appendEncodedSegment
This method will encode append segment to base, encoding it so that a correct URL is returned.- Parameters:
base-segment-- Returns:
-
buildMultivalueMap
-
sendCreateRequest
-
sendUpdateRequest
-
fixKeyNames
-
removeSpecifiedAttrs
-
buildUseOnlyAttrMap
-
convertNullValuesToFalse
-
upperCaseFirstLetter
Converts the first letter of the given string to Uppercase.- Parameters:
string- the input string- Returns:
- the string with the Uppercase first letter
-
getChildResourceList
public static List<String> getChildResourceList(String document) throws SAXException, IOException, ParserConfigurationException -
buildChildEntityList
public static List<Map> buildChildEntityList(String parent, String childType, List skipList, List includeList, String id) throws Exception Given the parent URL and the desired childType, this method will build a List of Maps that contains each child entities values. In addition to the entity values, each row will have a field, 'selected', set to false, as well as the URL encoded entity name ('encodedName').- Parameters:
parent-childType-skipList-- Returns:
- Throws:
Exception
-
getChildList
Given the parent URL and the desired childType, this method will build a List of Strings that contains child entity names.- Parameters:
endpoint-- Returns:
- Throws:
Exception
-
getChildMap
- Throws:
Exception
-
getChildMap
- Throws:
Exception
-
doesProxyExist
-
getRestToken
This method returns the value of the REST token if it is successfully set in session scope.
-
getRequestFromServlet
-
getRestRequestFromServlet
-
targetWithQueryParams
-
get
-
get
-
post
-
post
-
put
-
delete
-
options
-
checkStatusForSuccess
public static void checkStatusForSuccess(jakarta.ws.rs.core.Response cr) -
initialize
public static jakarta.ws.rs.client.ClientBuilder initialize(jakarta.ws.rs.client.ClientBuilder clientBuilder) -
postRestRequestFromServlet
-