Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to SiteMesh 2.6.0-M1 #301

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2023 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,14 +15,16 @@
*/
package org.grails.web.servlet.view;

import java.util.Collections;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import java.util.Map;

import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletContext;

import com.opensymphony.module.sitemesh.Config;
import com.opensymphony.module.sitemesh.Factory;
import com.opensymphony.module.sitemesh.factory.DefaultFactory;
import com.opensymphony.sitemesh.ContentProcessor;
import com.opensymphony.sitemesh.compatability.PageParser2ContentProcessor;
import org.springframework.beans.factory.DisposableBean;
Expand All @@ -36,7 +38,6 @@
import grails.core.support.GrailsApplicationAware;

import org.grails.web.sitemesh.FactoryHolder;
import org.grails.web.sitemesh.Grails5535Factory;
import org.grails.web.sitemesh.GroovyPageLayoutFinder;
import org.grails.web.sitemesh.SitemeshLayoutView;

Expand Down Expand Up @@ -80,38 +81,33 @@ public void init() {

protected Factory loadSitemeshConfig() {
FilterConfig filterConfig = new FilterConfig() {
private final Map<String, String> customConfig =
Collections.singletonMap("configFile",
"classpath:org/grails/web/sitemesh/sitemesh-default.xml");

@Override
public ServletContext getServletContext() {
return servletContext;
}

@Override
public Enumeration<String> getInitParameterNames() {
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return false;
}

@Override
public String nextElement() {
throw new NoSuchElementException();
}
};
return Collections.enumeration(this.customConfig.keySet());
}

@Override
public String getInitParameter(String name) {
return null;
return this.customConfig.get(name);
}

@Override
public String getFilterName() {
return null;
}
};

Config config = new Config(filterConfig);
Grails5535Factory sitemeshFactory = new Grails5535Factory(config);
DefaultFactory sitemeshFactory = new DefaultFactory(config);
if (servletContext != null) {
servletContext.setAttribute(FACTORY_SERVLET_CONTEXT_ATTRIBUTE, sitemeshFactory);
}
Expand Down
2 changes: 1 addition & 1 deletion grace-web-sitemesh/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
api libs.jakarta.servlet
api project(":grace-sitemesh")
api libs.sitemesh
api project(":grace-web-common")

testImplementation libs.spring.test
Expand Down
Loading
Loading