I am facing an issue with two js files, one.js and two.js. Both of these files make ajax requests to the same Java servlet class(AppController.java).
Here is the code from one.js:
function addOne(){
var formData = $('#form1').serialize();
$.ajax({
type: "POST",
data: formData,
dataType: "json",
success: function (response) {
...
}
});
}
And here is the code from two.js:
function removeMulti(){
var formData = $('#form').serialize();
$.ajax({
type: "POST",
data: formData,
dataType: "json",
success: function (response) {
...
}
});
}
I need to find a way to identify which js file is sending the request to the AppController.java servlet class. This is necessary because I want to block access to certain jsp files via direct URL entry or ajax calls. These specific jsp files should only be accessible when included in another jsp file and requested through a particular js file.
Note: I have already implemented a filter class to block access to specific jsp pages via URLs and ajax requests, but I specifically need to allow access to those jsp files that are called by a specific js file's ajax request.