سؤال

We're trying to embed Magnolia-managed content into some of the JSPs of an existing web app. In Tomcat we deployed and set up a "magnoliaAuthor" context that runs along our existing "app" context.

So, for example, we'd like an existing JSP such as /app/test.jsp to include a Magnolia page such as /magnoliaAuthor/footer (just a div). In the browser the path /magnoliaAuthor/footer renders fine, but we're facing issues when trying to include that into /app/test.jsp using:

  • c:import
  • jsp:include

and the like, with both relative and absolute paths to /magnoliaAuthor/footer..

At most we're getting the following:

Server returned HTTP response code: 401 for URL: http://localhost:8080/magnoliaAuthor/footer (when an absolute URL is used). This seems like the request was rejected by Magnolia..

We couldn't find an exact description of how this use case should be put together. Any hint will be appreciated.

Thank you.

هل كانت مفيدة؟

المحلول

HTTP 401 is unauthorized:

The request requires user authentication.

Which makes sense: The magnoliaAuthor instance always needs a username and password so you can login, since it is the instance where editors work.

What you need is sending magnoliaAuthor a username and password. My research has shown that Magnolia uses two login-filters, placed in /server/filters/login/loginHandlers:

You can make use of the HTTP basic authentication and include your Magnolia page like:

<c:import url="http://username:password@example.com/magnoliaAuthor/app/test" />

Note: You wrote that you have no problems including /magnoliaAuthor/footer. This means that your security configuration for accessing these two sites is different. You should consider checking this, usually you don't want any resource in magnoliaAuthor to be accessible without authorization.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top