Uploaded image for project: 'PicketLink'
  1. PicketLink
  2. PLINK-413

Hosted page is not served properly (jsp headers not taken into account, served as text)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • PLINK_2.7.0.CR2
    • PLINK_2.5.2.FInal, PLINK_2.6.0.CR2, PLINK_2.6.0.CR1
    • SAML
    • Hide

      To reproduce in standalone, modify the hosted jsp to server utf8 content with a charset other than latin (eg the Greek phrase: "Δοκιμαστικό Μήνυμα"), notice that the message is not displayed properly. A further look into the sent headers will reveal that other things are also not sent properly.

      The following jsp snippet can be used as the head of the hosted jsp:

      <%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

      <c:set var="lng" value="${not empty param.lang ? param.lang : not empty lng ? lng : pageContext.request.locale}" scope="session" />

      Show
      To reproduce in standalone, modify the hosted jsp to server utf8 content with a charset other than latin (eg the Greek phrase: "Δοκιμαστικό Μήνυμα"), notice that the message is not displayed properly. A further look into the sent headers will reveal that other things are also not sent properly. The following jsp snippet can be used as the head of the hosted jsp: <%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <c:set var="lng" value="${not empty param.lang ? param.lang : not empty lng ? lng : pageContext.request.locale}" scope="session" />
    • Hide

      private void forwardHosted(Request request, Response response) throws ServletException, IOException {
      logger.trace("SAML 1.1::Proceeding to IDP index page");
      RequestDispatcher dispatch = getContext().getServletContext()
      .getRequestDispatcher(this.idpConfiguration.getHostedURI());

      recycle(response);
      response.reset();

      try

      { dispatch.forward(request, response); }

      catch (ClassCastException cce)

      { /* JBAS5.1 and 6 quirkiness*/ dispatch.forward(request.getRequest(), response); }

      }

      Show
      private void forwardHosted(Request request, Response response) throws ServletException, IOException { logger.trace("SAML 1.1::Proceeding to IDP index page"); RequestDispatcher dispatch = getContext().getServletContext() .getRequestDispatcher(this.idpConfiguration.getHostedURI()); recycle(response); response.reset(); try { dispatch.forward(request, response); } catch (ClassCastException cce) { /* JBAS5.1 and 6 quirkiness*/ dispatch.forward(request.getRequest(), response); } }

      The hosted page is served via a RequestDispatcher.include instead of a RequestDispatcher.forward. As a result, the page is not properly sent to the client. The effect might not be noticed in a standalone Jboss, but when the hosted page is served via mod_cluster, the source code of the page is shown because content type is text.

            psilva@redhat.com Pedro Igor Craveiro
            alpapad_jira Alexander Papadakis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: