Query Content HAL API

Hi all,

I’ve been trying to create a wrapper API which internally makes a REST call to the Content HAL API. The aim is to retrieve documents based on fields matching or being greater than certain values in the request.


I have two questions regarding the above:

  • Creating an xpath query and adding it as a query param for _expr should do the job according to the documentation. However when creating queries with invalid URL characters it will be rejected. Even when URL encoded.
    I am not sure how to give a query such as this in the _expr:

  • Is there another possibility that I have overlooked which is better suited for my case?

Thanks for reading and apologies if this question has been asked before. I was not able to find a solution.

as an update: seems to be a tomcat issue with not accepting < or > even in their url encoded %3C and %3E which is odd as it does accept other percent encoded characters.

tomcat connector might need adjustments too (recently there was a change, and tomcat is not accepting certain characters it did accept in previous versions)


Thanks for the reply and help Machak.

I was able to let tomcat accept other unsafe characters {} [] | with relaxedQueryChars/relaxedPathChars. Regardless, <> and %3C %3E do not wish to be let through by tomcat when spun up by cargo.

When spinning up a separate tomcat container, this issue is not there.

Nonetheless, I’ll keep trying and send an update if it works out.

I wrongly assumed it was a Tomcat issue and asked on StackOverflow. It was however org.hippoecm.hst.container.XSSUrlFilter blocking the request.

Here is the answer by Jeroen:
urlencode - Tomcat rejects URL encoded "<" and ">" symbols - Stack Overflow.

documented here:

Thanks a lot once again machak and Jeroen.

One last addition which might help others:

Instead of using “>”, one could use “gt”. This way, you won’t have to interfere with the XSSUrlFilter and the query will still run as expected.