diff --git a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/FreemarkerViewEngine.java.off b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/FreemarkerViewEngine.java.off
new file mode 100644
index 000000000..8472dd470
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/FreemarkerViewEngine.java.off
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.mvc.freemarker;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+import org.eclipse.krazo.engine.ViewEngineBase;
+import org.eclipse.krazo.engine.ViewEngineConfig;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Priority;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.mvc.engine.ViewEngine;
+import javax.mvc.engine.ViewEngineContext;
+import javax.mvc.engine.ViewEngineException;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@ApplicationScoped
+@Priority(ViewEngine.PRIORITY_APPLICATION)
+public class FreemarkerViewEngine extends ViewEngineBase {
+
+ @Inject
+ @ViewEngineConfig
+ private Configuration configuration;
+
+ @Override
+ public boolean supports(String view) {
+ return view.endsWith(".ftl");
+ }
+
+ @Override
+ public void processView(final ViewEngineContext context)
+ throws ViewEngineException {
+
+ final Charset charset = resolveCharsetAndSetContentType(context);
+
+ try (final Writer writer = new OutputStreamWriter(
+ context.getOutputStream(), charset
+ )) {
+ final Template template = configuration.getTemplate(
+ resolveView(context)
+ );
+
+ final Map model = new HashMap<>(
+ context.getModels().asMap()
+ );
+ model.put("request", context.getRequest(HttpServletRequest.class));
+
+ template.process(model, writer);
+ } catch (TemplateException | IOException e) {
+ throw new ViewEngineException(e);
+ }
+ }
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/KrazoTemplateLoader.java b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/KrazoTemplateLoader.java
index 6b31bbc11..d10c970f8 100644
--- a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/KrazoTemplateLoader.java
+++ b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/KrazoTemplateLoader.java
@@ -53,7 +53,9 @@ class KrazoTemplateLoader implements TemplateLoader {
@Override
public Object findTemplateSource(final String name) throws IOException {
- if (name.startsWith("@themes") || name.startsWith("/@themes")) {
+ if (name.startsWith("@themes")
+ || name.startsWith("/@themes")
+ || name.startsWith("WEB-INF/views/@themes")) {
return null;
} else {
// Freemarker drops "/"
diff --git a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/MvcFreemarkerConfigurationProducer.java b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/MvcFreemarkerConfigurationProducer.java
index 2282db361..97b038240 100644
--- a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/MvcFreemarkerConfigurationProducer.java
+++ b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/MvcFreemarkerConfigurationProducer.java
@@ -28,12 +28,11 @@ import org.eclipse.krazo.engine.ViewEngineConfig;
import org.eclipse.krazo.ext.freemarker.DefaultConfigurationProducer;
import org.libreccm.theming.Themes;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
import javax.enterprise.inject.Specializes;
import javax.inject.Inject;
import javax.servlet.ServletContext;
-import javax.ws.rs.Produces;
+
/**
* Extends the default configuration for Freemarker of Eclipse Krazo to
@@ -41,9 +40,10 @@ import javax.ws.rs.Produces;
*
* @author Jens Pelzetter
*/
-@ApplicationScoped
-@Alternative
-@Specializes
+//@ApplicationScoped
+//@Alternative
+//@Specializes
+//@Priority(3000)
public class MvcFreemarkerConfigurationProducer
extends DefaultConfigurationProducer {
@@ -55,7 +55,7 @@ public class MvcFreemarkerConfigurationProducer
@Produces
@ViewEngineConfig
- @Alternative
+// @Alternative
@Specializes
@Override
public Configuration getConfiguration() {
diff --git a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/ThemesTemplateLoader.java b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/ThemesTemplateLoader.java
index 478a505a5..e183c6bf8 100644
--- a/ccm-core/src/main/java/org/libreccm/mvc/freemarker/ThemesTemplateLoader.java
+++ b/ccm-core/src/main/java/org/libreccm/mvc/freemarker/ThemesTemplateLoader.java
@@ -66,7 +66,9 @@ class ThemesTemplateLoader implements TemplateLoader {
*/
@Override
public Object findTemplateSource(final String path) throws IOException {
- if (path.startsWith("@themes") || path.startsWith("/@themes")) {
+ if (path.startsWith("@themes")
+ || path.startsWith("/@themes")
+ || path.startsWith("WEB-INF/views/@themes")) {
final String[] tokens;
if (path.startsWith("/")) {
tokens = path.substring(1).split("/");
diff --git a/ccm-core/src/main/resources/META-INF/beans.xml b/ccm-core/src/main/resources/META-INF/beans.xml
index bade5d06d..eecc609e3 100644
--- a/ccm-core/src/main/resources/META-INF/beans.xml
+++ b/ccm-core/src/main/resources/META-INF/beans.xml
@@ -5,9 +5,10 @@
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
-
+
org.libreccm.security.AuthorizationInterceptor