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 6071309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:01:57+00:00 2026-05-23T10:01:57+00:00

I am using spring security with jsf 2. I have a filter that control

  • 0

I am using spring security with jsf 2. I have a filter that control if db access is ok in each page. :

public void doFilter(ServletRequest aReq, ServletResponse aResponse, FilterChain aChain) throws IOException,
        ServletException
{

    ...
    if(!myContext.isdbRunning())
    {
        mLogger.debug("System not working. Redirecting to: "+"/error.jsf");
        aReq.setAttribute("errorMsj", "DB is not started. Please contact DB admin.");
        aReq.getRequestDispatcher("/error.jsf").forward(aReq, aResponse);
        return;
    }

    aChain.doFilter(aReq, aResponse);
    return; 
}

If everything is ok, my jsf page is rendered correctly. but when filter finds a problem in db, it processes to an error page.

aReq.getRequestDispatcher("/error.jsf").forward(aReq, aResponse);

but that page dosn’t show images and other css based stuff..

does spring security take control and disallow my page contents? or do I have a mistake? How can I solve it? Can I use Phase listener?

Edit: part of my web.xml is

  <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  </filter>

  <filter>
    <filter-name>Gatekeeper</filter-name>
    <filter-class>com.jsfsample.filter.GateKeeperFilter</filter-class>
  </filter>

   <filter-mapping>
    <filter-name>Gatekeeper</filter-name>
    <url-pattern>*.jsf</url-pattern>
   </filter-mapping>


  <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  • 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-23T10:01:57+00:00Added an answer on May 23, 2026 at 10:01 am

    Are your css/scripts/images loaded with a separate request ?

    If so make sure their url (http://domain.com/styles.css) is not secured.


    A bit more detail on unsecuring specific URLs.

    In your security context config file you should have something like:

    <http auto-config="false" use-expressions="true" entry-point-ref="authenticationEntryPoint">
        <intercept-url pattern="/something/relativeUrlThatLoadsImages.jsf" filters="none" />
    
        <!-- OR -->    
    
        <intercept-url pattern="/something/relativeUrlThatLoadsImages.jsf" access="IS_AUTHENTICATED_ANONYMOUSLY" />
    </http>
    

    Either filters="none" or access="IS_AUTHENTICATED_ANONYMOUSLY" will unsecure the relative URL specified in the pattern attribute.

    I personally prefer using filters="none", because it tells spring not to load the filter chain at all for these URLs.

    This way you won’t need to code to make spring ignore these URLs and you will have a place to change access to them easily in the future if you need to.

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

Sidebar

Related Questions

We're using Spring Security to control access to some services. It is working fine
I am using spring security and have an admin jsp page for editing user
I am using Spring Security 3.0 with JSPs. I have created a RequireVerificationFilter that
hi all i am using spring security 3.0.2 and i have one custom filter
We have a JSF web application that uses Acegi security. We also have a
When using spring security, specifically with @notation; what is the proper way to access
I have a problem with my j2ee application using spring security. I set max-sessions
Using Spring Security 3 along with Struts 2 and Tiles 2, I have a
Using Spring Security 3.1.0, I cannot seem to get the concurrent session control feature
We have a tomcat webapp which provides webservices which are protected using Spring Security.

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.