5

I notice that the ADF by puts a load of default content into the claim store.

i'm trying to extract the querystring values placed into them so i can modify them via my own ADF cartridge.

these values are stored in the following format:

2015-11-16 16:19:48,495 DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@3da776fa, two=[Ljava.lang.String;@3d7436b5, QUERY_STRING=[Ljava.lang.String;@18b3c498, one=[Ljava.lang.String;@422fe3d3, three=[Ljava.lang.String;@56165397}

I'm wondering if there's some inbuilt tools to parse this data out and convert the string back to readable values... before i jump in and start coding it myself.

2 Answers 2

4

The ADF stores a couple of the taf:request:parameters entries as a HashMap<String,String[]>>. These are:

  • CONTENT_LENGTH
  • CONTENT_TYPE
  • QUERY_STRING
  • PATH_INFO

In addition, the ADF stores the HttpServletRequest parameter map in it's entirety on the claim as well, so given the following example query string:

?foo=1&bar=2

In total, you get the following easy way to get request parameters:

    final Map<String,?> requestParametersFromClaimStore = claimStore.get(WebClaims.REQUEST_PARAMETERS,HashMap.class);

    if (requestParametersFromClaimStore != null) {

        // get foo parameter
        String fooParam = (String) requestParametersFromClaimStore.get("foo");
        // get bar parameter
        String barParam = (String) requestParametersFromClaimStore.get("bar");

        // Get complete query string
        String[] queryStringArray = (String[]) requestParametersFromClaimStore.get("QUERY_STRING");
        String queryString = queryStringArray != null && queryStringArray.length > 0 ? queryStringArray[0] : "";

        // Repeat for CONTENT_LENGTH, CONTENT_TYPE and PATH_INFO
    }
1
  • 1
    no problem @johnwinter XXX
    – Raimond
    Nov 17, 2015 at 16:30
3

I think this is returned as a List<string> object.

You may want to check how I do some of this claim reading on the Context Engine Wrapper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.