0

I have a secured JSF 2.2 application where I have the following link in the menu of my application:

<h:link value="Donors" styleClass="fa fa-link" 
                outcome="/users/donors.xhtml" />

When I access the application(without an active session/login) and click on the link I am then prompted to authenticate(Form based container authentication is in use in conjunction with the Wildfly database authentication module)and should be redirected to the secured page after successful authentication, however the returned html sometimes comes back almost empty(as below):

<html>
   <head>
   </head>
    <body cz-shortcut-listen="true">
       <pre style="word-wrap: break-word; white-space: pre-wrap;"></pre>
    </body>
</html>

If I access the URL in my browser directly or simply refresh the page , then the page is rendered correctly. As you can see below GET and POSTS to the page in question are restricted to logged in users with either ADMIN or USER role

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>noCache</filter-name>
    <filter-class>org.omnifaces.filter.CacheControlFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>noCache</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

<security-constraint>
<web-resource-collection>
  <web-resource-name>user</web-resource-name>
  <url-pattern>/users/*</url-pattern>
  <http-method>POST</http-method>
  <http-method>GET</http-method>
  <http-method>PUT</http-method>
  <http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
  <role-name>ADMIN</role-name>
  <role-name>USER</role-name>
</auth-constraint>

Can anyone advise why I might be experiencing this issue?

  • Related? http://stackoverflow.com/q/13147210 – BalusC Jun 20 '16 at 18:13
  • By the way, did you inspect the HTML via *Elements* in browser's dev tool or did you literally check the generated output via *View Page Source*? The former is the browser's interpretation and the latter is the one actually returned by the server. – BalusC Jun 20 '16 at 18:31
  • Hi BalusC, I only inspected the source. After viewing the page source it seems that the entire page is actually returned but renders as a completely white page. After a little bit of investigation I see that the problem only occurs the first time I click the link. Every subsequent click renders the page correctly. So in my head I suspect a cache problem... – Duran Wesley Harris Jun 20 '16 at 18:55
  • Is this helpful? http://stackoverflow.com/q/14101380 – BalusC Jun 20 '16 at 18:59

1 Answers1

0

It seems that the problem is not related to cache. I think it is possibly because of my browser plugins interfering somehow. I tested in an IE Browser that had no plugins and it worked great.