Wicket
  1. Wicket
  2. WICKET-5203

Base url is incorrect for error dispatched pages

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.8.0
    • Fix Version/s: 6.9.0, 1.5.11, 7.0.0-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      The fix for https://issues.apache.org/jira/browse/WICKET-4387 includes the following code in org.apache.wicket.protocol.http.servlet.ServletWebRequest#ServletWebRequest(HttpServletRequest httpServletRequest, String filterPrefix, Url url):

      if (forwardAttributes != null || errorAttributes != null)
      {
      if (LOG.isDebugEnabled())
      {
      LOG.debug("Setting filterPrefix('{}') to '' because there is either an error or a forward. {}, {}",
      new Object[]

      {filterPrefix, forwardAttributes, errorAttributes}

      );
      }
      // the filter prefix is not needed when the current request is internal
      // see WICKET-4387
      this.filterPrefix = "";

      The filterPrefix is actually needed later when a request is made due to an error (e.g. 404):

      public Url getClientUrl()
      {
      if (errorAttributes != null && !Strings.isEmpty(errorAttributes.getRequestUri()))
      {
      String problematicURI = Url.parse(errorAttributes.getRequestUri(), getCharset())
      .toString();
      return getContextRelativeUrl(problematicURI, filterPrefix);

      With filterPrefix=="" the urls for any resources in the error page are wrong.

      1. quickstart.tgz
        21 kB
        Martin Grigorov

        Issue Links

          Activity

          Hide
          Martin Grigorov added a comment -

          Attaching a quickstart app.

          It uses contextPath = "context", filterPath = "/filter/*" and <error-page> for 404 that is handled by a Wicket page. The error page uses CSS contribution which without this fix has wrong url and leads to another error dispatch, i.e. NotFoundPage is used for the request to the CSS.

          Show
          Martin Grigorov added a comment - Attaching a quickstart app. It uses contextPath = "context", filterPath = "/filter/*" and <error-page> for 404 that is handled by a Wicket page. The error page uses CSS contribution which without this fix has wrong url and leads to another error dispatch, i.e. NotFoundPage is used for the request to the CSS.

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Martin Grigorov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development