I used to call some of my Servlets via JS/jQuery when I click on some button of my web as it follows:
btnComment.addEventListener("click", sending);
function sending() {
btnComment.disabled = true;
$.post('/Project/AddCommentServlet', {
id_pic: idPic.value,
text: textComment.value
});
}
So I call the Servlet "AddCommentServlet" using POST, sending 2 parameters.
I've disabled the access by GET to that Servlet (redirecting to and error page if it happens), but... is this a secure way of working? Could it be done in another way?
I don't want that anybody puts could access to the servlet via a bot or something similar if this person knows the name of the servlet and the parameters used. Someone could code a program that attacks it, knowing the endpoints and parameters, isn't it?
Thanks!