


jebs89
jebs89
23-08-2018
http://localhost:4502/ecat/j_security_check?j_username=abc&j_password=abc&resource=/ecat/apps/cat/in... is the POST URL used to login to our application and land on the servlet path /ecat/apps/cat/injectorwebhook. It has a request body containing a json snippet. When i do a request.getMethod() in the servlet i get it as a GET and could not have a hold on the json from the request body. Why is it treated as a GET method? how to retrieve the body json from the request?
jebs89
jebs89
23-08-2018
i use a URL http://admin:admin@localhost:4502/ecat/apps/cat/injectorwebhook. This takes me to the servlet and is treated as a POST and all is good.
Logs:
inside MerlionWebhookServlet dopost
Method: POST
jsonRequestText : {
"fragments": {
"DDD001017_id06": {
"targetLangs": ["es_XC", "zh_XC"]
},
"EEE001018_id01": {
"targetLangs": ["fr_FR"]
}
}
}
But due to dependent system behavior i cannot use this URL. What is the difference in behavior between these two URLs?
Arun_Patidar
MVP
Arun_Patidar
MVP
24-08-2018
Hi,
If you directly hit the URL in the browser, it will. be treated as GET request. To make POST request either submit form or call url via ajax using post method.
jebs89
jebs89
24-08-2018
I use POSTMAN to send a POST call attaching the request body in it.
Arun_Patidar
MVP
Arun_Patidar
MVP
24-08-2018
Hi,
In above screenshot you can see, I made the post request for same code using AJAX. If I hit same page directly with browser I am getting GET.
So the real issue is the way you are making call to your servlet.
Albin_Issac
MVP
Albin_Issac
MVP
24-08-2018
My perspective you should be invoking the servlet URL directly with POST method and set the authentication header as part of the request.
e.g Authorization Basic YWRtaW46YWRtaW4=
Encode the following string username:password(e.g admin:admin)
Regards
Albin I
Jörg_Hoh
Employee
Jörg_Hoh
Employee
24-08-2018
Please find this request in the server logs; in the request log you should find this request and it will clearly identify what method was used.
Jörg