Search code examples
javaservletsservlet-filters

How to identify request came from servlet or not?


I want to distinguish requested call coming from servlet or not?? If it coming from servlet then continue otherwise return false.

e.g if(request come from servlet ) continue; else return false


Solution

  • Assuming you are referring to an HTTP request, there are a number of HTTP headers that can be passed as part of an HTTP request. It might be possible to check that common headers are not set (such as user-agent, etc), but this would not prove definitively that the request came from a servlet.

    So the short answer is no.