Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4056

ViewRoot update ignores <body> class attribute

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.2.9, 2.2.10
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None

      Description

      I have an Apache Shiro interceptor setup that validates user actions, and if user is not yet authenticated it throws an UnauthenticatedException. As the actions validated may be ajax actions, I also used the Omnifaces FullAjaxExceptionHandler (which is not where the bug is coming from, it works just as expected).

      So I have setup in web.xml an error-page for the exception, so it redirects to the login page when a UnauthenticatedException is thrown.:

      <error-page>
      <exception-type>org.apache.shiro.authz.UnauthenticatedException</exception-type>
      <location>/login.xhtml</location>
      </error-page>

      So when I try to make an action that requires authentication, my interceptor manages it and throws and UnauthenticatedException, then omnifaces FullAjaxExceptionHandler handles the exception, looking up the error page assigned for the exception which is /login.xhtml and updates the ViewRoot with the following response:

      <?xml version="1.0" encoding="UTF-8"?>
      <partial-response id="j_id__v_0"><changes>

      <update id="javax.faces.ViewRoot"><![CDATA[<!DOCTYPE html>
      <html xmlns="http://www.w3.org/1999/xhtml"><head id="j_id_3">

      <!-- Ommited -->
      <title>Entrar</title></head><body class="loginbody">
      <!-- Ommited -->

      </changes></partial-response>

      Now please check that the final HTML rendered from the ViewRoot partial-response update does not have the loginbody class:

      <!-- ommited -->
      <body>
      <div class="Wid25 MarAuto DispBlock OvHidden Responsive100">
      <!-- ommited -->

      As the partial-response originally had the class but the view rendered does not have it, I assume that this is a MyFaces issue.

      Thank you so much for your great work, I love MyFaces.

        Attachments

          Activity

            People

            • Assignee:
              lu4242 Leonardo Uribe
              Reporter:
              feverdog88 Jean Luc Sossmeier
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: