mirror of
https://github.com/apache/struts.git
synced 2026-08-05 06:36:58 +00:00
delete deprecated sitegraph plugin
This commit is contained in:
@@ -47,7 +47,6 @@ plugins/jasperreports/target
|
||||
plugins/json/target
|
||||
plugins/portlet-tiles/target
|
||||
plugins/portlet/target
|
||||
plugins/sitegraph/target
|
||||
plugins/sitemesh/target
|
||||
plugins/javatemplates/target
|
||||
bundles/demo/target
|
||||
|
||||
@@ -204,11 +204,6 @@
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
|
||||
@@ -193,10 +193,6 @@
|
||||
<directory>../plugins/rest/target/apidocs</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-rest-plugin/apidocs</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/sitegraph/target/apidocs</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-sitegraph-plugin/apidocs</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/sitemesh/target/apidocs</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-sitemesh-plugin/apidocs</outputDirectory>
|
||||
|
||||
@@ -128,10 +128,6 @@
|
||||
<directory>../plugins/rest/target/apidocs</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-rest-plugin/apidocs</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/sitegraph/target/apidocs</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-sitegraph-plugin/apidocs</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/sitemesh/target/apidocs</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-sitemesh-plugin/apidocs</outputDirectory>
|
||||
|
||||
@@ -151,11 +151,6 @@
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${struts-version.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<version>${struts-version.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
<module>portlet</module>
|
||||
<module>portlet-tiles</module>
|
||||
<module>rest</module>
|
||||
<module>sitegraph</module>
|
||||
<module>sitemesh</module>
|
||||
<module>spring</module>
|
||||
<module>testng</module>
|
||||
|
||||
@@ -1,170 +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>2.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>DEPRECATED: Struts 2 Sitegraph Plugin</name>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.apache.struts2.sitegraph.SiteGraph</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>struts2-junit-plugin</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Quickstart -->
|
||||
<dependency>
|
||||
<groupId>jetty</groupId>
|
||||
<artifactId>org.mortbay.jetty</artifactId>
|
||||
<version>5.1.4</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>eclipse</groupId>
|
||||
<artifactId>jdtcore</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tomcat</groupId>
|
||||
<artifactId>jasper-compiler</artifactId>
|
||||
<version>5.5.12</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tomcat</groupId>
|
||||
<artifactId>jasper-runtime</artifactId>
|
||||
<version>5.5.12</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tomcat</groupId>
|
||||
<artifactId>jasper-compiler-jdt</artifactId>
|
||||
<version>5.5.12</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-el</groupId>
|
||||
<artifactId>commons-el</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- The Servlet API mocks in Spring Framework 4.x only supports Servlet 3.0 and higher.
|
||||
This is only necessary in tests-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.rat</groupId>
|
||||
<artifactId>apache-rat-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>src/main/resources/org/apache/struts2/sitegraph/sitegraph-usage.txt</exclude>
|
||||
<exclude>src/test/resources/org/apache/struts2/sitegraph/out.txt</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -1,230 +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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p>
|
||||
* Struts comes with various related tools included in the struts-core-VERSION.jar file. You can access these
|
||||
* tools by simply unpacking the Struts distribution and running <b>java -jar struts-core-VERSION.jar</b>.
|
||||
* Struts will automatically include all jars in the same directory as the struts-core-VERSION.jar file as well as all
|
||||
* jars in the <i>lib</i> directory. This means you can invoke these tools either from within the standard directory
|
||||
* structure found in the Struts distribution, or from within your WEB-INF/lib directory.
|
||||
* </p>
|
||||
*
|
||||
* <p>You can access the help information for these tools by simply running the jar without any arguments.</p>
|
||||
*
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 0) {
|
||||
System.out.println("Usage:");
|
||||
System.out.println(" java -jar struts-toolbox.jar [command] (optional command args)");
|
||||
System.out.println("");
|
||||
System.out.println("Where [command] is one of the following:");
|
||||
System.out.println(" sitegraph");
|
||||
System.out.println(" sitegraph:xxx");
|
||||
System.out.println("");
|
||||
System.out.println("Execute the commands for additional usage instructions.");
|
||||
System.out.println("Note: the *:xxx commands are just shortcuts for ");
|
||||
System.out.println(" running the command on a webapp in the apps dir.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String javaHome = System.getProperty("java.home");
|
||||
ArrayList<URL> urls = new ArrayList<URL>();
|
||||
try {
|
||||
findJars(new File("lib"), urls);
|
||||
|
||||
// use all the jars in the current that aren't the src jar
|
||||
File wd = new File(".");
|
||||
File[] jars = wd.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".jar") && !name.contains("-src.");
|
||||
}
|
||||
});
|
||||
for (File jar : jars) {
|
||||
urls.add(jar.toURL());
|
||||
}
|
||||
|
||||
// ... but there might not be any (ie: we're in development in IDEA), so use this as backup
|
||||
urls.add(new File(System.getProperty("struts.classes", "build/java")).toURL());
|
||||
urls.add(new File(System.getProperty("xwork.classes", "../xwork/build/java/")).toURL());
|
||||
|
||||
// load tools.jar from JAVA_HOME
|
||||
File tools = new File(javaHome, "lib/tools.jar");
|
||||
if (!tools.exists()) {
|
||||
// hmm, not there, how about java.home?
|
||||
tools = new File(javaHome, "../lib/tools.jar");
|
||||
}
|
||||
if (!tools.exists()) {
|
||||
// try the OS X common path
|
||||
tools = new File(javaHome, "../Classes/classes.jar");
|
||||
}
|
||||
if (!tools.exists()) {
|
||||
// try the other OS X common path
|
||||
tools = new File(javaHome, "../Classes/classes.jar");
|
||||
}
|
||||
if (!tools.exists()) {
|
||||
// did the user specify it by hand?
|
||||
String prop = System.getProperty("tools");
|
||||
if (prop != null) {
|
||||
tools = new File(prop);
|
||||
}
|
||||
}
|
||||
if (!tools.exists()) {
|
||||
System.out.println("Error: Could not find tools.jar! Please do one of the following: ");
|
||||
System.out.println("");
|
||||
System.out.println(" - Use the JDK's JVM (ie: c:\\jdk1.5.0\\bin\\java)");
|
||||
System.out.println(" - Specify JAVA_HOME to point to your JDK 1.5 home");
|
||||
System.out.println(" - Specify a direct path to tools.jar via, as shown below:");
|
||||
System.out.println("");
|
||||
System.out.println(" java -Dtools=/path/to/tools.jar -jar struts.jar ...");
|
||||
return;
|
||||
}
|
||||
|
||||
// finally, add the verified tools.jar
|
||||
urls.add(tools.toURL());
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Could not find URLs -- see stack trace.");
|
||||
}
|
||||
|
||||
String command = args[0];
|
||||
String[] programArgs = new String[args.length - 1];
|
||||
System.arraycopy(args, 1, programArgs, 0, programArgs.length);
|
||||
|
||||
if (command.startsWith("sitegraph:")) {
|
||||
command = "sitegraph";
|
||||
String name = checkWebAppArgs(args);
|
||||
programArgs = new String[]{"-config", "apps/" + name + "/src/webapp/WEB-INF/classes",
|
||||
"-views", "apps/" + name + "/src/webapp",
|
||||
"-output", "."};
|
||||
}
|
||||
|
||||
if ("sitegraph".equals(command)) {
|
||||
launch("org.apache.struts2.sitegraph.SiteGraph", programArgs, urls);
|
||||
}
|
||||
}
|
||||
|
||||
private static String checkWebAppArgs(String[] args) {
|
||||
int colon = args[0].indexOf(':');
|
||||
String name = null;
|
||||
try {
|
||||
name = args[0].substring(colon + 1);
|
||||
} catch (Exception e) {
|
||||
//this is OK to skip
|
||||
}
|
||||
if (name == null || name.equals("")) {
|
||||
System.out.println("Error: you must specify the webapp you wish");
|
||||
System.out.println(" to deploy. The webapp name must be the");
|
||||
System.out.println(" name of the directory found in apps/.");
|
||||
System.out.println("");
|
||||
System.out.println("Example: java -jar struts-core-VERSION.jar quickstart:sandbox");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private static void launch(String program, String[] programArgs, List<URL> urls) {
|
||||
Collections.reverse(urls);
|
||||
URL[] urlArray = urls.toArray(new URL[urls.size()]);
|
||||
URLClassLoader cl = new MainClassLoader(urlArray);
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
try {
|
||||
Class clazz = cl.loadClass(program);
|
||||
Method main = clazz.getDeclaredMethod("main", new Class[]{String[].class});
|
||||
main.invoke(null, new Object[]{programArgs});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void findJars(File file, ArrayList<URL> urls) throws MalformedURLException {
|
||||
File[] files = file.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
findJars(f, urls);
|
||||
} else if (f.getName().endsWith(".jar")) {
|
||||
if (isValid(f.getName())) {
|
||||
urls.add(f.toURL());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isValid(String name) {
|
||||
return !"dom.jar".equals(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverses the typical order of classloading to defer only to the parent if the current class loader can't be
|
||||
* found. This is required to allow for the launcher to be embedded within struts.jar (otherwise the dependencies
|
||||
* wouldn't be found by the system ClassLoader when invoking using "java -jar struts-core-VERSION.jar ...").
|
||||
*/
|
||||
public static class MainClassLoader extends URLClassLoader {
|
||||
public MainClassLoader(URL[] urls) {
|
||||
super(urls);
|
||||
}
|
||||
|
||||
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
if (name.startsWith("org.xml.") || name.startsWith("org.w3c.")
|
||||
|| name.startsWith("java.") || name.startsWith("javax.")
|
||||
|| name.startsWith("sun.") || name.startsWith("com.sun.")) {
|
||||
return super.loadClass(name, resolve);
|
||||
}
|
||||
|
||||
ClassLoader parent = getParent();
|
||||
// First, check if the class has already been loaded
|
||||
Class c = findLoadedClass(name);
|
||||
if (c == null) {
|
||||
try {
|
||||
c = findClass(name);
|
||||
} catch (Throwable t) {
|
||||
// If still not found, only then ask the parent
|
||||
c = parent.loadClass(name);
|
||||
}
|
||||
}
|
||||
if (resolve) {
|
||||
resolveClass(c);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +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.sitegraph;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.sitegraph.renderers.DOTRenderer;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadocs-intro -->
|
||||
* <p>
|
||||
* SiteGraph is a tool that renders out GraphViz-generated images depicting your
|
||||
* Struts-powered web application's flow. SiteGraph requires GraphViz be installed
|
||||
* and that the "dot" executable be in your command path. You can find GraphViz
|
||||
* at http://www.graphviz.org.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: javadocs-intro -->
|
||||
*
|
||||
* <!-- START SNIPPET: javadocs-api -->
|
||||
* <p>
|
||||
* If you wish to use SiteGraph through its API rather than through the command line,
|
||||
* you can do that as well. All you need to do is create a new SiteGraph instance,
|
||||
* optionally specify a {@link Writer} to output the dot content to, and then call
|
||||
* {@link #prepare()}.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: javadocs-api -->
|
||||
*/
|
||||
public class SiteGraph {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(SiteGraph.class);
|
||||
|
||||
private String configDir;
|
||||
private String views;
|
||||
private String output;
|
||||
private String namespace;
|
||||
private Writer writer;
|
||||
|
||||
public SiteGraph(String configDir, String views, String output, String namespace) {
|
||||
this.configDir = configDir;
|
||||
this.views = views;
|
||||
this.output = output;
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("SiteGraph starting...");
|
||||
}
|
||||
|
||||
if (args.length != 8 && args.length != 6) {
|
||||
try (InputStream is = SiteGraph.class.getResourceAsStream("sitegraph-usage.txt");
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[2048];
|
||||
int length;
|
||||
while ((length = is.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
String usage = baos.toString();
|
||||
System.out.println(usage.replaceAll("//.*", ""));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
String configDir = getArg(args, "config");
|
||||
String views = getArg(args, "views");
|
||||
String output = getArg(args, "output");
|
||||
String namespace = getArg(args, "ns");
|
||||
|
||||
/** <!-- START SNIPPET: example-api --> */
|
||||
SiteGraph siteGraph = new SiteGraph(configDir, views, output, namespace);
|
||||
siteGraph.prepare();
|
||||
siteGraph.render();
|
||||
/** <!-- END SNIPPET: example-api --> */
|
||||
}
|
||||
|
||||
private static String getArg(String[] args, String arg) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (("-" + arg).equals(args[i]) && ((i + 1) < args.length)) {
|
||||
return args[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the dot generated content and writes out to the provided writer
|
||||
* object. If no writer has been given, that a {@link FileWriter} pointing to "out.dot"
|
||||
* in the specified output directly shall be used.
|
||||
*/
|
||||
public void prepare() {
|
||||
if (writer == null) {
|
||||
try {
|
||||
writer = new FileWriter(output + "/out.dot");
|
||||
} catch (IOException e) {
|
||||
throw new StrutsException(e);
|
||||
}
|
||||
}
|
||||
|
||||
StrutsConfigRetriever.setConfiguration(configDir, views.split("[,]+"));
|
||||
DOTRenderer renderer = new DOTRenderer(writer);
|
||||
renderer.render(namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the dot command, cause GraphViz to render out.dot in the form of out.gif,
|
||||
* located in the specified output directory. If an error occurs during this process,
|
||||
* the error is logged and the method completes without throwing an exception.
|
||||
*/
|
||||
public void render() {
|
||||
try {
|
||||
Runtime.getRuntime().exec("dot -o" + output + "/out.gif -Tgif " + output + "/out.dot");
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not invoke dot", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setWriter(Writer writer) {
|
||||
this.writer = writer;
|
||||
}
|
||||
}
|
||||
-199
@@ -1,199 +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.sitegraph;
|
||||
|
||||
import com.opensymphony.xwork2.config.ConfigurationManager;
|
||||
import com.opensymphony.xwork2.config.ConfigurationProvider;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.config.entities.ResultConfig;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.struts2.config.DefaultBeanSelectionProvider;
|
||||
import org.apache.struts2.config.DefaultPropertiesProvider;
|
||||
import org.apache.struts2.config.PropertiesConfigurationProvider;
|
||||
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
|
||||
import org.apache.struts2.sitegraph.entities.FreeMarkerView;
|
||||
import org.apache.struts2.sitegraph.entities.JspView;
|
||||
import org.apache.struts2.sitegraph.entities.VelocityView;
|
||||
import org.apache.struts2.sitegraph.entities.View;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Initializes and retrieves XWork config elements
|
||||
*/
|
||||
public class StrutsConfigRetriever {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(StrutsConfigRetriever.class);
|
||||
private static String configDir;
|
||||
private static String[] views;
|
||||
private static boolean isXWorkStarted = false;
|
||||
private static Map<String, View> viewCache = new LinkedHashMap<String, View>();
|
||||
private static ConfigurationManager cm;
|
||||
|
||||
/**
|
||||
* Returns a Map of all action names/configs
|
||||
*
|
||||
* @return Map of all action names/configs
|
||||
*/
|
||||
public static Map<String, Map<String,ActionConfig>> getActionConfigs() {
|
||||
if (!isXWorkStarted)
|
||||
initXWork();
|
||||
return cm.getConfiguration().getRuntimeConfiguration().getActionConfigs();
|
||||
}
|
||||
|
||||
private static void initXWork() {
|
||||
String configFilePath = configDir + "/struts.xml";
|
||||
File configFile = new File(configFilePath);
|
||||
try {
|
||||
ConfigurationProvider configProvider = new StrutsXmlConfigurationProvider(configFile.getCanonicalPath(), true, null);
|
||||
cm = new ConfigurationManager(Container.DEFAULT_NAME);
|
||||
cm.addContainerProvider(new DefaultPropertiesProvider());
|
||||
cm.addContainerProvider(new StrutsXmlConfigurationProvider("struts-default.xml", false, null));
|
||||
cm.addContainerProvider(configProvider);
|
||||
cm.addContainerProvider(new PropertiesConfigurationProvider());
|
||||
cm.addContainerProvider(new DefaultBeanSelectionProvider());
|
||||
isXWorkStarted = true;
|
||||
} catch (IOException e) {
|
||||
LOG.error("IOException", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<String> getNamespaces() {
|
||||
Set<String> namespaces= Collections.emptySet();
|
||||
Map<String, Map<String, ActionConfig>> allActionConfigs = getActionConfigs();
|
||||
if (allActionConfigs != null) {
|
||||
namespaces = allActionConfigs.keySet();
|
||||
}
|
||||
return namespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Set of the action names for this namespace.
|
||||
*
|
||||
* @param namespace
|
||||
* @return Set of the action names for this namespace.
|
||||
*/
|
||||
public static Set<String> getActionNames(String namespace) {
|
||||
Set<String> actionNames = Collections.emptySet();
|
||||
Map<String, Map<String, ActionConfig>> allActionConfigs = getActionConfigs();
|
||||
if (allActionConfigs != null) {
|
||||
Map<String, ActionConfig> actionMappings = allActionConfigs.get(namespace);
|
||||
if (actionMappings != null) {
|
||||
actionNames = actionMappings.keySet();
|
||||
}
|
||||
}
|
||||
return actionNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActionConfig for this action name at this namespace.
|
||||
*
|
||||
* @param namespace
|
||||
* @param actionName
|
||||
* @return The ActionConfig for this action name at this namespace.
|
||||
*/
|
||||
public static ActionConfig getActionConfig(String namespace, String actionName) {
|
||||
ActionConfig config = null;
|
||||
Map allActionConfigs = getActionConfigs();
|
||||
if (allActionConfigs != null) {
|
||||
Map actionMappings = (Map) allActionConfigs.get(namespace);
|
||||
if (actionMappings != null) {
|
||||
config = (ActionConfig) actionMappings.get(actionName);
|
||||
}
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
public static ResultConfig getResultConfig(String namespace, String actionName,
|
||||
String resultName) {
|
||||
ResultConfig result = null;
|
||||
ActionConfig actionConfig = getActionConfig(namespace, actionName);
|
||||
if (actionConfig != null) {
|
||||
Map resultMap = actionConfig.getResults();
|
||||
result = (ResultConfig) resultMap.get(resultName);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static File getViewFile(String namespace, String actionName, String resultName) {
|
||||
ResultConfig result = getResultConfig(namespace, actionName, resultName);
|
||||
String location = result.getParams().get("location");
|
||||
for (String viewRoot : views) {
|
||||
File viewFile = getViewFileInternal(viewRoot, location, namespace);
|
||||
if (viewFile != null) {
|
||||
return viewFile;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static File getViewFileInternal(String root, String location, String namespace) {
|
||||
StringBuilder filePath = new StringBuilder(root);
|
||||
if (!location.startsWith("/")) {
|
||||
filePath.append(namespace).append('/');
|
||||
}
|
||||
filePath.append(location);
|
||||
File viewFile = new File(filePath.toString());
|
||||
if (viewFile.exists()) {
|
||||
return viewFile;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static View getView(String namespace, String actionName, String resultName, int type) {
|
||||
String viewId = namespace + "/" + actionName + "/" + resultName;
|
||||
View view = viewCache.get(viewId);
|
||||
if (view == null) {
|
||||
File viewFile = StrutsConfigRetriever.getViewFile(namespace, actionName, resultName);
|
||||
if (viewFile != null) {
|
||||
switch (type) {
|
||||
case View.TYPE_JSP:
|
||||
view = new JspView(viewFile);
|
||||
break;
|
||||
case View.TYPE_FTL:
|
||||
view = new FreeMarkerView(viewFile);
|
||||
break;
|
||||
case View.TYPE_VM:
|
||||
view = new VelocityView(viewFile);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
viewCache.put(viewId, view);
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public static void setConfiguration(String configDir, String[] views) {
|
||||
StrutsConfigRetriever.configDir = configDir;
|
||||
StrutsConfigRetriever.views = views;
|
||||
isXWorkStarted = false;
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +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.sitegraph.entities;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.struts2.sitegraph.model.Link;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class FileBasedView implements View {
|
||||
private String name;
|
||||
private String contents;
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(FileBasedView.class);
|
||||
|
||||
public FileBasedView(File file) {
|
||||
this.name = file.getName();
|
||||
// get the contents as a single line
|
||||
this.contents = readFile(file).replaceAll("[\r\n ]+", " ");
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Set<Target> getTargets() {
|
||||
TreeSet<Target> targets = new TreeSet<Target>();
|
||||
|
||||
// links
|
||||
matchPatterns(getLinkPattern(), targets, Link.TYPE_HREF);
|
||||
|
||||
// actions
|
||||
matchPatterns(getActionPattern(), targets, Link.TYPE_ACTION);
|
||||
|
||||
// forms
|
||||
matchPatterns(getFormPattern(), targets, Link.TYPE_FORM);
|
||||
|
||||
return targets;
|
||||
}
|
||||
|
||||
protected Pattern getLinkPattern() {
|
||||
// FIXME: work with new configuration style
|
||||
//Object ext = Settings.get(StrutsConstants.STRUTS_ACTION_EXTENSION);
|
||||
String ext = "action";
|
||||
String actionRegex = "([A-Za-z0-9\\._\\-!]+\\." + ext + ")";
|
||||
return Pattern.compile(actionRegex);
|
||||
}
|
||||
|
||||
private void matchPatterns(Pattern pattern, Set<Target> targets, int type) {
|
||||
Matcher matcher = pattern.matcher(contents);
|
||||
while (matcher.find()) {
|
||||
String target = matcher.group(1);
|
||||
targets.add(new Target(target, type));
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Pattern getActionPattern();
|
||||
|
||||
protected abstract Pattern getFormPattern();
|
||||
|
||||
protected String readFile(File file) {
|
||||
try (BufferedReader in = new BufferedReader(new FileReader(file))) {
|
||||
String s;
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
while ((s = in.readLine()) != null) {
|
||||
buffer.append(s).append('\n');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
} catch (FileNotFoundException e) {
|
||||
if (LOG.isWarnEnabled()) {
|
||||
LOG.warn("File not found");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Cannot read file: "+file, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +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.sitegraph.entities;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FreeMarkerView extends FileBasedView {
|
||||
public FreeMarkerView(File file) {
|
||||
super(file);
|
||||
}
|
||||
|
||||
protected Pattern getActionPattern() {
|
||||
return Pattern.compile("<@s.action [^>]*name=\"([^\"]+)\"[^>]*>");
|
||||
}
|
||||
|
||||
protected Pattern getFormPattern() {
|
||||
return Pattern.compile("<@s.form [^>]*action=\"([^\"]+)\"[^>]*>");
|
||||
}
|
||||
}
|
||||
@@ -1,38 +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.sitegraph.entities;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class JspView extends FileBasedView {
|
||||
public JspView(File file) {
|
||||
super(file);
|
||||
}
|
||||
|
||||
protected Pattern getActionPattern() {
|
||||
return Pattern.compile("<a:action [^>]*name=\"([^\"]+)\"[^>]*>");
|
||||
}
|
||||
|
||||
protected Pattern getFormPattern() {
|
||||
return Pattern.compile("<a:form [^>]*action=\"([^\"]+)\"[^>]*>");
|
||||
}
|
||||
}
|
||||
@@ -1,69 +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.sitegraph.entities;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Target implements Comparable<Target> {
|
||||
|
||||
private String target;
|
||||
private int type;
|
||||
|
||||
public Target(String target, int type) {
|
||||
this.target = target;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Target)) return false;
|
||||
|
||||
final Target target1 = (Target) o;
|
||||
|
||||
if (type != target1.type) return false;
|
||||
if (target != null ? !target.equals(target1.target) : target1.target != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result;
|
||||
result = (target != null ? target.hashCode() : 0);
|
||||
result = 29 * result + type;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int compareTo(Target o) {
|
||||
if (o.target != null && target != null) {
|
||||
return o.target.compareTo(target);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-38
@@ -1,38 +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.sitegraph.entities;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class VelocityView extends FileBasedView {
|
||||
public VelocityView(File file) {
|
||||
super(file);
|
||||
}
|
||||
|
||||
protected Pattern getActionPattern() {
|
||||
return Pattern.compile("#tag( Action [^)]*name=\"([^\"]+)\"[^)]*)");
|
||||
}
|
||||
|
||||
protected Pattern getFormPattern() {
|
||||
return Pattern.compile("#tag \\(Form [^)]*action=\"([^\"]+)\"[^)]*\\)");
|
||||
}
|
||||
}
|
||||
@@ -1,44 +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.sitegraph.entities;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TODO Describe View
|
||||
*/
|
||||
public interface View {
|
||||
public static final int TYPE_JSP = 0;
|
||||
public static final int TYPE_VM = 1;
|
||||
public static final int TYPE_FTL = 2;
|
||||
|
||||
/**
|
||||
* Name of view file
|
||||
*
|
||||
* @return The name of the view file.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Returns Set of Commands linked to by this view
|
||||
*
|
||||
* @return a set of Targets
|
||||
*/
|
||||
public Set<Target> getTargets();
|
||||
}
|
||||
@@ -1,31 +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.sitegraph.model;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ActionNode extends SiteGraphNode {
|
||||
public ActionNode(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return "coral1";
|
||||
}
|
||||
}
|
||||
@@ -1,85 +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.sitegraph.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Graph extends SubGraph {
|
||||
private Set<Link> links;
|
||||
public static Map<String,SiteGraphNode> nodeMap = new LinkedHashMap<String,SiteGraphNode>();
|
||||
|
||||
public Graph() {
|
||||
super("");
|
||||
this.links = new TreeSet<Link>();
|
||||
}
|
||||
|
||||
public void addLink(Link link) {
|
||||
links.add(link);
|
||||
}
|
||||
|
||||
public void render(IndentWriter writer) throws IOException {
|
||||
// write out the header
|
||||
writer.write("digraph mygraph {", true);
|
||||
writer.write("fontsize=10;");
|
||||
writer.write("fontname=helvetica;");
|
||||
writer.write("node [fontsize=10, fontname=helvetica, style=filled, shape=rectangle]");
|
||||
writer.write("edge [fontsize=10, fontname=helvetica]");
|
||||
|
||||
// render all the subgraphs
|
||||
for (SubGraph subGraph : subGraphs) {
|
||||
subGraph.render(new IndentWriter(writer));
|
||||
}
|
||||
|
||||
// render all the nodes
|
||||
for (SiteGraphNode siteGraphNode : nodes) {
|
||||
siteGraphNode.render(writer);
|
||||
}
|
||||
|
||||
// finally, render the links
|
||||
for (Link link : links) {
|
||||
link.render(writer);
|
||||
}
|
||||
|
||||
// and now the footer
|
||||
writer.write("}", true);
|
||||
}
|
||||
|
||||
public SiteGraphNode findNode(String location, SiteGraphNode ref) {
|
||||
if (location.startsWith("/")) {
|
||||
location = location.substring(1);
|
||||
} else {
|
||||
// not absolute, so use the reference node
|
||||
String prefix;
|
||||
if (ref.getParent() != null) {
|
||||
prefix = ref.getParent().getPrefix();
|
||||
location = prefix + "_" + location;
|
||||
}
|
||||
}
|
||||
|
||||
location = location.replaceAll("[\\./\\-\\$\\{\\}]", "_");
|
||||
|
||||
return nodeMap.get(location);
|
||||
}
|
||||
}
|
||||
@@ -1,60 +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.sitegraph.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class IndentWriter extends Writer {
|
||||
Writer writer;
|
||||
|
||||
public IndentWriter(Writer writer) {
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
public void write(String str) throws IOException {
|
||||
write(str, false);
|
||||
}
|
||||
|
||||
public void write(String str, boolean noIndent) throws IOException {
|
||||
if (!noIndent) {
|
||||
str = " " + str;
|
||||
}
|
||||
|
||||
if (writer instanceof IndentWriter) {
|
||||
((IndentWriter) writer).write(str, false);
|
||||
} else {
|
||||
writer.write(str + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void write(char cbuf[], int off, int len) throws IOException {
|
||||
writer.write(cbuf, off, len);
|
||||
}
|
||||
}
|
||||
@@ -1,92 +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.sitegraph.model;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Link implements Render, Comparable {
|
||||
public static final int TYPE_FORM = 0;
|
||||
public static final int TYPE_ACTION = 1;
|
||||
public static final int TYPE_HREF = 2;
|
||||
public static final int TYPE_RESULT = 3;
|
||||
public static final int TYPE_REDIRECT = 4;
|
||||
|
||||
private SiteGraphNode from;
|
||||
private SiteGraphNode to;
|
||||
private int type;
|
||||
private String label;
|
||||
|
||||
public Link(SiteGraphNode from, SiteGraphNode to, int type, String label) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.type = type;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void render(IndentWriter writer) throws IOException {
|
||||
writer.write(from.getFullName() + " -> " + to.getFullName() + " [label=\"" + getRealLabel() + "\"" + getColor() + "];");
|
||||
}
|
||||
|
||||
private String getRealLabel() {
|
||||
switch (type) {
|
||||
case TYPE_ACTION:
|
||||
return "action" + label;
|
||||
case TYPE_FORM:
|
||||
return "form" + label;
|
||||
case TYPE_HREF:
|
||||
return "href" + label;
|
||||
case TYPE_REDIRECT:
|
||||
return "redirect: " + label;
|
||||
case TYPE_RESULT:
|
||||
return label;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getColor() {
|
||||
if (type == TYPE_RESULT || type == TYPE_ACTION) {
|
||||
return ",color=\"darkseagreen2\"";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public int compareTo(Object o) {
|
||||
Link other = (Link) o;
|
||||
int result = from.compareTo(other.from);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = to.compareTo(other.to);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = label.compareTo(other.label);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return new Integer(type).compareTo(other.type);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +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.sitegraph.model;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface Render {
|
||||
public void render(IndentWriter writer) throws IOException;
|
||||
}
|
||||
@@ -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.sitegraph.model;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class SiteGraphNode implements Render, Comparable {
|
||||
private String name;
|
||||
private SubGraph parent;
|
||||
|
||||
public SiteGraphNode(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SubGraph getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(SubGraph parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void render(IndentWriter writer) throws IOException {
|
||||
writer.write(getFullName() + " [label=\"" + name + "\",color=\"" + getColor() + "\"];");
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
String prefix = "";
|
||||
if (parent != null) {
|
||||
String parentPrefix = parent.getPrefix();
|
||||
if (!parentPrefix.equals("")) {
|
||||
prefix = parentPrefix + "_";
|
||||
}
|
||||
}
|
||||
return prefix + cleanName();
|
||||
}
|
||||
|
||||
private String cleanName() {
|
||||
return name.replaceAll("[\\./\\-\\$\\{\\}]", "_");
|
||||
}
|
||||
|
||||
public abstract String getColor();
|
||||
|
||||
public int compareTo(Object o) {
|
||||
return name.compareTo(((SiteGraphNode) o).name);
|
||||
}
|
||||
}
|
||||
@@ -1,125 +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.sitegraph.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SubGraph implements Render {
|
||||
protected String name;
|
||||
protected SubGraph parent;
|
||||
protected List<SubGraph> subGraphs;
|
||||
protected List<SiteGraphNode> nodes;
|
||||
|
||||
public SubGraph(String name) {
|
||||
this.name = name;
|
||||
this.subGraphs = new ArrayList<SubGraph>();
|
||||
this.nodes = new ArrayList<SiteGraphNode>();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void addSubGraph(SubGraph subGraph) {
|
||||
subGraph.setParent(this);
|
||||
subGraphs.add(subGraph);
|
||||
}
|
||||
|
||||
public void setParent(SubGraph parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void addNode(SiteGraphNode node) {
|
||||
node.setParent(this);
|
||||
Graph.nodeMap.put(node.getFullName(), node);
|
||||
nodes.add(node);
|
||||
}
|
||||
|
||||
public void render(IndentWriter writer) throws IOException {
|
||||
// write the header
|
||||
writer.write("subgraph cluster_" + getPrefix() + " {", true);
|
||||
writer.write("color=grey;");
|
||||
writer.write("fontcolor=grey;");
|
||||
writer.write("label=\"" + name + "\";");
|
||||
|
||||
// write out the subgraphs
|
||||
for (SubGraph subGraph : subGraphs) {
|
||||
subGraph.render(new IndentWriter(writer));
|
||||
}
|
||||
|
||||
// write out the actions
|
||||
for (SiteGraphNode siteGraphNode : nodes) {
|
||||
siteGraphNode.render(writer);
|
||||
}
|
||||
|
||||
// .. footer
|
||||
writer.write("}", true);
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
if (parent == null) {
|
||||
return name;
|
||||
} else {
|
||||
String prefix = parent.getPrefix();
|
||||
if (prefix.equals("")) {
|
||||
return name;
|
||||
} else {
|
||||
return prefix + "_" + name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SubGraph create(String namespace) {
|
||||
if (namespace.equals("")) {
|
||||
return this;
|
||||
}
|
||||
|
||||
String[] parts = namespace.split("/");
|
||||
SubGraph last = this;
|
||||
for (String part : parts) {
|
||||
if (part.equals("")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SubGraph subGraph = findSubGraph(part);
|
||||
if (subGraph == null) {
|
||||
subGraph = new SubGraph(part);
|
||||
last.addSubGraph(subGraph);
|
||||
}
|
||||
|
||||
last = subGraph;
|
||||
}
|
||||
|
||||
return last;
|
||||
}
|
||||
|
||||
private SubGraph findSubGraph(String name) {
|
||||
for (SubGraph subGraph : subGraphs) {
|
||||
if (subGraph.getName().equals(name)) {
|
||||
return subGraph;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +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.sitegraph.model;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ViewNode extends SiteGraphNode {
|
||||
public ViewNode(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return "darkseagreen2";
|
||||
}
|
||||
}
|
||||
-239
@@ -1,239 +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.sitegraph.renderers;
|
||||
|
||||
import com.opensymphony.xwork2.ActionChainResult;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.config.entities.ResultConfig;
|
||||
import org.apache.struts2.sitegraph.StrutsConfigRetriever;
|
||||
import org.apache.struts2.sitegraph.entities.Target;
|
||||
import org.apache.struts2.sitegraph.entities.View;
|
||||
import org.apache.struts2.sitegraph.model.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Renders flow diagram to the console at info level
|
||||
*/
|
||||
public class DOTRenderer {
|
||||
|
||||
private Writer writer;
|
||||
private List<TempLink> links = new ArrayList<TempLink>();
|
||||
|
||||
public DOTRenderer(Writer writer) {
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
public void render(String ns) {
|
||||
Graph graph = new Graph();
|
||||
|
||||
TreeMap<ViewNode, View> viewMap = new TreeMap<ViewNode, View>(new Comparator<ViewNode>() {
|
||||
public int compare(ViewNode v1, ViewNode v2) {
|
||||
|
||||
return v1.getFullName().compareTo(v2.getFullName());
|
||||
}
|
||||
});
|
||||
|
||||
Set<String> namespaces = StrutsConfigRetriever.getNamespaces();
|
||||
for (String namespace : namespaces) {
|
||||
if (!namespace.startsWith(ns)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SubGraph subGraph = graph.create(namespace);
|
||||
|
||||
Set<String> actionNames = StrutsConfigRetriever.getActionNames(namespace);
|
||||
for (String actionName : actionNames) {
|
||||
ActionConfig actionConfig = StrutsConfigRetriever.getActionConfig(namespace,
|
||||
actionName);
|
||||
|
||||
ActionNode action = new ActionNode(actionName);
|
||||
subGraph.addNode(action);
|
||||
|
||||
Set<String> resultNames = actionConfig.getResults().keySet();
|
||||
for (String resultName : resultNames) {
|
||||
ResultConfig resultConfig = actionConfig.getResults().get(resultName);
|
||||
String resultClassName = resultConfig.getClassName();
|
||||
|
||||
if (resultClassName.equals(ActionChainResult.class.getName())) {
|
||||
|
||||
} else if (resultClassName.contains("Dispatcher")
|
||||
|| resultClassName.contains("Velocity")
|
||||
|| resultClassName.contains("Freemarker")) {
|
||||
if (resultConfig.getParams().get("location") == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String location = getViewLocation(resultConfig.getParams().get("location"), namespace);
|
||||
// FIXME: work with new configuration style
|
||||
if (location.endsWith("action")) {
|
||||
addTempLink(action, location, Link.TYPE_RESULT, resultConfig.getName());
|
||||
} else {
|
||||
ViewNode view = new ViewNode(stripLocation(location));
|
||||
subGraph.addNode(view);
|
||||
|
||||
addTempLink(action, location, Link.TYPE_RESULT, resultConfig.getName());
|
||||
|
||||
View viewFile = getView(namespace, actionName, resultName, location);
|
||||
if (viewFile != null) {
|
||||
viewMap.put(view, viewFile);
|
||||
}
|
||||
}
|
||||
} else if (resultClassName.contains("Jasper")) {
|
||||
|
||||
} else if (resultClassName.contains("XSLT")) {
|
||||
|
||||
} else if (resultClassName.contains("Redirect")) {
|
||||
// check if the redirect is to an action -- if so, link it
|
||||
String locationConfig = resultConfig.getParams().get("location");
|
||||
if (locationConfig == null) {
|
||||
locationConfig = resultConfig.getParams().get("actionName");
|
||||
}
|
||||
String location = getViewLocation(locationConfig, namespace);
|
||||
// FIXME: work with new configuration style
|
||||
if (location.endsWith("action")) {
|
||||
addTempLink(action, location, Link.TYPE_REDIRECT, resultConfig.getName());
|
||||
} else {
|
||||
ViewNode view = new ViewNode(stripLocation(location));
|
||||
subGraph.addNode(view);
|
||||
|
||||
addTempLink(action, location, Link.TYPE_REDIRECT, resultConfig.getName());
|
||||
|
||||
View viewFile = getView(namespace, actionName, resultName, location);
|
||||
if (viewFile != null) {
|
||||
viewMap.put(view, viewFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now look for links in the view
|
||||
for (Map.Entry<ViewNode, View> viewNodeViewEntry : viewMap.entrySet()) {
|
||||
ViewNode view = viewNodeViewEntry.getKey();
|
||||
View viewFile = viewNodeViewEntry.getValue();
|
||||
Set<Target> targets = viewFile.getTargets();
|
||||
for (Target target : targets) {
|
||||
String viewTarget = target.getTarget();
|
||||
addTempLink(view, viewTarget, target.getType(), "");
|
||||
}
|
||||
}
|
||||
|
||||
// finally, let's match up these links as real Link objects
|
||||
for (TempLink temp : links) {
|
||||
String location = temp.location;
|
||||
|
||||
// FIXME: work with new configuration style
|
||||
if (location.endsWith("action")) {
|
||||
location = location.substring(0, location.indexOf("action") - 1);
|
||||
|
||||
if (location.indexOf('!') != -1) {
|
||||
temp.label = temp.label + "\\n(" + location.substring(location.indexOf('!')) + ")";
|
||||
location = location.substring(0, location.indexOf('!'));
|
||||
}
|
||||
}
|
||||
SiteGraphNode to = graph.findNode(location, temp.node);
|
||||
if (to != null) {
|
||||
graph.addLink(new Link(temp.node, to, temp.typeResult, temp.label));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
//writer.write(graph.to_s(true));
|
||||
graph.render(new IndentWriter(writer));
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void addTempLink(SiteGraphNode node, String location, int type, String label) {
|
||||
links.add(new TempLink(node, location, type, label));
|
||||
}
|
||||
|
||||
private String stripLocation(String location) {
|
||||
return location.substring(location.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
private View getView(String namespace, String actionName, String resultName, String location) {
|
||||
int type = View.TYPE_JSP;
|
||||
if (location.endsWith(".fm") || location.endsWith(".ftl")) {
|
||||
type = View.TYPE_FTL;
|
||||
} else if (location.endsWith(".vm")) {
|
||||
type = View.TYPE_VM;
|
||||
}
|
||||
return StrutsConfigRetriever.getView(namespace, actionName, resultName, type);
|
||||
}
|
||||
|
||||
private String getViewLocation(String location, String namespace) {
|
||||
String view;
|
||||
if (!location.startsWith("/")) {
|
||||
view = namespace + "/" + location;
|
||||
} else {
|
||||
view = location;
|
||||
}
|
||||
|
||||
if (view.indexOf('?') != -1) {
|
||||
view = view.substring(0, view.indexOf('?'));
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
class TempLink {
|
||||
SiteGraphNode node;
|
||||
String location;
|
||||
int typeResult;
|
||||
String label;
|
||||
|
||||
public TempLink(SiteGraphNode node, String location, int typeResult, String label) {
|
||||
this.node = node;
|
||||
this.location = location;
|
||||
this.typeResult = typeResult;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof TempLink)) return false;
|
||||
|
||||
final TempLink tempLink = (TempLink) o;
|
||||
|
||||
if (typeResult != tempLink.typeResult) return false;
|
||||
if (label != null ? !label.equals(tempLink.label) : tempLink.label != null) return false;
|
||||
if (location != null ? !location.equals(tempLink.location) : tempLink.location != null) return false;
|
||||
if (node != null ? !node.equals(tempLink.node) : tempLink.node != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result;
|
||||
result = (node != null ? node.hashCode() : 0);
|
||||
result = 29 * result + (location != null ? location.hashCode() : 0);
|
||||
result = 29 * result + typeResult;
|
||||
result = 29 * result + (label != null ? label.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,5 +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/).
|
||||
@@ -1,7 +0,0 @@
|
||||
<!-- START SNIPPET: sitegraph-usage -->
|
||||
Usage: -config CONFIG_DIR -views VIEWS_DIRS -output OUTPUT [-ns NAMESPACE]
|
||||
CONFIG_DIR => a directory containing struts.xml
|
||||
VIEWS_DIRS => comma seperated list of dirs containing JSPs, VMs, etc
|
||||
OUPUT => the directory where the output should go
|
||||
NAMESPACE => the namespace path restriction (/, /foo, etc)
|
||||
<!-- END SNIPPET: sitegraph-usage -->
|
||||
@@ -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,57 +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.sitegraph;
|
||||
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class SiteGraphTest extends StrutsTestCase {
|
||||
public void testWebFlow() throws Exception {
|
||||
// use the classloader rather than relying on the
|
||||
// working directory being an assumed value when
|
||||
// running the test: so let's get this class's parent dir
|
||||
URL url = ClassLoaderUtil.getResource("org/apache/struts2/sitegraph/struts.xml", SiteGraphTest.class);
|
||||
File file = new File(url.toURI());
|
||||
String dir = file.getParent();
|
||||
|
||||
SiteGraph siteGraph = new SiteGraph(dir, dir, dir, "");
|
||||
StringWriter writer = new StringWriter();
|
||||
siteGraph.setWriter(writer);
|
||||
siteGraph.prepare();
|
||||
|
||||
URL compare = SiteGraphTest.class.getResource("out.txt");
|
||||
StringBuilder buffer = new StringBuilder(128);
|
||||
try (InputStream in = compare.openStream()){
|
||||
byte[] buf = new byte[4096];
|
||||
int nbytes;
|
||||
|
||||
while ((nbytes = in.read(buf)) > 0) {
|
||||
buffer.append(new String(buf, 0, nbytes));
|
||||
}
|
||||
}
|
||||
assertEquals(buffer.toString().replaceAll("\r\n", "\n"), writer.toString().replaceAll("\r\n", "\n"));
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<%--
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
--%>
|
||||
nothing here, move along...
|
||||
@@ -1,33 +0,0 @@
|
||||
digraph mygraph {
|
||||
fontsize=10;
|
||||
fontname=helvetica;
|
||||
node [fontsize=10, fontname=helvetica, style=filled, shape=rectangle]
|
||||
edge [fontsize=10, fontname=helvetica]
|
||||
subgraph cluster_tutorial {
|
||||
color=grey;
|
||||
fontcolor=grey;
|
||||
label="tutorial";
|
||||
subgraph cluster_tutorial_sitegraph {
|
||||
color=grey;
|
||||
fontcolor=grey;
|
||||
label="sitegraph";
|
||||
tutorial_sitegraph_guess [label="guess",color="coral1"];
|
||||
tutorial_sitegraph_guess_success_jsp [label="guess-success.jsp",color="darkseagreen2"];
|
||||
tutorial_sitegraph_guess_input_ftl [label="guess-input.ftl",color="darkseagreen2"];
|
||||
tutorial_sitegraph_guess_error_ftl [label="guess-error.ftl",color="darkseagreen2"];
|
||||
}
|
||||
tutorial_test [label="test",color="coral1"];
|
||||
tutorial_guess_input_ftl [label="guess-input.ftl",color="darkseagreen2"];
|
||||
}
|
||||
hello [label="hello",color="coral1"];
|
||||
hello_jsp [label="hello.jsp",color="darkseagreen2"];
|
||||
tutorial_sitegraph_guess -> tutorial_sitegraph_guess_error_ftl [label="error",color="darkseagreen2"];
|
||||
tutorial_sitegraph_guess -> tutorial_sitegraph_guess_input_ftl [label="input",color="darkseagreen2"];
|
||||
tutorial_sitegraph_guess -> tutorial_sitegraph_guess_success_jsp [label="redirect: success"];
|
||||
tutorial_sitegraph_guess_input_ftl -> tutorial_sitegraph_guess [label="form"];
|
||||
tutorial_sitegraph_guess_success_jsp -> tutorial_sitegraph_guess [label="href\n(!default)"];
|
||||
hello -> hello_jsp [label="success",color="darkseagreen2"];
|
||||
hello -> tutorial_test [label="redirect: tutorial"];
|
||||
hello -> tutorial_test [label="redirect: tutorial2"];
|
||||
tutorial_test -> tutorial_sitegraph_guess_input_ftl [label="input",color="darkseagreen2"];
|
||||
}
|
||||
@@ -1,58 +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 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="default" extends="struts-default">
|
||||
<action name="hello" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">hello.jsp</result>
|
||||
<result name="tutorial" type="redirect">/tutorial/test.action</result>
|
||||
<result name="tutorial2" type="redirectAction">/tutorial/test.action</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="tutorial" namespace="/tutorial" extends="struts-default">
|
||||
<result-types>
|
||||
<result-type name="freemarker" default="true"
|
||||
class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
|
||||
</result-types>
|
||||
|
||||
<action name="test" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="input">sitegraph/guess-input.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="sitegraph" namespace="/tutorial/sitegraph" extends="struts-default">
|
||||
<result-types>
|
||||
<result-type name="freemarker" default="true"
|
||||
class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
|
||||
</result-types>
|
||||
|
||||
<action name="guess" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success" type="redirect">guess-success.jsp</result>
|
||||
<result name="input">guess-input.ftl</result>
|
||||
<result name="error">guess-error.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
-21
@@ -1,21 +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.
|
||||
*/
|
||||
-->
|
||||
Error!
|
||||
-32
@@ -1,32 +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.
|
||||
*/
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Guess a number</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<@s.form action="guess" method="post">
|
||||
<@s.textfield label="Guess a number" name="guess"/>
|
||||
<@s.submit value="Guess"/>
|
||||
</@s.form>
|
||||
</body>
|
||||
</html>
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
<%--
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
--%>
|
||||
You guessed correctly! Want to play <a href="guess!default.action">again</a>?
|
||||
@@ -366,7 +366,6 @@
|
||||
<exclude>src/main/webapp/**/*.js</exclude>
|
||||
<exclude>src/main/webapp/**/*.svg</exclude>
|
||||
<exclude>src/main/webapp/**/*.txt</exclude>
|
||||
<exclude>src/main/resources/**/sitegraph-usage.txt</exclude>
|
||||
<exclude>src/main/resources/**/docs-urls.txt</exclude>
|
||||
<exclude>src/etc/header.txt</exclude>
|
||||
<exclude>src/main/resources/static/css/**/*.css</exclude>
|
||||
@@ -643,11 +642,6 @@
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user