Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 547919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:01:30+00:00 2026-05-13T11:01:30+00:00

Filters are like servlets but managed by the web container but there is service()

  • 0

Filters are like servlets but managed by the web container but there is service() method in servlets but there is no method called service in filters. There are three only three methods init(), doFilter(), and destroy().Can anybody elaborate on this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:01:30+00:00Added an answer on May 13, 2026 at 11:01 am

    The doFilter() method is the one that is called whenever a Filter processes a request.

    A simple example is as follows:

    public void doFilter(ServletRequest request,
      ServletResponse response, FilterChain chain) 
      throws IOException, ServletException {
      // .. pre filter logic
      chain.doFilter(request, response);
      // .. post filter logic
    }
    

    The filter allows you to decide whether to continue processing the request i.e. whether subsequent filters will process this request and finally the servlet at the end. You can choose not to call chain.doFilter (good example of this would be if you’re using the filter for authentication). See this guide for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a Web Service using Spring MVC. Controllers are called directly by the
Filters like img {filter:flipV;} I'm guessing are pretty old, I just was asked by
I am thinking to create a filter object which filters and delete everything like
I'm fairly new to writing web services. I'm working on a SOAP service using
I'm implementing a manager in my web app that can be called to set
I have a filter that looks like this: <filter> <filter-name>TestFilter</filter-name> <filter-class>org.TestFilter</filter-class> <init-param> <param-name>timeout</param-name> <param-value>30</param-value>
An existing web application is running on Tomcat 4.1. There is an XSS issue
I have a Struts2 (2.1.8.1) web application. My web.xml looks like, <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
Does cgi scripts have something like servlet filters. I.e. a piece of code that
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.