Calling Servlet through dispatcher loses Body payload data | Community
Skip to main content
Level 2
January 6, 2022

Calling Servlet through dispatcher loses Body payload data

  • January 6, 2022
  • 2 replies
  • 3628 views

I'm calling a servlet through POST method and passing data. When i tried to hit the author/publish instance directly, its working as expected.

Whereas when I'm hitting the servlet through dispatcher, the request payload data is coming as EMPTY.

 

Please share your inputs on the same

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

milind_bachani
Adobe Employee
Adobe Employee
January 6, 2022

Hi @vijaymanoharan 

Are you sure that the payload is empty and you are not getting a 404.
You get a 404 on dispatcher if servlet path is not allowed in the PUBLISH-FILTERS.

Can you please analyse the requests in network tab of dev-tools and post relevant screeenshots, so that we can guide further.

Thanks.

Level 2
January 7, 2022

Hi @milind_bachani , the payload is coming as empty whereas the payload is a JSON which i'm passing.

 

Note: Im trying to hit the servlet through external server. 

Level 2
January 7, 2022

hi @vijaymanoharan 

I would further like you to check that your servlet code has been deployed to publisher and you are able to resolve the servlet at :
<publisher_url>/system/console/servletresolver 
add path /bin/notification choose method as POST and click on resolve and check what candidates say.

Also, I presume that you have added /bin path to execution paths in Apache Sling Servlet/Script Resolver and Error Handler config (in /system/console/configMgr)


The servlet path is resolving in servletresolver and /bin path is available under that particular config.

Shubham_borole
Community Advisor
Community Advisor
January 7, 2022

Hi @vijaymanoharan 

 

What does the servlet url look like?

Can you please check the dispatcher any file for '/filter' section 

For Eg: For /bin/test/myservlet
/0001 { /type "allow" /url "/bin/test/myservlet*" }

Also we can check the dispatcher debug and trace logs if any information regarding this is noted.

 

Thanks

 

Level 2
January 7, 2022

Hi @shubham_borole ,

 

The dispatcher filter file allows the particular path.

 

The dispatcher.log shows the trace as follow

 

[Fri Jan 07 08:25:11 2022] [D] [pid 6550] Found farm publishfarm for project.dev
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] checking [/bin/notification]
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] request URL has no extension: /bin/notification
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] cache-action for [/bin/notification]: NONE
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] Filter rule entry /005 allowed 'POST /bin/notification HTTP/1.1'
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] Reusing connection: 10.44.1.98:4503
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] Connected to backend 0 (10.44.1.98:4503)
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] request.uri = "/bin/notification"
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] request.headers[Content-Type] = "application/json; charset=utf-8"
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] request.headers[Via] = "1.1 project.dev (dispatcher)"
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] request.headers[X-Forwarded-For] = "10.44.1.98"
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] request.headers[Server-Agent] = "Communique-Dispatcher"
[Fri Jan 07 08:25:11 2022] [T] [pid 6550] request.headers[Host] = "10.44.1.98:4503"
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] Sending request body to remote server
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] Request body sent to remote server
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] No socket reuse: neither GET nor HEAD
[Fri Jan 07 08:25:11 2022] [I] [pid 6550] "POST /bin/notification" 500 none [publishfarm/0] 8ms
[Fri Jan 07 08:25:11 2022] [D] [pid 6550] Found farm publishfarm for project.dev

 

Note: I'm trying to hit the servlet from external server

Shubham_borole
Community Advisor
Community Advisor
January 8, 2022

Do you have any other servlets that use the /bin based servlet resolutions and are working?