Skip to main content
2 of 4
edited body
Anand N S
  • 1.9k
  • 1
  • 10
  • 17

DXA-2.2.5 Java model service clients says 400 bad request

We are using Java DXA-2.2.5 and Model service to render content, we came across one issue when we request for page model, it says 400 bad request since it is not able to understand encoded page url.

we have url -

http://localhost:8080/system/include/header.html

I did analyze dxa-model-service-client

Its failing on ModelServiceClient.java where URL is passed as parameter

ResponseEntity<T> response = restTemplate.exchange(serviceUrl, HttpMethod.GET, new HttpEntity<>(null, headers), type, params);

here is property from properties file

dxa.model.service.url.page.model=/PageModel/{uriType}/{localizationId}/{pageUrl}?includes={pageInclusion}

where on {pageUrl} if there is "/" characters comes it changed to %2F and then passes as request, which results 400 bad request

Failed url:

http://test.content-delivery.com:8998/PageModel/tcm/8/system%2Finclude%2Fheader.html?includes=INCLUDE

I have tried with postman call as well this URL doesn't provide response.

I tried it by changing URL to where I replaced %2F with "/" on postman request

http://test.content-delivery.com:8998/PageModel/tcm/8/system/include/header?includes=INCLUDE

I could see response on postman call.

could someone please tell me how could I use dxa-model-service-client to make it working on dxa-2.2 application.