WW-5472 Removes Struts Sitemesh plugin

This commit is contained in:
Lukasz Lenart
2024-10-16 09:39:14 +02:00
parent 5132f09bbc
commit ce71dab1de
36 changed files with 36 additions and 2099 deletions
+14 -14
View File
@@ -48,11 +48,6 @@
<artifactId>struts2-config-browser-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
@@ -126,9 +121,9 @@
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh2-jakarta</artifactId>
<version>${project.version}</version>
<groupId>org.sitemesh</groupId>
<artifactId>sitemesh</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
@@ -156,6 +151,17 @@
<version>${hibernate-validator.version}</version>
</dependency>
<!--
Nashorn (the built-in JDK javascript engine) was deprecated in JDK 11 and removed in JDK 15
As a result attempting to use @ScriptAssert on JDK 17 leads to the exception
See more details
https://stackoverflow.com/questions/78008950/resolve-org-hibernate-validator-spi-scripting-scriptevaluatornotfoundexception
-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-jsr223</artifactId>
<version>3.0.22</version>
</dependency>
</dependencies>
<build>
@@ -174,11 +180,6 @@
<configuration>
<outputDirectory>${project.build.directory}/extraclasspath</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh2-jakarta</artifactId>
<destFileName>struts2-sitemesh2-jakarta.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
@@ -244,7 +245,6 @@
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webApp>
<extraClasspath>
${project.build.directory}/extraclasspath/struts2-sitemesh2-jakarta.jar,
${project.build.directory}/extraclasspath/struts2-velocity-tools-view-jakarta.jar,
${project.build.directory}/extraclasspath/struts2-velocity-tools-jsp-jakarta
</extraClasspath>
@@ -49,8 +49,6 @@
sourceUrl += "?page=" + request.getServletPath();
}
%>
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html lang="en">
@@ -61,7 +59,7 @@
<meta name="description" content="Struts2 Showcase for Apache Struts Project">
<meta name="author" content="The Apache Software Foundation">
<title><decorator:title default="Struts2 Showcase"/></title>
<title><sitemesh:write property="title"/></title>
<s:url var="bootstrapCss" value='/styles/bootstrap.css' encode='false' includeParams='none'/>
<s:link href="%{bootstrapCss}" rel="stylesheet" type="text/css" media="all"/>
@@ -94,7 +92,7 @@
<s:script>
jQuery(document).ready(function() { prettyPrint(); } );
</s:script>
<decorator:head/>
<sitemesh:write property="head"/>
</head>
<body id="page-home">
@@ -286,8 +284,7 @@
</div>
</nav>
<decorator:body/>
<sitemesh:write property="body"/>
<hr>
@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>SiteMesh Decorator Tags</shortname>
<uri>sitemesh-decorator</uri>
<tag>
<name>head</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.decorator.HeadTag</tagclass>
<bodycontent>JSP</bodycontent>
</tag>
<tag>
<name>body</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.decorator.BodyTag</tagclass>
<bodycontent>JSP</bodycontent>
</tag>
<tag>
<name>title</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.decorator.TitleTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>default</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>getProperty</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.decorator.PropertyTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>property</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>default</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>writeEntireProperty</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>usePage</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag</tagclass>
<teiclass>com.opensymphony.module.sitemesh.taglib.decorator.UsePageTEI</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>useHtmlPage</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag</tagclass>
<teiclass>com.opensymphony.module.sitemesh.taglib.decorator.UseHTMLPageTEI</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
@@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>SiteMesh Page Tags</shortname>
<uri>sitemesh-page</uri>
<tag>
<name>applyDecorator</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.page.ApplyDecoratorTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>page</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>title</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>contentType</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>encoding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- Deprecated tag: use applyDecorator instead -->
<tag>
<name>apply-decorator</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.page.ApplyDecoratorTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>page</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>title</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>contentType</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>encoding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>param</name>
<tagclass>com.opensymphony.module.sitemesh.taglib.page.ParamTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<sitemesh>
<property name="decorators-file" value="/WEB-INF/decorators.xml"/>
<excludes file="${decorators-file}"/>
<page-parsers>
<parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.FastPageParser"/>
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
<param name="property.1" value="meta.decorator"/>
<param name="property.2" value="decorator"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper">
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper">
<param name="match.MSIE" value="ie"/>
<param name="match.Mozilla [" value="ns"/>
<param name="match.Opera" value="opera"/>
<param name="match.Lynx" value="lynx"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper">
<param name="decorator" value="printable"/>
<param name="parameter.name" value="printable"/>
<param name="parameter.value" value="true"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.RobotDecoratorMapper">
<param name="decorator" value="robot"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.ParameterDecoratorMapper">
<param name="decorator.parameter" value="decorator"/>
<param name="parameter.name" value="confirm"/>
<param name="parameter.value" value="true"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.FileDecoratorMapper">
</mapper>
<mapper class="org.apache.struts2.sitemesh.NoneDecoratorMapper">
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}"/>
</mapper>
</decorator-mappers>
</sitemesh>
@@ -19,18 +19,12 @@
* under the License.
*/
-->
<decorators defaultdir="/WEB-INF/decorators">
<!-- Any urls that are excluded will never be decorated by Sitemesh -->
<excludes>
<pattern>/debug.jsp</pattern>
<pattern>/styles/*</pattern>
<pattern>/scripts/*</pattern>
<pattern>/images/*</pattern>
<pattern>/struts/*</pattern>
<pattern>/nodecorate/*</pattern>
</excludes>
<decorator name="main" page="main.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
<sitemesh>
<mapping path="/*" decorator="main.jsp"/>
<mapping path="/debug.jsp" exclude="true"/>
<mapping path="/styles/*" exclude="true"/>
<mapping path="/scripts/*" exclude="true"/>
<mapping path="/images/*" exclude="true"/>
<mapping path="/static/*" exclude="true"/>
<mapping path="/nodecorate/*" exclude="true"/>
</sitemesh>
@@ -46,8 +46,8 @@
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
<filter-name>sitemesh3</filter-name>
<filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
<async-supported>true</async-supported>
</filter>
@@ -64,7 +64,7 @@
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<filter-name>sitemesh3</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
@@ -112,6 +112,8 @@
</servlet>
<!-- Sitemesh Freemarker and Velocity Decorator Servlets. Shares configuration with Struts.-->
<!--
Unsupported till https://issues.apache.org/jira/browse/WW-4356
<servlet>
<servlet-name>sitemesh-freemarker</servlet-name>
<servlet-class>org.apache.struts2.sitemesh.FreemarkerDecoratorServlet</servlet-class>
@@ -131,12 +133,14 @@
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
-->
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>org.apache.struts2.showcase.servlet.TestServlet</servlet-class>
</servlet>
<!--
<servlet-mapping>
<servlet-name>sitemesh-freemarker</servlet-name>
<url-pattern>*.ftl</url-pattern>
@@ -146,6 +150,7 @@
<servlet-name>sitemesh-velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
-->
<servlet-mapping>
<servlet-name>strutsServlet</servlet-name>
+1 -4
View File
@@ -186,14 +186,11 @@
<artifactId>struts2-rest-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-testng-plugin</artifactId>
-11
View File
@@ -64,13 +64,6 @@
<include>XPP3-LICENSE.txt</include>
</includes>
</fileSet>
<fileSet>
<directory>../plugins/sitemesh/src/main/resources</directory>
<outputDirectory></outputDirectory>
<includes>
<include>SITEMESH-LICENSE.txt</include>
</includes>
</fileSet>
<fileSet>
<directory>target/apps</directory>
<outputDirectory>apps</outputDirectory>
@@ -146,10 +139,6 @@
<directory>../plugins/rest/target/apidocs</directory>
<outputDirectory>docs/struts2-plugins/struts2-rest-plugin/apidocs</outputDirectory>
</fileSet>
<fileSet>
<directory>../plugins/sitemesh/target/apidocs</directory>
<outputDirectory>docs/struts2-plugins/struts2-sitemesh-plugin/apidocs</outputDirectory>
</fileSet>
<fileSet>
<directory>../plugins/spring/target/apidocs</directory>
<outputDirectory>docs/struts2-plugins/struts2-spring-plugin/apidocs</outputDirectory>
-7
View File
@@ -60,12 +60,5 @@
<include>XPP3-LICENSE.txt</include>
</includes>
</fileSet>
<fileSet>
<directory>../plugins/sitemesh/src/main/resources</directory>
<outputDirectory></outputDirectory>
<includes>
<include>SITEMESH-LICENSE.txt</include>
</includes>
</fileSet>
</fileSets>
</assembly>
-4
View File
@@ -90,10 +90,6 @@
<directory>../plugins/rest/target/apidocs</directory>
<outputDirectory>docs/struts2-plugins/struts2-rest-plugin/apidocs</outputDirectory>
</fileSet>
<fileSet>
<directory>../plugins/sitemesh/target/apidocs</directory>
<outputDirectory>docs/struts2-plugins/struts2-sitemesh-plugin/apidocs</outputDirectory>
</fileSet>
<fileSet>
<directory>../plugins/spring/target/apidocs</directory>
<outputDirectory>docs/struts2-plugins/struts2-spring-plugin/apidocs</outputDirectory>
-7
View File
@@ -64,12 +64,5 @@
<include>XPP3-LICENSE.txt</include>
</includes>
</fileSet>
<fileSet>
<directory>../plugins/sitemesh/src/main/resources</directory>
<outputDirectory></outputDirectory>
<includes>
<include>SITEMESH-LICENSE.txt</include>
</includes>
</fileSet>
</fileSets>
</assembly>
-5
View File
@@ -131,11 +131,6 @@
<artifactId>struts2-rest-plugin</artifactId>
<version>${struts-version.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${struts-version.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
-1
View File
@@ -37,7 +37,6 @@
</properties>
<modules>
<module>sitemesh2-jakarta</module>
<module>velocity-tools-view-jakarta</module>
<module>velocity-tools-jsp-jakarta</module>
</modules>
-4
View File
@@ -1,4 +0,0 @@
# Struts 2 Sitemesh2 Jakarta
This uses the eclipse transformer maven plugin to make the Sitemesh2 dependency Jakarta EE 9+ compatible.
-69
View File
@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jakarta</artifactId>
<version>7.0.0-M10-SNAPSHOT</version>
</parent>
<artifactId>struts2-sitemesh2-jakarta</artifactId>
<packaging>jar</packaging>
<name>Struts 2 Jakarta EE Compatible Sitemesh2</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.site.skip>true</maven.site.skip>
<maven.site.deploy.skip>true</maven.site.deploy.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.transformer</groupId>
<artifactId>transformer-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<rules>
<jakartaDefaults>true</jakartaDefaults>
</rules>
</configuration>
<executions>
<execution>
<id>eclipse-transformer-freemarker-jar</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<artifact>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>${sitemesh.version}</version>
</artifact>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
-1
View File
@@ -43,7 +43,6 @@
<module>json</module>
<module>junit</module>
<module>rest</module>
<module>sitemesh</module>
<module>spring</module>
<module>testng</module>
<module>tiles</module>
-2
View File
@@ -1,2 +0,0 @@
# Struts 2 Sitemesh plugin
This plugin is deprecated, and it will be removed soon, **please do not use it**!
-62
View File
@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
<version>7.0.0-M10-SNAPSHOT</version>
</parent>
<artifactId>struts2-sitemesh-plugin</artifactId>
<packaging>jar</packaging>
<name>Struts 2 Sitemesh Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh2-jakarta</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Velocity -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-plugin</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
@@ -1,333 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.HTMLPage;
import com.opensymphony.module.sitemesh.RequestConstants;
import com.opensymphony.xwork2.ActionContext;
import freemarker.core.InvalidReferenceException;
import freemarker.ext.jakarta.servlet.FreemarkerServlet;
import freemarker.template.Configuration;
import freemarker.template.ObjectWrapper;
import freemarker.template.SimpleHash;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.listener.StrutsListener;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.freemarker.ScopesHashModel;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Enumeration;
import java.util.Locale;
/**
* <p>This is a SiteMesh FreeMarker view servlet.</p>
*
* <p>It overrides the SiteMesh servlet to rely on the
* Freemarker Manager in Struts instead of creating it's
* own manager</p>
*/
public class FreemarkerDecoratorServlet extends FreemarkerServlet {
private static final Logger LOG = LogManager.getLogger(FreemarkerDecoratorServlet.class);
protected FreemarkerManager freemarkerManager;
protected String templatePath;
protected boolean nocache;
protected boolean debug;
protected Configuration config;
private ObjectWrapper wrapper;
private String contentType;
private boolean noCharsetInContentType;
public void init() throws ServletException {
try {
Dispatcher dispatcher = Dispatcher.getInstance(getServletContext());
if (dispatcher == null) {
throw new IllegalStateException("Unable to find the Dispatcher in the Servlet Context. Is '" + StrutsListener.class.getName() + "' missing in web.xml?");
}
freemarkerManager = dispatcher.getContainer().getInstance(FreemarkerManager.class);
config = createConfiguration();
// Process object_wrapper init-param out of order:
wrapper = config.getObjectWrapper();
LOG.debug("Using object wrapper of class {}", wrapper.getClass().getName());
// Process all other init-params:
Enumeration initpnames = getServletConfig().getInitParameterNames();
while (initpnames.hasMoreElements()) {
String name = (String) initpnames.nextElement();
String value = getInitParameter(name);
if (name == null) {
throw new ServletException("init-param without param-name. Maybe the web.xml is not well-formed?");
}
if (value == null) {
throw new ServletException("init-param without param-value. Maybe the web.xml is not well-formed?");
}
// template path is already handled!
if (!FreemarkerManager.INITPARAM_TEMPLATE_PATH.equals(name)) freemarkerManager.addSetting(name, value);
}
nocache = freemarkerManager.getNocache();
debug = freemarkerManager.getDebug();
contentType = freemarkerManager.getContentType();
noCharsetInContentType = freemarkerManager.getNoCharsetInContentType();
} catch (ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException(e);
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Give chance to subclasses to perform preprocessing
if (preprocessRequest(request, response)) {
return;
}
String path = requestUrlToTemplatePath(request);
if (debug) {
log("Requested template: " + path);
}
Template template;
try {
template = config.getTemplate(path, deduceLocale(path, request, response));
} catch (FileNotFoundException e) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
Object attrContentType = template.getCustomAttribute("content_type");
if (attrContentType != null) {
response.setContentType(attrContentType.toString());
} else {
if (noCharsetInContentType) {
response.setContentType(contentType + "; charset=" + template.getEncoding());
} else {
response.setContentType(contentType);
}
}
// Set cache policy
setBrowserCachingPolicy(response);
ServletContext servletContext = getServletContext();
ScopesHashModel model = (ScopesHashModel) request.getAttribute(FreemarkerManager.ATTR_TEMPLATE_MODEL);
try {
if (model == null) {
ActionContext ctx = ServletActionContext.getActionContext(request);
if (ctx == null) {
throw new StrutsException("ActionContext is null! Freemarker accessed out of action?");
}
model = freemarkerManager.buildTemplateModel(ctx.getValueStack(), ctx.getActionInvocation().getAction(), servletContext, request, response, wrapper);
}
// Give subclasses a chance to hook into preprocessing
if (preTemplateProcess(request, response, template, model)) {
try {
// Process the template
template.process(model, response.getWriter());
} finally {
// Give subclasses a chance to hook into postprocessing
postTemplateProcess(request, response, template, model);
}
}
} catch (InvalidReferenceException x) {
// this exception is thrown if there is an error processing a reference. We want to report these!
HttpServletRequest req = ActionContext.getContext().getServletRequest();
String resultCode = ActionContext.getContext().getActionInvocation().getResultCode();
if (req == null) {
req = request;
}
StringBuilder msgBuf = new StringBuilder("Error applying freemarker template to\n request: ");
msgBuf.append(req.getRequestURL());
if (req.getQueryString() != null) {
msgBuf.append("?").append(req.getQueryString());
}
msgBuf.append(" with resultCode: ").append(resultCode).append(".\n\n").append(x.getMessage());
String msg = msgBuf.toString();
LOG.error(msg, x);
ServletException e = new ServletException(msg, x);
// Attempt to set init cause, but don't freak out if the method
// is not available (i.e. pre-1.4 JRE). This is required as the
// constructor-passed throwable won't show up automatically in
// stack traces.
try {
e.getClass().getMethod("initCause", new Class[]{Throwable.class}).invoke(e, x);
} catch (Exception ex) {
// Can't set init cause, we're probably running on a pre-1.4
// JDK, oh well...
}
throw e;
} catch (TemplateException te) {
if (config.getTemplateExceptionHandler().getClass().getName().contains("Debug")) {
this.log("Error executing FreeMarker template", te);
} else {
ServletException e = new ServletException("Error executing FreeMarker template", te);
// Attempt to set init cause, but don't freak out if the method
// is not available (i.e. pre-1.4 JRE). This is required as the
// constructor-passed throwable won't show up automatically in
// stack traces.
try {
e.getClass().getMethod("initCause", new Class[]{Throwable.class}).invoke(e, te);
} catch (Exception ex) {
// Can't set init cause, we're probably running on a pre-1.4
// JDK, oh well...
}
throw e;
}
}
}
/**
* Returns the locale used for the
* {@link Configuration#getTemplate(String, Locale)} call.
* The base implementation simply returns the locale setting of the
* configuration. Override this method to provide different behaviour, i.e.
* to use the locale indicated in the request.
*/
protected Locale deduceLocale(String templatePath, HttpServletRequest request, HttpServletResponse response) {
return config.getLocale();
}
/**
* <p>
* Create the instance of the freemarker Configuration object.
* </p>
*
* <p>
* this implementation
* </p>
*
* <ul>
* <li>obtains the default configuration from Configuration.getDefaultConfiguration()
* <li>sets up template loading from a ClassTemplateLoader and a WebappTemplateLoader
* <li>sets up the object wrapper to be the BeansWrapper
* <li>loads settings from the classpath file /freemarker.properties
* </ul>
*/
protected freemarker.template.Configuration createConfiguration() {
return freemarkerManager.getConfiguration(this.getServletContext());
}
/**
* <p>
* Called before the execution is passed to template.process().
* This is a generic hook you might use in subclasses to perform a specific
* action before the template is processed. By default does nothing.
* A typical action to perform here is to inject application-specific
* objects into the model root
* </p>
*
* <p>Example: Expose the Serlvet context path as "baseDir" for all templates:
* </p>
*
* <pre>
* ((SimpleHash) data).put("baseDir", request.getContextPath() + "/");
* return true;
* </pre>
*
* @param request the actual HTTP request
* @param response the actual HTTP response
* @param template the template that will get executed
* @return true to process the template, false to suppress template processing.
* @see FreemarkerServlet#preTemplateProcess(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, freemarker.template.Template, freemarker.template.TemplateModel)
*/
protected boolean preTemplateProcess(HttpServletRequest request, HttpServletResponse response, Template template, TemplateModel templateModel) throws ServletException, IOException {
boolean result = super.preTemplateProcess(request, response, template, templateModel);
SimpleHash hash = (SimpleHash) templateModel;
HTMLPage htmlPage = (HTMLPage) request.getAttribute(RequestConstants.PAGE);
String title, body, head;
if (htmlPage == null) {
title = "No Title";
body = "No Body";
head = "<!-- No head -->";
} else {
title = htmlPage.getTitle();
StringWriter buffer = new StringWriter();
htmlPage.writeBody(buffer);
body = buffer.toString();
buffer = new StringWriter();
htmlPage.writeHead(buffer);
head = buffer.toString();
hash.put("page", htmlPage);
}
hash.put("title", title);
hash.put("body", body);
hash.put("head", head);
hash.put("base", request.getContextPath());
/*
Factory factory = Factory.getInstance(new Config(getServletConfig()));
Decorator decorator = factory.getDecoratorMapper().getDecorator(request, htmlPage);
-> decorator.getPage()
*/
return result;
}
/**
* If the parameter "nocache" was set to true, generate a set of headers
* that will advise the HTTP client not to cache the returned page.
*/
private void setBrowserCachingPolicy(HttpServletResponse res) {
if (nocache) {
// HTTP/1.1 + IE extensions
res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, " + "post-check=0, pre-check=0");
// HTTP/1.0
res.setHeader("Pragma", "no-cache");
// Last resort for those that ignore all of the above
res.setHeader("Expires", FreemarkerManager.EXPIRATION_DATE);
}
}
}
@@ -1,56 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.DecoratorMapper;
import com.opensymphony.sitemesh.DecoratorSelector;
import com.opensymphony.sitemesh.Content;
import com.opensymphony.sitemesh.SiteMeshContext;
import com.opensymphony.sitemesh.compatability.Content2HTMLPage;
import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
import com.opensymphony.sitemesh.webapp.decorator.NoDecorator;
import jakarta.servlet.http.HttpServletRequest;
/**
* Returns a {@link OldDecorator2NewStrutsFreemarkerDecorator} decorator
* for a Freemarker request.
*
* Won't decorate the output if it finds a "decorator" flag in the request
*/
public class FreemarkerMapper2DecoratorSelector implements DecoratorSelector {
private final DecoratorMapper decoratorMapper;
public FreemarkerMapper2DecoratorSelector(DecoratorMapper decoratorMapper) {
this.decoratorMapper = decoratorMapper;
}
public com.opensymphony.sitemesh.Decorator selectDecorator(Content content, SiteMeshContext context) {
SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context;
HttpServletRequest request = webAppContext.getRequest();
com.opensymphony.module.sitemesh.Decorator decorator =
decoratorMapper.getDecorator(request, new Content2HTMLPage(content, request));
if (decorator == null || decorator.getPage() == null) {
return new NoDecorator();
} else {
return new OldDecorator2NewStrutsFreemarkerDecorator(decorator);
}
}
}
@@ -1,65 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.Config;
import com.opensymphony.module.sitemesh.Factory;
import com.opensymphony.sitemesh.DecoratorSelector;
import com.opensymphony.sitemesh.webapp.SiteMeshFilter;
import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletContext;
/**
* Core Filter for integrating SiteMesh + Freemarker into
* a Java web application.
*/
public class FreemarkerPageFilter extends SiteMeshFilter {
/*
* @see com.opensymphony.module.sitemesh.Factory.SITEMESH_FACTORY
*/
private static final String SITEMESH_FACTORY = "sitemesh.factory";
@Inject(required = false)
public static void setFreemarkerManager(FreemarkerManager mgr) {
OldDecorator2NewStrutsFreemarkerDecorator.setFreemarkerManager(mgr);
}
private FilterConfig filterConfig;
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
super.init(filterConfig);
ServletContext sc = filterConfig.getServletContext();
Factory instance = (Factory) sc.getAttribute(SITEMESH_FACTORY);
if (instance == null) {
sc.setAttribute(SITEMESH_FACTORY, new StrutsSiteMeshFactory(new Config(filterConfig)));
}
}
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) {
Factory factory = Factory.getInstance(new Config(filterConfig));
factory.refresh();
return new FreemarkerMapper2DecoratorSelector(factory.getDecoratorMapper());
}
}
@@ -1,39 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.mapper.AbstractDecoratorMapper;
import com.opensymphony.module.sitemesh.Decorator;
import com.opensymphony.module.sitemesh.Page;
import jakarta.servlet.http.HttpServletRequest;
/**
* Won't decorate the output if it finds a "decorator" flag in the request
*/
public class NoneDecoratorMapper extends AbstractDecoratorMapper {
public Decorator getDecorator(HttpServletRequest req, Page page) {
if ("none".equals(req.getAttribute("decorator"))) {
return null;
}
return super.getDecorator(req, page);
}
}
@@ -1,204 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.RequestConstants;
import com.opensymphony.sitemesh.Content;
import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
import com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionEventListener;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.interceptor.PreResultListener;
import com.opensymphony.xwork2.util.ValueStack;
import freemarker.template.Configuration;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.Dispatcher;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Locale;
/**
* Adapts a SiteMesh 2 {@link com.opensymphony.module.sitemesh.Decorator} to a
* SiteMesh 3 {@link com.opensymphony.sitemesh.Decorator}.
*
* @since SiteMesh 3
*/
public abstract class OldDecorator2NewStrutsDecorator extends BaseWebAppDecorator implements RequestConstants {
protected com.opensymphony.module.sitemesh.Decorator oldDecorator;
private static String customEncoding;
public OldDecorator2NewStrutsDecorator(com.opensymphony.module.sitemesh.Decorator oldDecorator) {
this.oldDecorator = oldDecorator;
}
public OldDecorator2NewStrutsDecorator() {
oldDecorator = null;
}
/**
* Applies the decorator, using the relevent contexts
*
* @param content The content
* @param request The servlet request
* @param response The servlet response
* @param servletContext The servlet context
* @param ctx The action context for this request, populated with the server state
*/
protected abstract void render(Content content, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, ActionContext ctx) throws ServletException, IOException;
/**
* Applies the decorator, creating the relevent contexts and delegating to
* the extended applyDecorator().
*
* @param content The content
* @param request The servlet request
* @param response The servlet response
* @param servletContext The servlet context
* @param webAppContext The web app context
*/
protected void render(Content content, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, SiteMeshWebAppContext webAppContext) throws IOException, ServletException {
// see if the URI path (webapp) is set
if (oldDecorator.getURIPath() != null) {
// in a security conscious environment, the servlet container
// may return null for a given URL
if (servletContext.getContext(oldDecorator.getURIPath()) != null) {
servletContext = servletContext.getContext(oldDecorator.getURIPath());
}
}
ActionContext ctx = ServletActionContext.getActionContext(request);
if (ctx == null) {
// ok, one isn't associated with the request, so let's create one using the current Dispatcher
ValueStack vs = Dispatcher.getInstance().getValueStackFactory().createValueStack();
vs.getContext().putAll(Dispatcher.getInstance().createContextMap(request, response, null));
ctx = ActionContext.of(vs.getContext());
if (ctx.getActionInvocation() == null) {
// put in a dummy ActionSupport so basic functionality still works
ActionSupport action = new ActionSupport();
vs.push(action);
ctx.withActionInvocation(new DummyActionInvocation(action));
}
}
// delegate to the actual page decorator
render(content, request, response, servletContext, ctx);
}
/**
* Returns the locale used for the {@link freemarker.template.Configuration#getTemplate(String, java.util.Locale)} call. The base implementation
* simply returns the locale setting of the action (assuming the action implements {@link LocaleProvider}) or, if
* the action does not the configuration's locale is returned. Override this method to provide different behaviour,
*/
protected Locale getLocale(ActionInvocation invocation, Configuration configuration) {
if (invocation.getAction() instanceof LocaleProvider) {
return ((LocaleProvider) invocation.getAction()).getLocale();
} else {
return configuration.getLocale();
}
}
/**
* Gets the L18N encoding of the system. The default is UTF-8.
*/
protected String getEncoding() {
String encoding = customEncoding;
if (encoding == null) {
encoding = System.getProperty("file.encoding");
}
if (encoding == null) {
encoding = "UTF-8";
}
return encoding;
}
static class DummyActionInvocation implements ActionInvocation {
ActionSupport action;
public DummyActionInvocation(ActionSupport action) {
this.action = action;
}
public Object getAction() {
return action;
}
public boolean isExecuted() {
return false;
}
public ActionContext getInvocationContext() {
return null;
}
public ActionProxy getProxy() {
return null;
}
public Result getResult() throws Exception {
return null;
}
public String getResultCode() {
return null;
}
public void setResultCode(String resultCode) {
}
public ValueStack getStack() {
return null;
}
public void addPreResultListener(PreResultListener listener) {
}
public String invoke() throws Exception {
return null;
}
public String invokeActionOnly() throws Exception {
return null;
}
public void setActionEventListener(ActionEventListener listener) {
}
public void init(ActionProxy proxy) {
}
}
}
@@ -1,101 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.HTMLPage;
import com.opensymphony.sitemesh.Content;
import com.opensymphony.sitemesh.compatability.Content2HTMLPage;
import com.opensymphony.xwork2.ActionContext;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import freemarker.template.Configuration;
import freemarker.template.SimpleHash;
import freemarker.template.Template;
import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.freemarker.ScopesHashModel;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Adapts a SiteMesh 2 Freemarker {@link com.opensymphony.module.sitemesh.Decorator} to a
* SiteMesh 3 {@link com.opensymphony.sitemesh.Decorator}.
* Extends OldDecorator2NewStrutsDecorator to add Struts functionality for Freemarker
* @since SiteMesh 2
*/
public class OldDecorator2NewStrutsFreemarkerDecorator extends OldDecorator2NewStrutsDecorator {
private static final Logger LOG = LogManager.getLogger(OldDecorator2NewStrutsFreemarkerDecorator.class);
private static FreemarkerManager freemarkerManager;
public static void setFreemarkerManager(FreemarkerManager mgr) {
freemarkerManager = mgr;
}
public OldDecorator2NewStrutsFreemarkerDecorator(com.opensymphony.module.sitemesh.Decorator oldDecorator) {
this.oldDecorator = oldDecorator;
}
/**
* Applies the decorator, using the relevent contexts
*
* @param content The content
* @param request The servlet request
* @param response The servlet response
* @param servletContext The servlet context
* @param ctx The action context for this request, populated with the server state
*/
protected void render(Content content, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, ActionContext ctx) throws ServletException, IOException {
if (freemarkerManager == null) {
throw new ServletException("Missing freemarker dependency");
}
try {
// get the configuration and template
Configuration config = freemarkerManager.getConfiguration(servletContext);
Template template = config.getTemplate(oldDecorator.getPage(), getLocale(ctx.getActionInvocation(), config)); // WW-1181
// get the main hash
ScopesHashModel model = (ScopesHashModel) request.getAttribute(freemarkerManager.ATTR_TEMPLATE_MODEL);
if (model == null) {
model = freemarkerManager.buildTemplateModel(ctx.getValueStack(), ctx.getActionInvocation().getAction(), servletContext, request, response, config.getObjectWrapper());
}
// populate the hash with the page
HTMLPage htmlPage = new Content2HTMLPage(content, request);
model.put("page", htmlPage);
model.put("head", htmlPage.getHead());
model.put("title", htmlPage.getTitle());
model.put("body", htmlPage.getBody());
model.put("page.properties", new SimpleHash(htmlPage.getProperties()));
// finally, render it
template.process(model, response.getWriter());
} catch (Exception e) {
String msg = "Error applying decorator to request: " + request.getRequestURL() + "?" + request.getQueryString() + " with message:" + e.getMessage();
LOG.error(msg, e);
throw new ServletException(msg, e);
}
}
}
@@ -1,101 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.HTMLPage;
import com.opensymphony.sitemesh.Content;
import com.opensymphony.sitemesh.compatability.Content2HTMLPage;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.inject.Inject;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.views.velocity.VelocityManager;
import org.apache.velocity.context.Context;
import java.io.IOException;
import java.io.PrintWriter;
/**
* Extends OldDecorator2NewStrutsDecorator to add Struts functionality for Velocity
*/
public class OldDecorator2NewStrutsVelocityDecorator extends OldDecorator2NewStrutsDecorator {
private static final Logger LOG = LogManager.getLogger(OldDecorator2NewStrutsFreemarkerDecorator.class);
private static VelocityManager velocityManager;
@Inject(required = false)
public static void setVelocityManager(VelocityManager mgr) {
velocityManager = mgr;
}
public OldDecorator2NewStrutsVelocityDecorator(com.opensymphony.module.sitemesh.Decorator oldDecorator) {
this.oldDecorator = oldDecorator;
}
/**
* Applies the decorator, using the relevent contexts
*
* @param content The content
* @param request The servlet request
* @param response The servlet response
* @param servletContext The servlet context
* @param ctx The action context for this request, populated with the server state
*/
protected void render(Content content, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, ActionContext ctx) throws ServletException, IOException {
if (velocityManager == null) {
throw new ServletException("Missing freemarker dependency");
}
try {
// init (if needed)
velocityManager.init(servletContext);
// get encoding
String encoding = getEncoding();
HTMLPage htmlPage = new Content2HTMLPage(content, request);
// get the template and context
org.apache.velocity.Template template = velocityManager.getVelocityEngine().getTemplate(oldDecorator.getPage(), encoding);
Context context = velocityManager.createContext(ctx.getValueStack(), request, response);
// put the page in the context
context.put("page", htmlPage);
context.put("head", htmlPage.getHead());
context.put("title", htmlPage.getTitle());
context.put("body", htmlPage.getBody());
// finally, render it
PrintWriter writer = response.getWriter();
template.merge(context, writer);
writer.flush();
} catch (Exception e) {
String msg = "Error applying decorator to request: " + request.getRequestURL() + "?" + request.getQueryString() + " with message:" + e.getMessage();
LOG.error(msg, e);
throw new ServletException(msg, e);
}
}
}
@@ -1,55 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.Config;
import com.opensymphony.module.sitemesh.factory.DefaultFactory;
import com.opensymphony.xwork2.ActionContext;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsStatics;
public class StrutsSiteMeshFactory extends DefaultFactory {
private static final Logger LOG = LogManager.getLogger(StrutsSiteMeshFactory.class);
public StrutsSiteMeshFactory(Config config) {
super(config);
}
/**
* Determine whether a Page of given content-type should be parsed or not, avoiding inner action parsing.
*/
@Override
public boolean shouldParsePage(String contentType) {
return !isInsideActionTag() && super.shouldParsePage(contentType);
}
private boolean isInsideActionTag() {
if(ActionContext.getContext() == null) {
LOG.trace("ActionContext is null! Not a user request?");
return false;
}
Object attribute = ServletActionContext.getRequest().getAttribute(StrutsStatics.STRUTS_ACTION_TAG_INVOCATION);
return (Boolean) ObjectUtils.defaultIfNull(attribute, Boolean.FALSE);
}
}
@@ -1,196 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.Config;
import com.opensymphony.module.sitemesh.Decorator;
import com.opensymphony.module.sitemesh.DecoratorMapper;
import com.opensymphony.module.sitemesh.Factory;
import com.opensymphony.module.sitemesh.HTMLPage;
import com.opensymphony.module.sitemesh.RequestConstants;
import com.opensymphony.module.sitemesh.util.OutputConverter;
import com.opensymphony.xwork2.ActionContext;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.listener.StrutsListener;
import org.apache.struts2.views.velocity.StrutsVelocityManager;
import org.apache.struts2.views.velocity.VelocityManager;
import org.apache.velocity.Template;
import org.apache.velocity.context.Context;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.tools.view.VelocityView;
import org.apache.velocity.tools.view.VelocityViewServlet;
import java.io.IOException;
import java.io.StringWriter;
/**
* <p>This is a SiteMesh Velocity view servlet.</p>
*
* <p>It overrides the SiteMesh servlet to rely on the
* Velocity Manager in Struts instead of creating it's
* own manager</p>
*/
public class VelocityDecoratorServlet extends VelocityViewServlet {
private static final Logger LOG = LogManager.getLogger(VelocityDecoratorServlet.class);
private static final long serialVersionUID = -6731485159371716918L;
protected VelocityManager velocityManager;
protected String defaultContentType;
/**
* <p>Initializes servlet, toolbox and Velocity template engine.
* Called by the servlet container on loading.</p>
*
* <p>NOTE: If no charset is specified in the default.contentType
* property (in your velocity.properties) and you have specified
* an output.encoding property, then that will be used as the
* charset for the default content-type of pages served by this
* servlet.</p>
*
* @param config servlet configuration
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
Dispatcher dispatcher = Dispatcher.getInstance(getServletContext());
if (dispatcher == null) {
throw new IllegalStateException("Unable to find the Dispatcher in the Servlet Context. Is '" + StrutsListener.class.getName() + "' missing in web.xml?");
}
velocityManager = dispatcher.getContainer().getInstance(VelocityManager.class);
velocityManager.init(config.getServletContext());
// do whatever we have to do to init Velocity
getVelocityView().setVelocityEngine(velocityManager.getVelocityEngine());
// toolboxManager = velocityManager.getToolboxManager();
// we can get these now that velocity is initialized
defaultContentType = getVelocityProperty(VelocityView.CONTENT_TYPE_KEY, VelocityView.DEFAULT_CONTENT_TYPE);
String encoding = getVelocityProperty(RuntimeConstants.ENCODING_DEFAULT, VelocityView.DEFAULT_OUTPUT_ENCODING);
// For non Latin-1 encodings, ensure that the charset is
// included in the Content-Type header.
if (!VelocityView.DEFAULT_OUTPUT_ENCODING.equalsIgnoreCase(encoding)) {
int index = defaultContentType.lastIndexOf("charset");
if (index < 0) {
// the charset specifier is not yet present in header.
// append character encoding to default content-type
defaultContentType += "; charset=" + encoding;
} else {
// The user may have configuration issues.
getVelocityView().getVelocityEngine().getLog().warn("VelocityViewServlet: Charset was already " + "specified in the Content-Type property. " + "Output encoding property will be ignored.");
}
}
getVelocityView().getVelocityEngine().getLog().info("VelocityViewServlet: Default content-type is: " + defaultContentType);
}
public Template handleRequest(HttpServletRequest request, HttpServletResponse response, Context context) {
HTMLPage htmlPage = (HTMLPage) request.getAttribute(RequestConstants.PAGE);
String template;
context.put("base", request.getContextPath());
// For backwards compatibility with apps that used the old VelocityDecoratorServlet
// that extended VelocityServlet instead of VelocityViewServlet
context.put("req", request);
context.put("res", response);
if (htmlPage == null) {
context.put("title", "Title?");
context.put("body", "<p>Body?</p>");
context.put("head", "<!-- head -->");
template = request.getServletPath();
} else {
try {
context.put("title", OutputConverter.convert(htmlPage.getTitle()));
{
StringWriter buffer = new StringWriter();
htmlPage.writeBody(OutputConverter.getWriter(buffer));
context.put("body", buffer.toString());
}
{
StringWriter buffer = new StringWriter();
htmlPage.writeHead(OutputConverter.getWriter(buffer));
context.put("head", buffer.toString());
}
} catch (IOException e) {
LOG.error("IOException handle request template", e);
}
context.put("page", htmlPage);
DecoratorMapper decoratorMapper = getDecoratorMapper();
Decorator decorator = decoratorMapper.getDecorator(request, htmlPage);
template = decorator.getPage();
}
return getTemplate(template);
}
private DecoratorMapper getDecoratorMapper() {
Factory factory = Factory.getInstance(new Config(getServletConfig()));
return factory.getDecoratorMapper();
}
/**
* <p>Creates and returns an initialized Velocity context.</p>
*
* @param request servlet request from client
* @param response servlet reponse to client
*/
protected Context createContext(HttpServletRequest request, HttpServletResponse response) {
Context context = (Context) request.getAttribute(StrutsVelocityManager.KEY_VELOCITY_STRUTS_CONTEXT);
if (context == null) {
ActionContext ctx = ServletActionContext.getActionContext(request);
context = velocityManager.createContext(ctx.getValueStack(), request, response);
}
return context;
}
/**
* <p>
* Sets the content type of the response. This is available to be overridden
* by a derived class.
* </p>
* <p>The default implementation is:</p>
* <pre>
*
* response.setContentType(defaultContentType);
*
* </pre>
* <p>
* where defaultContentType is set to the value of the default.contentType
* property, or "text/html" if that is not set.</p>
*
* @param request servlet request from client
* @param response servlet reponse to client
*/
protected void setContentType(HttpServletRequest request, HttpServletResponse response) {
response.setContentType(defaultContentType);
}
}
@@ -1,58 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.Decorator;
import com.opensymphony.module.sitemesh.DecoratorMapper;
import com.opensymphony.sitemesh.DecoratorSelector;
import com.opensymphony.sitemesh.Content;
import com.opensymphony.sitemesh.SiteMeshContext;
import com.opensymphony.sitemesh.compatability.Content2HTMLPage;
import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
import com.opensymphony.sitemesh.webapp.decorator.NoDecorator;
import jakarta.servlet.http.HttpServletRequest;
/**
* Returns a {@link OldDecorator2NewStrutsVelocityDecorator} decorator
* for a velocity request.
*
* Won't decorate the output if it finds a "decorator" flag in the request
*/
public class VelocityMapper2DecoratorSelector implements DecoratorSelector {
private final DecoratorMapper decoratorMapper;
public VelocityMapper2DecoratorSelector(DecoratorMapper decoratorMapper) {
this.decoratorMapper = decoratorMapper;
}
public com.opensymphony.sitemesh.Decorator selectDecorator(Content content, SiteMeshContext context) {
SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context;
HttpServletRequest request = webAppContext.getRequest();
Decorator decorator =
decoratorMapper.getDecorator(request, new Content2HTMLPage(content, request));
if (decorator == null || decorator.getPage() == null) {
return new NoDecorator();
} else {
return new OldDecorator2NewStrutsVelocityDecorator(decorator);
}
}
}
@@ -1,55 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.sitemesh;
import com.opensymphony.module.sitemesh.Config;
import com.opensymphony.module.sitemesh.Factory;
import com.opensymphony.sitemesh.DecoratorSelector;
import com.opensymphony.sitemesh.webapp.SiteMeshFilter;
import com.opensymphony.sitemesh.webapp.SiteMeshWebAppContext;
import com.opensymphony.xwork2.inject.Inject;
import jakarta.servlet.FilterConfig;
import org.apache.struts2.views.velocity.VelocityManager;
/**
* Core Filter for integrating SiteMesh into a Java web application.
*/
public class VelocityPageFilter extends SiteMeshFilter {
@Inject(required = false)
public static void setVelocityManager(VelocityManager mgr) {
OldDecorator2NewStrutsVelocityDecorator.setVelocityManager(mgr);
}
private FilterConfig filterConfig;
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
super.init(filterConfig);
}
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) {
// TODO: Remove heavy coupling on horrible SM2 Factory
Factory factory = Factory.getInstance(new Config(filterConfig));
factory.refresh();
return new VelocityMapper2DecoratorSelector(factory.getDecoratorMapper());
}
}
@@ -1,174 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
@@ -1,8 +0,0 @@
Apache Struts
Copyright 2000-2011 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
The binary distributions includes the following third party software:
SiteMesh (http://www.opensymphony.com/sitemesh/).
@@ -1,51 +0,0 @@
/* ====================================================================
* The OpenSymphony Software License, Version 1.1
*
* (this license is derived and fully compatible with the Apache Software
* License - see http://www.apache.org/LICENSE.txt)
*
* Copyright (c) 2001-2004 The OpenSymphony Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* OpenSymphony Group (http://www.opensymphony.com/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "OpenSymphony" and "The OpenSymphony Group"
* must not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact license@opensymphony.com .
*
* 5. Products derived from this software may not be called "OpenSymphony"
* or "SiteMesh", nor may "OpenSymphony" or "SiteMesh" appear in their
* name, without prior written permission of the OpenSymphony Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*/
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
"https://struts.apache.org/dtds/struts-6.0.dtd">
<struts>
<bean class="org.apache.struts2.sitemesh.FreemarkerPageFilter" static="true" optional="true"/>
<!-- if you want to use Velocity with Sitemesh, please define this bean in your struts.xml -->
<!-- bean class="org.apache.struts2.sitemesh.VelocityPageFilter" static="true" optional="true"/ -->
</struts>
-56
View File
@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
-->
<project name="Apache Struts">
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>${fluido-skin.version}</version>
</skin>
<bannerLeft>
<name>Apache Software Foundation</name>
<src>http://www.apache.org/images/asf-logo.gif</src>
<href>http://www.apache.org/</href>
</bannerLeft>
<bannerRight>
<name>Apache Struts</name>
<src>http://struts.apache.org/img/struts-logo.svg</src>
<href>http://struts.apache.org/</href>
</bannerRight>
<publishDate position="left"/>
<version position="right"/>
<body>
<links>
<item name="Apache" href="http://www.apache.org/"/>
<item name="Struts" href="http://struts.apache.org/"/>
</links>
<menu ref="parent"/>
<menu ref="reports"/>
<footer>
<![CDATA[<div class="row span12">
Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project
logos are trademarks of The Apache Software Foundation.
</div>]]>
</footer>
</body>
</project>
+1 -13
View File
@@ -119,7 +119,6 @@
<maven-surefire-plugin.version>3.5.0</maven-surefire-plugin.version>
<mockito.version>5.8.0</mockito.version>
<ognl.version>3.3.5</ognl.version>
<sitemesh.version>2.5.0</sitemesh.version>
<slf4j.version>2.0.16</slf4j.version>
<spring.platformVersion>6.0.13</spring.platformVersion>
<tiles.version>3.0.8</tiles.version>
@@ -407,7 +406,7 @@
<artifactId>maven-site-plugin</artifactId>
<version>3.20.0</version>
<configuration>
<relativizeDecorationLinks>false</relativizeDecorationLinks>
<relativizeSiteLinks>false</relativizeSiteLinks>
</configuration>
<dependencies>
<dependency>
@@ -568,11 +567,6 @@
<artifactId>struts2-rest-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-testng-plugin</artifactId>
@@ -643,12 +637,6 @@
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>${sitemesh.version}</version>
</dependency>
<!-- Velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>