Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Dispatcher

Avatar

Level 1
The problem is every request API POST or GET is being server with .html at the end but it's shouldn't be
 
5 Replies

Avatar

Level 3

Hi @julianoalvess ,

By mistake I clicked on me too. Please ignore ;).

It would be better if you kindly elaborately say what exactly is your issue with an example, it will help to identify the problem. 

If you want your pages ( with requests from API) should't come with .html, how exactly the response bothering you in dispatcher.

Avatar

Level 5

Hi @julianoalvess , Can you please check if the API request has sling.servlet.extensions="+ "html" in the code.

Avatar

Community Advisor

How are you making the API call ? Can you share some sample code ?

Avatar

Community Advisor

Are you using sling.servlet.extensions as html in your servlet?

@Component(service=Servlet.class,
           property={
                   Constants.SERVICE_DESCRIPTION + "=Simple Demo Servlet",
                   "sling.servlet.methods=" + HttpConstants.METHOD_GET,
                   "sling.servlet.resourceTypes="+ "demoproject/components/structure/page",
                   "sling.servlet.extensions=" + "html"
           })

Avatar

Level 1

No, It can be the dispatcher, with these rules: PS: Only call API 

 

RewriteCond %{REQUEST_URI} !^/content/dam/.*
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteCond %{REQUEST_URI} !.*/$
RewriteCond %{REQUEST_URI} !^/saml_login
RewriteCond %{REQUEST_URI} !^/bin
RewriteRule ^/(.*)$ /content/prudential/home/$1.html [PT,L,QSA]