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

  • SEARCH
  • Home
  • 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 8982007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:28:40+00:00 2026-06-15T20:28:40+00:00

I am developing a dynamic JSP/Servlet web application. In order to handle the session,

  • 0

I am developing a dynamic JSP/Servlet web application. In order to handle the session, I am using a filter which is mapped on /* in web.xml. When I’m opening a page in Firefox, it gives the following Firefox-specific error message:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete

A similar error is shown in Chrome. How is this caused and how can I solve it?

  • 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-06-15T20:28:41+00:00Added an answer on June 15, 2026 at 8:28 pm

    Your filter is redirecting to an URL which is invoking the very same filter with the very same conditions again which in turn thus results in a new redirect, etcetera. Your filter is basically redirecting to itself in an infinite loop. The webbrowser is blocking the infinite loop after ~20 requests to save the enduser from badly designed webapplications.

    You need to fix your filter accordingly that it is not performing a redirect when it has already been performed. Let’s assume a basic real world example of a login filter which is mapped on /* which should be redirecting to the login page when the user is not logged in which is identified by user attribute in session. You obviously want that the filter should not redirect to the login page if the login page itself is currently been requested.

    @WebFilter("/*")
    public class LoginFilter implements Filter {
    
        @Override
        public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
            HttpServletRequest request = (HttpServletRequest) req;
            HttpServletResponse response = (HttpServletResponse) res;
            HttpSession session = request.getSession(false);
            String loginURL = request.getContextPath() + "/login.jsp";
    
            boolean loggedIn = session != null && session.getAttribute("user") != null;
            boolean loginRequest = request.getRequestURI().equals(loginURL);
    
            if (loggedIn || loginRequest) {
                chain.doFilter(request, response); // Logged-in user found or already in login page, so just continue request.
            } else {
                response.sendRedirect(loginURL); // No logged-in user found and not already in login page, so redirect to login page.
            }
        }
    
        // ...
    }
    

    You see, if you want to allow/continue a request, just call chain.doFilter() instead of response.sendRedirect(). Use redirect only if you want to change a request to a different destination.

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

Sidebar

Related Questions

I am developing a dynamic web project j2ee web application using eclipse. I have
I am developing an Android application which rely on .NET web service for dynamic
I'm developing a web page for a customer using the Silverlight application for dynamic
I'm developing a web application in which all dynamic content is retrieved as JSON
I am developing a web application in Struts2 (JSP). I am using lot of
I am developing Web Application. In that i am using so many Div to
I'm developing a java servlet web application that manages information from multiple databases (all
I am developing a Dynamic Web Project with Eclipse Indigo SR2. I am using
I am developing a C++ application which is required to load a dynamic library
I'm developing a dynamic website using JSP & Spring MVC 3.0 and I can't

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.