mirror of
https://github.com/apache/struts.git
synced 2026-08-10 17:16:58 +00:00
Compare commits
193 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea055ccb9d | |||
| 82e768b673 | |||
| 002f4ab8c0 | |||
| 2cce257320 | |||
| 146d2677c6 | |||
| f628fa5baa | |||
| 36e823c7e9 | |||
| 90efa7b36a | |||
| 342a201eb7 | |||
| dbcc05d102 | |||
| c231c7290a | |||
| 8c483d68bc | |||
| 6a5c4c2c53 | |||
| 2ba492bceb | |||
| 9375fe9c6a | |||
| de6869e67f | |||
| 97fa4e4a37 | |||
| c8db212ccf | |||
| bbc9c697cd | |||
| 09d906ef98 | |||
| 04505b92a2 | |||
| 6ee3d124e4 | |||
| 5494663fd4 | |||
| b07f659693 | |||
| 2ea2d869cc | |||
| bbd4170da6 | |||
| 4e9821f05b | |||
| 74b2fb7bf4 | |||
| 250442591c | |||
| f087df85f9 | |||
| 4283e8972d | |||
| 712fd1a1ab | |||
| 35521822c3 | |||
| d452e63c79 | |||
| 81b7e03f1f | |||
| c8eef15176 | |||
| 8645eee9bd | |||
| 86777e8614 | |||
| 5ccff073f5 | |||
| c9eaf8f3e0 | |||
| b3893699ae | |||
| 0023041b60 | |||
| a3e6c3c124 | |||
| 0be14bb564 | |||
| f88c1e7dcb | |||
| f58eafdab5 | |||
| 74c03ad8a0 | |||
| 135d31371b | |||
| 29a23e7dfa | |||
| 37bc43a90b | |||
| 71130ad3d4 | |||
| d8f865dcc4 | |||
| 82b39dc8fb | |||
| fb42b3e194 | |||
| 0e9d6210ef | |||
| 2763cf9a00 | |||
| fe264d59a4 | |||
| 68c4436d44 | |||
| 101aa85aa1 | |||
| 962f5886af | |||
| 1352a01555 | |||
| 2092931e7b | |||
| f7cee24e11 | |||
| 6c29f36d23 | |||
| 92aa692879 | |||
| b66d3bd2a9 | |||
| 7b781ce56d | |||
| cbdf6f296c | |||
| 895682acd0 | |||
| 415377c10f | |||
| d09da593eb | |||
| 6d6492b1f0 | |||
| c872ba3108 | |||
| 137da15d07 | |||
| e2b0819538 | |||
| ca2fa277d3 | |||
| 733fb5e8a2 | |||
| 802ed18ca4 | |||
| 26b76a25f1 | |||
| 1a537ff27c | |||
| 9cd3aa23a8 | |||
| 4f342ae935 | |||
| e5696eff33 | |||
| e6d012a9ae | |||
| 8c775ce550 | |||
| 6a4ea41f79 | |||
| 66bec3e8ab | |||
| cc48951911 | |||
| f72fada5cb | |||
| 81d5ca327a | |||
| af781d0079 | |||
| b416c2fbe1 | |||
| 501f80d465 | |||
| b25dc1b3c3 | |||
| 37d78edf96 | |||
| 8c3f7952dd | |||
| e601d02be6 | |||
| 19efe8ff3a | |||
| 6fd66f2695 | |||
| 786a94f35e | |||
| c23822d31b | |||
| 369b22af7b | |||
| ce3042977f | |||
| c082194bd4 | |||
| add167aefd | |||
| 168bf5e8ab | |||
| e977b5a63e | |||
| fb57ae14cd | |||
| 6cd8b820fb | |||
| 217c43f21c | |||
| ce80410c58 | |||
| 55ea2ea1d9 | |||
| ccc7b7471c | |||
| e0a606e2b7 | |||
| a6aedd2dfb | |||
| d8ac6de7bb | |||
| 4b6504b01e | |||
| 11a819d4d2 | |||
| 7c11bd3564 | |||
| 7ec7764e16 | |||
| 60227b13f0 | |||
| 67de561c2a | |||
| ad4c656209 | |||
| fe1ef6b99e | |||
| 3d3ed4d537 | |||
| 90c9f6ff3b | |||
| 9fe437b44a | |||
| 34d8707456 | |||
| 8f411c1d12 | |||
| 5e68db2e90 | |||
| 3bc1186993 | |||
| 6e141ac437 | |||
| 051f059e70 | |||
| ac5928a0bc | |||
| 8646947822 | |||
| 4f37c65f78 | |||
| fefbe21884 | |||
| e7e6065b36 | |||
| 3fea9c6f50 | |||
| 64a653aa59 | |||
| 45ab263e00 | |||
| 3715572d7c | |||
| 672bb186cd | |||
| f54b26d71f | |||
| 9fbbeea663 | |||
| 06d7cb4e06 | |||
| 1800f44731 | |||
| 8f4dfbe63f | |||
| de9f68d868 | |||
| 0b24ede354 | |||
| d222f92835 | |||
| 266a553f5d | |||
| 3774507d5f | |||
| fe8fd6125c | |||
| 979b8c0544 | |||
| a42a60b1ab | |||
| 330f6ecb56 | |||
| 2440ce6bdb | |||
| bdbe0bf7f9 | |||
| 463ce50112 | |||
| f50c16070f | |||
| ebb6c3f814 | |||
| b5b90755f5 | |||
| bc9c3477bf | |||
| 90a91201e8 | |||
| 59a63106a0 | |||
| c1ff9ac97b | |||
| cad5823cb8 | |||
| ff78317b63 | |||
| 524c3d5c15 | |||
| b8ccb9e9c3 | |||
| 4ce0026a55 | |||
| 2ea2f95b36 | |||
| daa46fb71f | |||
| 20da1d6161 | |||
| 80bb25dd2f | |||
| f4d14204e3 | |||
| cf351ce368 | |||
| 13b5b3a41a | |||
| 560213cbe9 | |||
| b42a06f505 | |||
| e6c552dffa | |||
| 8066a53a0b | |||
| 65cf49a1a1 | |||
| bf1fc42345 | |||
| 0875a59f33 | |||
| 44aeb64064 | |||
| cbe136ab09 | |||
| 3d9f578992 | |||
| c2f13be89b | |||
| ffd0fb693b | |||
| 00c246f530 | |||
| 170f5226ea |
+23
-1
@@ -1,11 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<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-parent</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-api</artifactId>
|
||||
|
||||
+23
-1
@@ -1,11 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<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-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
|
||||
package example;
|
||||
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class HelloWorldTest extends TestCase {
|
||||
public class HelloWorldTest extends StrutsTestCase {
|
||||
|
||||
public void testHelloWorld() throws Exception {
|
||||
HelloWorld hello_world = new HelloWorld();
|
||||
|
||||
+23
-1
@@ -1,11 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<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-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
|
||||
@@ -21,14 +21,20 @@
|
||||
|
||||
package mailreader2;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import java.io.*;
|
||||
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <p><code>ServletContextListener</code> that initializes and finalizes the
|
||||
@@ -94,7 +100,7 @@ public final class ApplicationListener implements ServletContextListener {
|
||||
/**
|
||||
* <p>Logging output for this plug in instance.</p>
|
||||
*/
|
||||
private Log log = LogFactory.getLog(this.getClass());
|
||||
private Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
package mailreader2;
|
||||
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
|
||||
@@ -21,18 +21,20 @@
|
||||
|
||||
package mailreader2;
|
||||
|
||||
import org.apache.struts2.interceptor.ApplicationAware;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException;
|
||||
import org.apache.struts.apps.mailreader.dao.Subscription;
|
||||
import org.apache.struts.apps.mailreader.dao.User;
|
||||
import org.apache.struts.apps.mailreader.dao.UserDatabase;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemorySubscription;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUser;
|
||||
import java.util.Map;
|
||||
import org.apache.struts2.interceptor.ApplicationAware;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <p> Base Action for MailreaderSupport application. </p>
|
||||
@@ -386,7 +388,7 @@ public class MailreaderSupport extends ActionSupport
|
||||
/**
|
||||
* <p><code>Log</code> instance for this application. </p>
|
||||
*/
|
||||
protected Log log = LogFactory.getLog(Constants.PACKAGE);
|
||||
protected Logger log = LoggerFactory.getLogger(Constants.PACKAGE);
|
||||
|
||||
/**
|
||||
* <p> Persist the User object, including subscriptions, to the database.
|
||||
|
||||
+20
-17
@@ -1,21 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2005-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
|
||||
@@ -25,7 +28,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
@@ -58,7 +61,7 @@
|
||||
<dependency>
|
||||
<groupId>com.hostedqa</groupId>
|
||||
<artifactId>hostedqa-remote-ant</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -121,7 +124,7 @@
|
||||
<dependency>
|
||||
<groupId>com.hostedqa</groupId>
|
||||
<artifactId>hostedqa-remote-ant</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
+92
-40
@@ -1,11 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<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-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
@@ -17,38 +39,38 @@
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/portlet/</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pluto</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- configure maven-war-plugin to use updated web.xml -->
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.pluto</groupId>
|
||||
<artifactId>maven-pluto-plugin</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>assemble</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pluto</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- configure maven-war-plugin to use updated web.xml -->
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.pluto</groupId>
|
||||
<artifactId>maven-pluto-plugin</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>assemble</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
@@ -87,14 +109,22 @@
|
||||
<artifactId>commons-digester</artifactId>
|
||||
<version>1.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.9</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
@@ -103,4 +133,26 @@
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>rat-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>src/main/etc/gridsphere/README-gridsphere.txt</exclude>
|
||||
<exclude>src/main/etc/gridsphere/struts-portlet</exclude>
|
||||
<exclude>src/main/etc/jetspeed2/README-jetspeed2.txt</exclude>
|
||||
<exclude>src/main/etc/jetspeed2/struts-portlet.psml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* $Id: FormExample.java 471756 2006-11-06 15:01:43Z husted $
|
||||
*
|
||||
* 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.portlet.example;
|
||||
|
||||
import org.apache.struts2.portlet.example.model.Name;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.ModelDriven;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FormExampleModelDriven extends ActionSupport implements ModelDriven<Name> {
|
||||
|
||||
private Name name = new Name();
|
||||
|
||||
public Name getModel() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
package org.apache.struts2.portlet.example.fileupload;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.struts2.dispatcher.DefaultActionSupport;
|
||||
|
||||
/**
|
||||
* File Upload example's action. <code>FileUploadAction</code>
|
||||
*
|
||||
*/
|
||||
public class FileUploadAction extends DefaultActionSupport {
|
||||
|
||||
private static final long serialVersionUID = 5156288255337069381L;
|
||||
|
||||
private String contentType;
|
||||
private File upload;
|
||||
private String fileName;
|
||||
private String caption;
|
||||
|
||||
// since we are using <s:file name="upload" .../> the file name will be
|
||||
// obtained through getter/setter of <file-tag-name>FileName
|
||||
public String getUploadFileName() {
|
||||
return fileName;
|
||||
}
|
||||
public void setUploadFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
|
||||
// since we are using <s:file name="upload" ... /> the content type will be
|
||||
// obtained through getter/setter of <file-tag-name>ContentType
|
||||
public String getUploadContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setUploadContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
|
||||
// since we are using <s:file name="upload" ... /> the File itself will be
|
||||
// obtained through getter/setter of <file-tag-name>
|
||||
public File getUpload() {
|
||||
return upload;
|
||||
}
|
||||
public void setUpload(File upload) {
|
||||
this.upload = upload;
|
||||
}
|
||||
|
||||
|
||||
public String getCaption() {
|
||||
return caption;
|
||||
}
|
||||
public void setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
public String upload() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.apache.struts2.portlet.example.model;
|
||||
|
||||
public class Name {
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="edit" extends="struts-portlet-default"
|
||||
namespace="/edit">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/index.jsp</result>
|
||||
</action>
|
||||
<action name="test"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/test.jsp</result>
|
||||
</action>
|
||||
<action name="formExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/edit/processFormExampleForward.action?firstName=${firstName}&lastName=${lastName}
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleForward"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/edit/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="editTest" extends="edit" namespace="/edit/dummy/test">
|
||||
<action name="testAction"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/namespaceTest.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="help" extends="struts-portlet-default"
|
||||
namespace="/help">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/help/index.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="view" extends="struts-portlet-default"
|
||||
namespace="/view">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/view/index.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="formExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="formExampleModelDriven"
|
||||
class="org.apache.struts2.portlet.example.FormExampleModelDriven">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputModelDriven.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="validationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processValidationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="fileUpload" class="org.apache.struts2.portlet.example.fileupload.FileUploadAction">
|
||||
<result name="input">
|
||||
/WEB-INF/view/fileUpload.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/fileUploadSuccess.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="tokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processTokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="invalid.token">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/tokenExample.jsp
|
||||
</result>
|
||||
<interceptor-ref name="portletDefaultStackWithToken" />
|
||||
</action>
|
||||
|
||||
<action name="springExample" class="springAction">
|
||||
<result name="success">
|
||||
/WEB-INF/view/springExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="freeMarkerExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result type="freemarker" name="input">
|
||||
/WEB-INF/view/freeMarkerExampleInput.ftl
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">/view/processFreeMarkerView.action?firstName=${firstName}&lastName=${lastName}</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerView" class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result type="freemarker" name="success">/WEB-INF/view/freeMarkerExample.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="velocityHelloWorld" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result type="velocity" name="success">/WEB-INF/view/helloWorld.vm</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
@@ -1 +0,0 @@
|
||||
struts.objectFactory = spring
|
||||
@@ -4,159 +4,7 @@
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<include file="struts-portlet-default.xml" />
|
||||
|
||||
<package name="view" extends="struts-portlet-default"
|
||||
namespace="/view">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/view/index.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="formExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="validationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processValidationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
<interceptor-ref name="validationWorkflowStack" />
|
||||
</action>
|
||||
|
||||
<action name="tokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processTokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="invalid.token">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/tokenExample.jsp
|
||||
</result>
|
||||
<interceptor-ref name="token" />
|
||||
<interceptor-ref name="defaultStack" />
|
||||
</action>
|
||||
|
||||
<action name="springExample" class="springAction">
|
||||
<result name="success">
|
||||
/WEB-INF/view/springExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="ajaxExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">
|
||||
/WEB-INF/view/ajaxExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="ajaxData"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/view/ajaxData.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="freeMarkerExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result type="freemarker" name="input">
|
||||
/WEB-INF/view/freeMarkerExampleInput.ftl
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">/view/processFreeMarkerView.action?firstName=${firstName}&lastName=${lastName}</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerView" class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result type="freemarker" name="success">/WEB-INF/view/freeMarkerExample.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="velocityHelloWorld" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result type="velocity" name="success">/WEB-INF/view/helloWorld.vm</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
<package name="edit" extends="struts-portlet-default"
|
||||
namespace="/edit">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/index.jsp</result>
|
||||
</action>
|
||||
<action name="test"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/test.jsp</result>
|
||||
</action>
|
||||
<action name="formExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/edit/processFormExampleForward.action?firstName=${firstName}&lastName=${lastName}
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleForward"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/edit/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="editTest" extends="edit" namespace="/edit/dummy/test">
|
||||
<action name="testAction"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/namespaceTest.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="help" extends="struts-portlet-default"
|
||||
namespace="/help">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/help/index.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
<include file="struts-view.xml"/>
|
||||
<include file="struts-edit.xml"/>
|
||||
<include file="struts-help.xml"/>
|
||||
</struts>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dwr PUBLIC
|
||||
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
|
||||
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
|
||||
<dwr>
|
||||
<allow>
|
||||
<create creator="new" javascript="validator">
|
||||
<param name="class" value="org.apache.struts2.validators.DWRValidator"/>
|
||||
</create>
|
||||
<convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/>
|
||||
</allow>
|
||||
|
||||
<signatures>
|
||||
<![CDATA[
|
||||
import java.util.Map;
|
||||
import org.apache.struts2.validators.DWRValidator;
|
||||
|
||||
DWRValidator.doPost(String, String, Map<String, String>);
|
||||
]]>
|
||||
</signatures>
|
||||
</dwr>
|
||||
@@ -1,118 +1,131 @@
|
||||
<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" id="struts-portlet">
|
||||
<portlet id="StrutsPortlet">
|
||||
<description xml:lang="EN">Struts Test Portlet</description>
|
||||
<portlet-name>StrutsPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet</display-name>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<portlet-app
|
||||
version="1.0"
|
||||
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
|
||||
id="struts-portlet">
|
||||
|
||||
<portlet id="StrutsPortlet">
|
||||
<description xml:lang="EN">Struts Test Portlet</description>
|
||||
<portlet-name>StrutsPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
|
||||
<init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the xwork config file -->
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The default action to invoke in view mode -->
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the xwork config file -->
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The default action to invoke in view mode -->
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the xwork config file -->
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The default action to invoke in view mode -->
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The edit mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in edit mode. -->
|
||||
<init-param>
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The help mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in help mode. -->
|
||||
<init-param>
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>view</portlet-mode>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet</title>
|
||||
<short-title>SP</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet</title>
|
||||
<short-title>SP</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
<portlet id="StrutsPortlet2">
|
||||
<description xml:lang="EN">Struts Test Portlet2</description>
|
||||
<portlet-name>StrutsPortlet2</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet2</display-name>
|
||||
<portlet id="StrutsPortlet2">
|
||||
<description xml:lang="EN">Struts Test Portlet2</description>
|
||||
<portlet-name>StrutsPortlet2</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet2</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
|
||||
<init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the xwork config file -->
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The default action to invoke in view mode -->
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the xwork config file -->
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The default action to invoke in view mode -->
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The view mode namespace. Maps to a namespace in the xwork config file -->
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<!-- The default action to invoke in view mode -->
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</value>
|
||||
</init-param>
|
||||
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
<!-- The edit mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
<!-- The default action to invoke in edit mode. -->
|
||||
<init-param>
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet2</title>
|
||||
<short-title>SP2</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
<!-- The help mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in help mode. -->
|
||||
<init-param>
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet2</title>
|
||||
<short-title>SP2</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
</portlet-app>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<H2>Hello from Ajax!</H2>
|
||||
@@ -1 +0,0 @@
|
||||
This data is fetched via Ajax! The server time is <%= new java.util.Date() %>
|
||||
@@ -1,48 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<s:head theme="ajax"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
|
||||
<b>This is a tabbed pane with two panels that fetches data from a remote action via ajax</b>
|
||||
|
||||
<s:tabbedPanel id="test2" theme="simple" >
|
||||
<s:div id="left" label="left" theme="ajax">
|
||||
This is the left pane<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2" />
|
||||
</s:form>
|
||||
</s:div>
|
||||
<s:div href="<s:url action="ajaxData"/>" id="ryh1" theme="ajax" label="remote one" />
|
||||
<s:div id="middle" label="middle" theme="ajax">
|
||||
middle tab<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text44" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text442" />
|
||||
</s:form>
|
||||
</s:div>
|
||||
<s:div href="<s:url action="ajaxData"/>" id="ryh21" theme="ajax" label="remote right" />
|
||||
</s:tabbedPanel>
|
||||
|
||||
<p/>
|
||||
A DIV that waits for 5 seconds before loading the contents
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="<s:url action="ajaxData"/>"
|
||||
delay="5000"
|
||||
loadingText="loading...">
|
||||
Waiting for data</s:div>
|
||||
<p/>
|
||||
A DIV that is updated every 2 seconds
|
||||
<s:div
|
||||
id="twoseconds"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="<s:url action="ajaxData"/>"
|
||||
theme="ajax"
|
||||
delay="2000"
|
||||
updateFreq="2000"
|
||||
errorText="There was an error"
|
||||
loadingText="loading...">Initial Content
|
||||
</s:div>
|
||||
<p/>
|
||||
<a href="<s:url action="index"/>">Back to front page</a>
|
||||
@@ -0,0 +1,13 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<h1>Fileupload sample</h1>
|
||||
|
||||
<s:actionerror />
|
||||
<s:fielderror />
|
||||
<s:form action="fileUpload" method="POST" enctype="multipart/form-data">
|
||||
<s:file name="upload" label="File"/>
|
||||
<s:textfield name="caption" label="Caption"/>
|
||||
<s:submit />
|
||||
</s:form>
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<h1>Fileupload sample</h1>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li>ContentType: <s:property value="uploadContentType" /></li>
|
||||
<li>FileName: <s:property value="uploadFileName" /></li>
|
||||
<li>File: <s:property value="upload" /></li>
|
||||
<li>Caption:<s:property value="caption" /></li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<H2>Input your name</H2>
|
||||
<s:form action="formExampleModelDriven" method="POST">
|
||||
<s:textfield label="First name" name="firstName" value="%{firstName}"/>
|
||||
<s:textfield label="Last name" name="lastName" value="%{lastName}"/>
|
||||
<s:submit value="Submit the form"/>
|
||||
</s:form>
|
||||
@@ -4,10 +4,11 @@
|
||||
Here you'll find examples of what is possible with the Struts Portlet integration framework.
|
||||
<ul>
|
||||
<li><a href="<s:url action="formExample"/>">A simple form</a></li>
|
||||
<li><a href="<s:url action="formExampleModelDriven" method="input"/>">Model driven example</li>
|
||||
<li><a href="<s:url action="validationExample"/>">Validation</a></li>
|
||||
<li><a href="<s:url action="tokenExample"/>">Token</a></li>
|
||||
<li><a href="<s:url action="springExample"/>">Spring integration</a></li>
|
||||
<li><a href="<s:url action="ajaxExample"/>">Ajax</a></li>
|
||||
<li><a href="<s:url action="fileUpload" method="input"/>">File upload</li>
|
||||
<li><a href="<s:url action="freeMarkerExample"/>">FreeMarker</a></li>
|
||||
<li><a href="<s:url action="velocityHelloWorld"/>">Velocity</a></li>
|
||||
<li><a href="<s:url action="index" portletMode="edit"/>">Go to edit mode and see what's there</a></li>
|
||||
|
||||
@@ -4,46 +4,30 @@
|
||||
<!-- Uncomment/comment this if you need/don't need Spring support -->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/applicationContext*.xml</param-value>
|
||||
<param-value>
|
||||
/WEB-INF/applicationContext*.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<filter id="filterdispatcher">
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.FilterDispatcher
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>action2</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
<filter id="filterdispatcher">
|
||||
<filter-name>Struts2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Struts2</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.apache.struts2.portlet.context.ServletContextHolderListener
|
||||
</listener-class>
|
||||
<listener-class> org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<servlet id="preparator">
|
||||
<servlet-name>preparator</servlet-name>
|
||||
<servlet-class>
|
||||
org.apache.struts2.portlet.context.PreparatorServlet
|
||||
</servlet-class>
|
||||
</servlet>
|
||||
<servlet id="dwr">
|
||||
<servlet-name>dwr</servlet-name>
|
||||
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>dwr</servlet-name>
|
||||
<url-pattern>/dwr/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Uncomment to use the dispatcher servlet -->
|
||||
<!--<servlet id="Struts2PortletDispatcherServlet">
|
||||
<servlet-name>Struts2PortletDispatcherServlet</servlet-name>
|
||||
<servlet-class>org.apache.struts2.portlet.dispatcher.DispatcherServlet</servlet-class>
|
||||
</servlet>-->
|
||||
|
||||
</web-app>
|
||||
|
||||
+23
-1
@@ -1,11 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<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-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
|
||||
+20
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* $Id: pom.xml 559206 2007-07-24 21:01:18Z apetrelli $
|
||||
*
|
||||
* 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.showcase;
|
||||
|
||||
import org.apache.struts2.showcase.ajax.tree.Category;
|
||||
|
||||
+20
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* $Id: pom.xml 559206 2007-07-24 21:01:18Z apetrelli $
|
||||
*
|
||||
* 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.showcase.ajax;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
+4
-4
@@ -21,20 +21,20 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.dispatcher.SessionMap;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class ChatAuthenticationInterceptor implements Interceptor {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatAuthenticationInterceptor.class);
|
||||
|
||||
public static final String USER_SESSION_KEY = "chatUserSessionKey";
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ChatAuthenticationInterceptor implements Interceptor {
|
||||
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
|
||||
_log.debug("Authenticating chat user");
|
||||
LOG.debug("Authenticating chat user");
|
||||
|
||||
SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
|
||||
User user = (User) session.get(USER_SESSION_KEY);
|
||||
|
||||
@@ -22,20 +22,19 @@ package org.apache.struts2.showcase.chat;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Authenticate showcase chat example, make sure everyone have a username.
|
||||
*/
|
||||
public class ChatInterceptor implements Interceptor {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(ChatInterceptor.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatInterceptor.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -51,7 +50,7 @@ public class ChatInterceptor implements Interceptor {
|
||||
HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
|
||||
User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
|
||||
if (chatUser == null) {
|
||||
_log.debug("Chat user not logged in");
|
||||
LOG.debug("Chat user not logged in");
|
||||
return Action.LOGIN;
|
||||
}
|
||||
return invocation.invoke();
|
||||
|
||||
+5
-4
@@ -24,14 +24,15 @@ import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
import javax.servlet.http.HttpSessionListener;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class ChatSessionListener implements HttpSessionListener {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(ChatSessionListener.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatSessionListener.class);
|
||||
|
||||
public void sessionCreated(HttpSessionEvent event) {
|
||||
}
|
||||
@@ -45,7 +46,7 @@ public class ChatSessionListener implements HttpSessionListener {
|
||||
ChatService service = (ChatService) context.getBean("chatService");
|
||||
service.logout(user.getName());
|
||||
|
||||
_log.info("session expired, logged user ["+user.getName()+"] out");
|
||||
LOG.info("session expired, logged user ["+user.getName()+"] out");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,14 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.util.StrutsTypeConverter;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class DateConverter extends StrutsTypeConverter {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(DateConverter.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DateConverter.class);
|
||||
|
||||
public Object convertFromString(Map context, String[] values, Class toClass) {
|
||||
|
||||
@@ -41,7 +42,7 @@ public class DateConverter extends StrutsTypeConverter {
|
||||
return sdf.parse(values[0]);
|
||||
}
|
||||
catch(ParseException e) {
|
||||
_log.error("error converting value ["+values[0]+"] to Date ", e);
|
||||
LOG.error("error converting value ["+values[0]+"] to Date ", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.struts2.views.freemarker.FreemarkerManager;
|
||||
import org.apache.struts2.views.freemarker.ScopesHashModel;
|
||||
|
||||
import com.opensymphony.xwork2.util.OgnlValueStack;
|
||||
import com.opensymphony.xwork2.ognl.OgnlValueStack;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,6 +72,10 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
}
|
||||
}
|
||||
pageLines = read(in, -1);
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (className != null && className.trim().length() > 0) {
|
||||
@@ -81,6 +85,10 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
in = servletContext.getResourceAsStream("/WEB-INF/src"+className);
|
||||
}
|
||||
classLines = read(in, -1);
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
String rootPath = ServletActionContext.getServletContext().getRealPath("/");
|
||||
|
||||
@@ -2,4 +2,5 @@ Apache Struts
|
||||
Copyright 2000-2007 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
Nifty Corners (http://www.html.it/articoli/nifty/index.html).
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
</action>
|
||||
<action name="quizAjax" class="org.apache.struts2.showcase.validation.QuizAction">
|
||||
<interceptor-ref name="jsonValidationWorkflowStack"/>
|
||||
<result name="input">/validation/quiz-ajax.jsp</result>
|
||||
<result>/validation/quiz-success.jsp</result>
|
||||
</action>
|
||||
<action name="getNodes" class="org.apache.struts2.showcase.ShowAjaxDynamicTreeAction">
|
||||
|
||||
@@ -7,39 +7,39 @@
|
||||
<struts>
|
||||
<package name="integration" extends="struts1-default" namespace="/integration">
|
||||
|
||||
<interceptors>
|
||||
<interceptor name="gangsterForm" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
|
||||
<param name="className">org.apache.struts2.showcase.integration.GangsterForm</param>
|
||||
<param name="name">gangsterForm</param>
|
||||
</interceptor>
|
||||
<interceptor name="gangsterValidation" class="org.apache.struts2.s1.ActionFormValidationInterceptor">
|
||||
<param name="pathnames">/org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml</param>
|
||||
</interceptor>
|
||||
<interceptors>
|
||||
<interceptor name="gangsterForm" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
|
||||
<param name="className">org.apache.struts2.showcase.integration.GangsterForm</param>
|
||||
<param name="name">gangsterForm</param>
|
||||
</interceptor>
|
||||
<interceptor name="gangsterValidation" class="org.apache.struts2.s1.ActionFormValidationInterceptor">
|
||||
<param name="pathnames">/org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml</param>
|
||||
</interceptor>
|
||||
|
||||
<interceptor-stack name="integration">
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="gangsterForm"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="actionForm-reset"/>
|
||||
<interceptor-ref name="basicStack"/>
|
||||
<interceptor-ref name="gangsterValidation"/>
|
||||
<interceptor-ref name="workflow"/>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
<interceptor-stack name="integration">
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="gangsterForm"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="actionForm-reset"/>
|
||||
<interceptor-ref name="basicStack"/>
|
||||
<interceptor-ref name="gangsterValidation"/>
|
||||
<interceptor-ref name="workflow"/>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="integration" />
|
||||
<default-action-ref name="editGangster" />
|
||||
<default-interceptor-ref name="integration"/>
|
||||
<default-action-ref name="editGangster"/>
|
||||
|
||||
<!-- Diplay entry page that uses Model-Driven technique -->
|
||||
<!-- Display entry page that uses Model-Driven technique -->
|
||||
<action name="editGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.EditGangsterAction</param>
|
||||
<param name="className">org.apache.struts2.showcase.integration.EditGangsterAction</param>
|
||||
<result>modelDriven.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Display the result page whose content is populated using the Model-Driven technique -->
|
||||
<action name="saveGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.SaveGangsterAction</param>
|
||||
<param name="validate">true</param>
|
||||
<param name="className">org.apache.struts2.showcase.integration.SaveGangsterAction</param>
|
||||
<param name="validate">true</param>
|
||||
<result name="input">modelDriven.jsp</result>
|
||||
<result>modelDrivenResult.jsp</result>
|
||||
</action>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<constant name="struts.devMode" value="true" />
|
||||
<constant name="struts.configuration.xml.reload" value="false" />
|
||||
<constant name="struts.custom.i18n.resources" value="globalMessages" />
|
||||
<constant name="struts.action.extension" value="action,," />
|
||||
|
||||
<constant name="struts.codebehind.defaultPackage" value="person" />
|
||||
<constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" />
|
||||
@@ -66,6 +67,8 @@
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<default-action-ref name="showcase" />
|
||||
|
||||
<action name="showcase">
|
||||
<result>showcase.jsp</result>
|
||||
</action>
|
||||
|
||||
@@ -62,7 +62,8 @@ Using a JSON list returned from an action (href="/JSONList.action"), without aut
|
||||
|
||||
Reload on type (loadOnTextChange="true"), after 3 characters (loadMinimumCount="3", it is "3" by default), without the down arrow button (showDownArrow="false")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
<sx:autocompleter
|
||||
id="auto2"
|
||||
indicator="indicator"
|
||||
href="%{jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<p>
|
||||
1. Attach to "onclick" event on button. Update content of Div 1. Use with indicator.
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<sx:bind id="ex1" href="%{#ajaxTest}" sources="button" targets="div1" events="onclick" indicator="indicator" />
|
||||
<sx:bind href="%{#ajaxTest}" sources="button" targets="div1" events="onclick" indicator="indicator" />
|
||||
<br/>
|
||||
<s:submit theme="simple" type="submit" value="submit" id="button"/>
|
||||
</p>
|
||||
|
||||
@@ -38,7 +38,7 @@ A submit button, that highlights (blue color) its targets
|
||||
|
||||
A submit button, with an indicator
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<sx:submit type="submit" value="submit" targets="t1" href="%{ajaxTest}" indicator="indicator"/>
|
||||
<sx:submit id="submit2" type="submit" value="submit" targets="t1" href="%{ajaxTest}" indicator="indicator"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
@@ -48,9 +48,9 @@ A submit button, with "notifyTopics"
|
||||
<br/><br/>
|
||||
|
||||
Use an image as submit
|
||||
|
||||
<s:url value="/images/struts-power.gif" var="imgUrl" />
|
||||
<sx:submit type="image" label="Alt Text" targets="t1"
|
||||
src="${pageContext.request.contextPath}/images/struts-power.gif" href="%{ajaxTest}" />
|
||||
src="%{imgUrl}" href="%{ajaxTest}" />
|
||||
<br/><br/>
|
||||
|
||||
<label for="textInput">Text to be echoed</label>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
<body>
|
||||
<sx:div
|
||||
id="once"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}">
|
||||
Initial Content</sx:div>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url var="test3" value="/Test3.action" />
|
||||
|
||||
<sx:a id="link0"
|
||||
<sx:a
|
||||
href="%{#ajaxTest}"
|
||||
targets="t1"
|
||||
highlightColor="red"
|
||||
|
||||
@@ -11,18 +11,15 @@
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div id="left" label="test1" >
|
||||
I'm a Tab!!!
|
||||
</sx:div >
|
||||
<sx:div id="middle" label="test2" >
|
||||
I'm the other Tab!!!
|
||||
</sx:div >
|
||||
|
||||
</sx:tabbedpanel>
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div label="test1" >
|
||||
I'm a Tab!!!
|
||||
</sx:div >
|
||||
<sx:div id="middle" label="test2" >
|
||||
I'm the other Tab!!!
|
||||
</sx:div >
|
||||
</sx:tabbedpanel>
|
||||
|
||||
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -19,16 +20,16 @@ NOTES:
|
||||
|
||||
Default Editor configuration:<br/>
|
||||
<s:form id="form1" action="AjaxRemoteForm" method="post">
|
||||
<s:textarea name="data" theme="ajax" cols="50" rows="10" value="Test Data 1" />
|
||||
<sx:textarea name="data" cols="50" rows="10" value="Test Data 1" />
|
||||
<s:submit value="Submit"/>
|
||||
</s:form>
|
||||
<br/>
|
||||
|
||||
Configured Editor configuration:<br/>
|
||||
Configured Editor configuration:<br/>
|
||||
<s:form id="form2" action="AjaxRemoteForm" method="post">
|
||||
<s:textarea id="editor2" name="data" theme="ajax" cols="50" rows="10" value="Test Data 2">
|
||||
<sx:textarea id="editor2" name="data" cols="50" rows="10" value="Test Data 2">
|
||||
<s:param name="editorControls">textGroup;|;justifyGroup;|;listGroup;|;indentGroup</s:param>
|
||||
</s:textarea>
|
||||
</sx:textarea>
|
||||
<s:submit value="Submit"/>
|
||||
</s:form>
|
||||
<br/>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<ul>
|
||||
<li><a href="<s:url value="/showcase.jsp"/>">Home</a></li>
|
||||
<li><a href="<s:url value="/interactive/index.jsp" />">Interactive demo of OGNL and JSP tags</a></li>
|
||||
<li><a href="<s:url value="/ajax/index.jsp" />">Ajax pugin for Struts</a></li>
|
||||
<li><a href="<s:url value="/ajax/index.jsp" />">Ajax plugin for Struts</a></li>
|
||||
<li><a href="<s:url value="/chat/index.jsp"/>">Ajax Chat</a>
|
||||
<li><a href="<s:url action="actionChain1!input" namespace="/actionchaining" includeParams="none" />">Action Chaining</a></li>
|
||||
<li><a href="<s:url action="index" namespace="/config-browser" includeParams="none" />">Config Browser</a></li>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<body>
|
||||
<table>
|
||||
<sx:datetimepicker label="toggleType='wipe'" value="%{'2006-10-31'}" toggleType="wipe" toggleDuration="300" name="test"/>
|
||||
<sx:datetimepicker label="toggleType='explode'" value="%{'2006-07-22'}" toggleType="explode" toggleDuration="500"/>
|
||||
<sx:datetimepicker label="toggleType='explode'" value="%{'2006-07-22'}" toggleType="explode" toggleDuration="500" id="dp2"/>
|
||||
<sx:datetimepicker label="toggleType='fade'" value="%{'2006-06-30'}" toggleType="fade" toggleDuration="500"/>
|
||||
<sx:datetimepicker label="With value='today'" name="dddp1" value="%{'today'}" />
|
||||
<sx:datetimepicker label="US format, empty" name="dddp2" language="en-us" />
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
dojo.event.topic.subscribe("treeSelected", function treeNodeSelected(node) {
|
||||
dojo.io.bind({
|
||||
url: "<s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action'/>&nodeId="+node.node.widgetId,
|
||||
url: "<s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action'/>?nodeId="+node.node.widgetId,
|
||||
load: function(type, data, evt) {
|
||||
var divDisplay = dojo.byId("displayId");
|
||||
divDisplay.innerHTML=data;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Showcase - UI Tag Example - Tree Example (Static)</title>
|
||||
<sx:head />
|
||||
<sx:head/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
dojo.event.topic.subscribe("treeSelected", function treeNodeSelected(node) {
|
||||
dojo.io.bind({
|
||||
url: "<s:url value='/tags/ui/ajax/staticTreeSelectAction.action'/>&nodeId="+node.node.title,
|
||||
url: "<s:url value='/tags/ui/ajax/staticTreeSelectAction.action'/>?nodeId="+node.node.title,
|
||||
load: function(type, data, evt) {
|
||||
var divDisplay = dojo.byId("displayIt");
|
||||
divDisplay.innerHTML=data;
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
|
||||
<div style="float:left; margin-right: 50px;">
|
||||
<sx:tree label="parent" id="parentId" templateCssPath="/struts/tree.css"
|
||||
<sx:tree label="parent" templateCssPath="/struts/tree.css"
|
||||
showRootGrid="true" showGrid="true" treeSelectedTopic="treeSelected">
|
||||
<sx:treenode label="child1" id="child1Id">
|
||||
<sx:treenode label="child1" >
|
||||
<sx:treenode label="grandchild1" id="grandchild1Id"/>
|
||||
<sx:treenode label="grandchild2" id="grandchild2Id"/>
|
||||
<sx:treenode label="grandchild3" id="grandchild3Id"/>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Validation -Ajax</title>
|
||||
<sx:head cache="true" compressed="false"/>
|
||||
<title>Validation - Ajax</title>
|
||||
<sx:head cache="false" compressed="false"/>
|
||||
</head>
|
||||
|
||||
<s:url var="url" namespace="/validation" action="quizAjax"/>
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
|
||||
<scm>
|
||||
@@ -383,7 +383,7 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-10-SNAPSHOT</version>
|
||||
<version>1.0-alpha-10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+48
-15
@@ -1,11 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
-->
|
||||
<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-parent</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
@@ -22,7 +44,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.0-alpha-1-SNAPSHOT</version>
|
||||
<version>2.0-alpha-4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-xwork</id>
|
||||
@@ -33,9 +55,9 @@
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>opensymphony</groupId>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
<classifier>sources</classifier>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
@@ -48,7 +70,7 @@
|
||||
<groupId>org.apache.myfaces.tobago</groupId>
|
||||
<artifactId>maven-apt-plugin</artifactId>
|
||||
<configuration>
|
||||
<A>uri=/struts-tags,tlibVersion=2.2.3,jspVersion=1.2,shortName=s,displayName="Struts Tags",
|
||||
<A>uri=/struts-tags,tlibVersion=2.2.3,jspVersion=2.0,shortName=s,displayName="Struts Tags",
|
||||
outFile=${basedir}/target/classes/META-INF/struts-tags.tld,
|
||||
description="To make it easier to access dynamic data;
|
||||
the Apache Struts framework includes a library of custom tags.
|
||||
@@ -107,6 +129,23 @@
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>rat-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>src/test/resources/org/apache/struts2/views/jsp/ui/*</exclude>
|
||||
<exclude>src/main/resources/org/apache/struts2/static/domTT.js</exclude>
|
||||
<exclude>src/test/resources/org/apache/struts2/interceptor/validation/*</exclude>
|
||||
<exclude>src/site/resources/tags/**</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
@@ -250,9 +289,9 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>opensymphony</groupId>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>-->
|
||||
@@ -287,12 +326,6 @@
|
||||
<version>2.6.11</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Ajax -->
|
||||
<dependency>
|
||||
<groupId>uk.ltd.getahead</groupId>
|
||||
@@ -426,7 +459,7 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock</artifactId>
|
||||
<version>1.0.1</version>
|
||||
@@ -446,7 +479,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts-annotations</artifactId>
|
||||
<version>1.0.2-SNAPSHOT</version>
|
||||
<version>1.0.2</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -37,12 +37,20 @@ public class RequestUtils {
|
||||
*/
|
||||
public static String getServletPath(HttpServletRequest request) {
|
||||
String servletPath = request.getServletPath();
|
||||
|
||||
|
||||
String requestUri = request.getRequestURI();
|
||||
// Detecting other characters that the servlet container cut off (like anything after ';')
|
||||
if (requestUri != null && servletPath != null && !requestUri.endsWith(servletPath)) {
|
||||
int pos = requestUri.indexOf(servletPath);
|
||||
if (pos > -1) {
|
||||
servletPath = requestUri.substring(requestUri.indexOf(servletPath));
|
||||
}
|
||||
}
|
||||
|
||||
if (null != servletPath && !"".equals(servletPath)) {
|
||||
return servletPath;
|
||||
}
|
||||
|
||||
String requestUri = request.getRequestURI();
|
||||
|
||||
int startIndex = request.getContextPath().equals("") ? 0 : request.getContextPath().length();
|
||||
int endIndex = request.getPathInfo() == null ? requestUri.length() : requestUri.lastIndexOf(request.getPathInfo());
|
||||
|
||||
|
||||
@@ -161,5 +161,23 @@ public final class StrutsConstants {
|
||||
|
||||
/** The name of the parameter to create when mapping an id (used by some action mappers) */
|
||||
public static final String STRUTS_ID_PARAMETER_NAME = "struts.mapper.idParameterName";
|
||||
|
||||
/** The name of the parameter to determine whether static method access will be allowed in OGNL expressions or not */
|
||||
public static final String STRUTS_ALLOW_STATIC_METHOD_ACCESS = "struts.ognl.allowStaticMethodAccess";
|
||||
|
||||
/** The com.opensymphony.xwork2.validator.ActionValidatorManager implementation class */
|
||||
public static final String STRUTS_ACTIONVALIDATORMANAGER = "struts.actionValidatorManager";
|
||||
|
||||
/** The {@link com.opensymphony.xwork2.util.ValueStackFactory} implementation class */
|
||||
public static final String STRUTS_VALUESTACKFACTORY = "struts.valueStackFactory";
|
||||
|
||||
/** The {@link com.opensymphony.xwork2.reflection.ReflectionProvider} implementation class */
|
||||
public static final String STRUTS_REFLECTIONPROVIDER = "struts.reflectionProvider";
|
||||
|
||||
/** The {@link com.opensymphony.xwork2.reflection.ReflectionContextFactory} implementation class */
|
||||
public static final String STRUTS_REFLECTIONCONTEXTFACTORY = "struts.reflectionContextFactory";
|
||||
|
||||
/** The {@link com.opensymphony.xwork2.util.PatternMatcher} implementation class */
|
||||
public static final String STRUTS_PATTERNMATCHER = "struts.patternMatcher";
|
||||
|
||||
}
|
||||
|
||||
@@ -20,18 +20,57 @@
|
||||
*/
|
||||
package org.apache.struts2;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.util.StrutsTestCaseHelper;
|
||||
|
||||
import com.opensymphony.xwork2.XWorkTestCase;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import com.opensymphony.xwork2.util.logging.jdk.JdkLoggerFactory;
|
||||
|
||||
/**
|
||||
* Base test case for JUnit testing Struts.
|
||||
*/
|
||||
public abstract class StrutsTestCase extends XWorkTestCase {
|
||||
|
||||
static {
|
||||
ConsoleHandler handler = new ConsoleHandler();
|
||||
final SimpleDateFormat df = new SimpleDateFormat("mm:ss.SSS");
|
||||
Formatter formatter = new Formatter() {
|
||||
@Override
|
||||
public String format(LogRecord record) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(record.getLevel());
|
||||
sb.append(':');
|
||||
for (int x=9-record.getLevel().toString().length(); x>0; x--) {
|
||||
sb.append(' ');
|
||||
}
|
||||
sb.append('[');
|
||||
sb.append(df.format(new Date(record.getMillis())));
|
||||
sb.append("] ");
|
||||
sb.append(formatMessage(record));
|
||||
sb.append('\n');
|
||||
return sb.toString();
|
||||
}
|
||||
};
|
||||
handler.setFormatter(formatter);
|
||||
Logger logger = Logger.getLogger("");
|
||||
if (logger.getHandlers().length > 0)
|
||||
logger.removeHandler(logger.getHandlers ()[0]);
|
||||
logger.addHandler(handler);
|
||||
logger.setLevel(Level.WARNING);
|
||||
LoggerFactory.setLoggerFactory(new JdkLoggerFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the configuration settings, XWork configuration, and
|
||||
* message resources
|
||||
|
||||
@@ -23,6 +23,7 @@ package org.apache.struts2.components;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
@@ -30,14 +31,12 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.RequestMap;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.jsp.TagUtils;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
@@ -46,6 +45,8 @@ import com.opensymphony.xwork2.ActionProxyFactory;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -59,8 +60,8 @@ import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
* <li>id (String) - the id (if specified) to put the action under stack's context.
|
||||
* <li>name* (String) - name of the action to be executed (without the extension suffix eg. .action)</li>
|
||||
* <li>namespace (String) - default to the namespace where this action tag is invoked</li>
|
||||
* <li>executeResult (Boolean) - default is false. Decides wheather the result of this action is to be executed or not</li>
|
||||
* <li>ignoreContextParams (Boolean) - default to false. Decides wheather the request parameters are to be included when the action is invoked</li>
|
||||
* <li>executeResult (Boolean) - default is false. Decides whether the result of this action is to be executed or not</li>
|
||||
* <li>ignoreContextParams (Boolean) - default to false. Decides whether the request parameters are to be included when the action is invoked</li>
|
||||
* </ul>
|
||||
* <!-- END SNIPPET: params -->
|
||||
*
|
||||
@@ -115,11 +116,12 @@ import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
*/
|
||||
@StrutsTag(name="action", tldTagClass="org.apache.struts2.views.jsp.ActionTag", description="Execute an action from within a view")
|
||||
public class ActionComponent extends ContextBean {
|
||||
private static final Log LOG = LogFactory.getLog(ActionComponent.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ActionComponent.class);
|
||||
|
||||
protected HttpServletResponse res;
|
||||
protected HttpServletRequest req;
|
||||
|
||||
protected ValueStackFactory valueStackFactory;
|
||||
protected ActionProxyFactory actionProxyFactory;
|
||||
protected ActionProxy proxy;
|
||||
protected String name;
|
||||
@@ -141,6 +143,11 @@ public class ActionComponent extends ContextBean {
|
||||
public void setActionProxyFactory(ActionProxyFactory actionProxyFactory) {
|
||||
this.actionProxyFactory = actionProxyFactory;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setValueStackFactory(ValueStackFactory valueStackFactory) {
|
||||
this.valueStackFactory = valueStackFactory;
|
||||
}
|
||||
|
||||
public boolean end(Writer writer, String body) {
|
||||
boolean end = super.end(writer, "", false);
|
||||
@@ -164,18 +171,8 @@ public class ActionComponent extends ContextBean {
|
||||
return end;
|
||||
}
|
||||
|
||||
private Map createExtraContext() {
|
||||
Map parentParams = null;
|
||||
|
||||
if (!ignoreContextParams) {
|
||||
parentParams = new ActionContext(getStack().getContext()).getParameters();
|
||||
}
|
||||
|
||||
Map newParams = (parentParams != null) ? new HashMap(parentParams) : new HashMap();
|
||||
|
||||
if (parameters != null) {
|
||||
newParams.putAll(parameters);
|
||||
}
|
||||
protected Map createExtraContext() {
|
||||
Map newParams = createParametersForContext();
|
||||
|
||||
ActionContext ctx = new ActionContext(stack.getContext());
|
||||
ServletContext servletContext = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT);
|
||||
@@ -192,7 +189,7 @@ public class ActionComponent extends ContextBean {
|
||||
res,
|
||||
servletContext);
|
||||
|
||||
ValueStack newStack = ValueStackFactory.getFactory().createValueStack(stack);
|
||||
ValueStack newStack = valueStackFactory.createValueStack(stack);
|
||||
extraContext.put(ActionContext.VALUE_STACK, newStack);
|
||||
|
||||
// add page context, such that ServletDispatcherResult will do an include
|
||||
@@ -201,6 +198,40 @@ public class ActionComponent extends ContextBean {
|
||||
return extraContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates parameters map using parameters from the value stack and component parameters. Any non-String array
|
||||
* values will be converted into a single-value String array.
|
||||
*
|
||||
* @return A map of String[] parameters
|
||||
*/
|
||||
protected Map<String,String[]> createParametersForContext() {
|
||||
Map parentParams = null;
|
||||
|
||||
if (!ignoreContextParams) {
|
||||
parentParams = new ActionContext(getStack().getContext()).getParameters();
|
||||
}
|
||||
|
||||
Map<String,String[]> newParams = (parentParams != null)
|
||||
? new HashMap<String,String[]>(parentParams)
|
||||
: new HashMap<String,String[]>();
|
||||
|
||||
if (parameters != null) {
|
||||
Map<String,String[]> params = new HashMap<String,String[]>();
|
||||
for (Iterator i = parameters.entrySet().iterator(); i.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry) i.next();
|
||||
String key = (String) entry.getKey();
|
||||
Object val = entry.getValue();
|
||||
if (val.getClass().isArray() && String.class == val.getClass().getComponentType()) {
|
||||
params.put(key, (String[])val);
|
||||
} else {
|
||||
params.put(key, new String[]{val.toString()});
|
||||
}
|
||||
}
|
||||
newParams.putAll(params);
|
||||
}
|
||||
return newParams;
|
||||
}
|
||||
|
||||
public ActionProxy getProxy() {
|
||||
return proxy;
|
||||
}
|
||||
@@ -247,9 +278,7 @@ public class ActionComponent extends ContextBean {
|
||||
try {
|
||||
|
||||
proxy = actionProxyFactory.createActionProxy(namespace, actionName, createExtraContext(), executeResult, true);
|
||||
if (null != methodName) {
|
||||
proxy.setMethod(methodName);
|
||||
}
|
||||
proxy.setMethod(methodName);
|
||||
// set the new stack into the request for the taglib to use
|
||||
req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack());
|
||||
proxy.execute();
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <!-- START SNIPPET: example -->
|
||||
*
|
||||
* <s:actionerror />
|
||||
* <s:form .... >>
|
||||
* <s:form .... >
|
||||
* ....
|
||||
* </s:form>
|
||||
*
|
||||
|
||||
@@ -46,7 +46,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="a", tldTagClass="org.apache.struts2.views.jsp.ui.AnchorTag", description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets")
|
||||
@StrutsTag(
|
||||
name="a",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.AnchorTag",
|
||||
description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets",
|
||||
allowDynamicAttributes=true)
|
||||
public class Anchor extends ClosingUIBean {
|
||||
public static final String OPEN_TEMPLATE = "a";
|
||||
public static final String TEMPLATE = "a-close";
|
||||
|
||||
@@ -25,15 +25,15 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.components.Param.UnnamedParametric;
|
||||
import org.apache.struts2.util.AppendIteratorFilter;
|
||||
import org.apache.struts2.util.MakeIterator;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -118,7 +118,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
@StrutsTag(name="append", tldTagClass="org.apache.struts2.views.jsp.iterator.AppendIteratorTag", description="Append the values of a list of iterators to one iterator")
|
||||
public class AppendIterator extends ContextBean implements UnnamedParametric {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(AppendIterator.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AppendIterator.class);
|
||||
|
||||
private AppendIteratorFilter appendIteratorFilter= null;
|
||||
private List _parameters;
|
||||
@@ -140,7 +140,7 @@ public class AppendIterator extends ContextBean implements UnnamedParametric {
|
||||
|
||||
Object iteratorEntryObj = paramEntries.next();
|
||||
if (! MakeIterator.isIterable(iteratorEntryObj)) {
|
||||
_log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
continue;
|
||||
}
|
||||
appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));
|
||||
|
||||
@@ -22,16 +22,16 @@ package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.util.OgnlUtil;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -96,11 +96,12 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
@StrutsTag(name="bean", tldTagClass="org.apache.struts2.views.jsp.BeanTag",
|
||||
description="Instantiate a JavaBean and place it in the context")
|
||||
public class Bean extends ContextBean {
|
||||
protected static Log log = LogFactory.getLog(Bean.class);
|
||||
protected static Logger LOG = LoggerFactory.getLogger(Bean.class);
|
||||
|
||||
protected Object bean;
|
||||
protected String name;
|
||||
protected ObjectFactory objectFactory;
|
||||
protected ReflectionProvider reflectionProvider;
|
||||
|
||||
public Bean(ValueStack stack) {
|
||||
super(stack);
|
||||
@@ -110,6 +111,11 @@ public class Bean extends ContextBean {
|
||||
public void setObjectFactory(ObjectFactory objectFactory) {
|
||||
this.objectFactory = objectFactory;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setReflectionProvider(ReflectionProvider prov) {
|
||||
this.reflectionProvider = prov;
|
||||
}
|
||||
|
||||
public boolean start(Writer writer) {
|
||||
boolean result = super.start(writer);
|
||||
@@ -120,7 +126,7 @@ public class Bean extends ContextBean {
|
||||
String beanName = findString(name, "name", "Bean name is required. Example: com.acme.FooBean");
|
||||
bean = objectFactory.buildBean(ClassLoaderUtil.loadClass(beanName, getClass()), stack.getContext());
|
||||
} catch (Exception e) {
|
||||
log.error("Could not instantiate bean", e);
|
||||
LOG.error("Could not instantiate bean", e);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -142,7 +148,7 @@ public class Bean extends ContextBean {
|
||||
}
|
||||
|
||||
public void addParameter(String key, Object value) {
|
||||
OgnlUtil.setProperty(key, value, bean, getStack().getContext());
|
||||
reflectionProvider.setProperty(key, value, bean, getStack().getContext());
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="The class name of the bean to be instantiated (must respect JavaBean specification)",
|
||||
|
||||
@@ -50,7 +50,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="checkbox", tldTagClass="org.apache.struts2.views.jsp.ui.CheckboxTag", description="Render a checkbox input field")
|
||||
@StrutsTag(
|
||||
name="checkbox",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.CheckboxTag",
|
||||
description="Render a checkbox input field",
|
||||
allowDynamicAttributes=true)
|
||||
public class Checkbox extends UIBean {
|
||||
final public static String TEMPLATE = "checkbox";
|
||||
|
||||
|
||||
@@ -25,17 +25,17 @@ import java.io.Writer;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* ClosingUIBean is the standard superclass for UI components such as div etc.
|
||||
*/
|
||||
public abstract class ClosingUIBean extends UIBean {
|
||||
private static final Log LOG = LogFactory.getLog(ClosingUIBean.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ClosingUIBean.class);
|
||||
|
||||
protected ClosingUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.Stack;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
@@ -69,7 +68,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the name of this component.
|
||||
* Gets the name of this component.
|
||||
* @return the name of this component.
|
||||
*/
|
||||
private String getComponentName() {
|
||||
@@ -86,7 +85,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the OGNL value stack assoicated with this component.
|
||||
* Gets the OGNL value stack assoicated with this component.
|
||||
* @return the OGNL value stack assoicated with this component.
|
||||
*/
|
||||
public ValueStack getStack() {
|
||||
@@ -94,7 +93,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the component stack of this component.
|
||||
* Gets the component stack of this component.
|
||||
* @return the component stack of this component, never <tt>null</tt>.
|
||||
*/
|
||||
public Stack getComponentStack() {
|
||||
@@ -214,7 +213,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs?a <code>RuntimeException</code> based on the given information.
|
||||
* Constructs a <code>RuntimeException</code> based on the given information.
|
||||
* <p/>
|
||||
* A message is constructed and logged at ERROR level before being returned
|
||||
* as a <code>RuntimeException</code>.
|
||||
@@ -333,16 +332,20 @@ public class Component {
|
||||
* @param scheme http or https
|
||||
* @param includeContext should the context path be included or not
|
||||
* @param encodeResult should the url be encoded
|
||||
* @param forceAddSchemeHostAndPort should the scheme host and port be forced
|
||||
* @param escapeAmp should ampersand (&) be escaped to &
|
||||
* @return the action url.
|
||||
*/
|
||||
protected String determineActionURL(String action, String namespace, String method,
|
||||
HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme,
|
||||
boolean includeContext, boolean encodeResult) {
|
||||
boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort,
|
||||
boolean escapeAmp) {
|
||||
String finalAction = findString(action);
|
||||
String finalMethod = method != null ? findString(method) : method;
|
||||
String finalNamespace = determineNamespace(namespace, getStack(), req);
|
||||
ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, method, parameters);
|
||||
ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, finalMethod, parameters);
|
||||
String uri = actionMapper.getUriFromActionMapping(mapping);
|
||||
return UrlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult);
|
||||
return UrlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,7 +409,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the parameters.
|
||||
* Gets the parameters.
|
||||
* @return the parameters. Is never <tt>null</tt>.
|
||||
*/
|
||||
public Map getParameters() {
|
||||
@@ -414,7 +417,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add's all the given parameters to this componenets own parameters.
|
||||
* Adds all the given parameters to this component's own parameters.
|
||||
* @param params the parameters to add.
|
||||
*/
|
||||
public void addAllParameters(Map params) {
|
||||
@@ -422,9 +425,9 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add's the given key and value to this components own parameter.
|
||||
* Adds the given key and value to this component's own parameter.
|
||||
* <p/>
|
||||
* If the provided key is <tt>null</tt> nothing happends.
|
||||
* If the provided key is <tt>null</tt> nothing happens.
|
||||
* If the provided value is <tt>null</tt> any existing parameter with
|
||||
* the given key name is removed.
|
||||
* @param key the key of the new parameter to add.
|
||||
@@ -449,5 +452,4 @@ public class Component {
|
||||
public boolean usesBody() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,14 +29,14 @@ import java.util.Calendar;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -142,7 +142,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
@StrutsTag(name="date", tldBodyContent="empty", tldTagClass="org.apache.struts2.views.jsp.DateTag", description="Render a formatted date.")
|
||||
public class Date extends ContextBean {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(Date.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Date.class);
|
||||
/**
|
||||
* Property name to fall back when no format is specified
|
||||
*/
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
*/
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.OgnlUtil;
|
||||
import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -38,11 +39,20 @@ import org.apache.struts2.StrutsException;
|
||||
description="Prints debugging information")
|
||||
public class Debug extends UIBean {
|
||||
public static final String TEMPLATE = "debug";
|
||||
|
||||
protected ReflectionProvider reflectionProvider;
|
||||
|
||||
|
||||
|
||||
public Debug(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setReflectionProvider(ReflectionProvider prov) {
|
||||
this.reflectionProvider = prov;
|
||||
}
|
||||
|
||||
protected String getDefaultTemplate() {
|
||||
return TEMPLATE;
|
||||
}
|
||||
@@ -57,7 +67,7 @@ public class Debug extends UIBean {
|
||||
Object o = iter.next();
|
||||
Map values;
|
||||
try {
|
||||
values = OgnlUtil.getBeanMap(o);
|
||||
values = reflectionProvider.getBeanMap(o);
|
||||
} catch (Exception e) {
|
||||
throw new StrutsException("Caught an exception while getting the property values of " + o, e);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="div", tldTagClass="org.apache.struts2.views.jsp.ui.DivTag", description="Render HTML div providing content from remote call via AJAX")
|
||||
@StrutsTag(
|
||||
name="div",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.DivTag",
|
||||
description="Render an HTML div",
|
||||
allowDynamicAttributes=true)
|
||||
public class Div extends ClosingUIBean {
|
||||
|
||||
public static final String TEMPLATE = "div";
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.Writer;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <s:param>field1</s:param>
|
||||
* <s:param>field2</s:param>
|
||||
* </s:fielderror>
|
||||
* <s:form .... >>
|
||||
* <s:form .... >
|
||||
* ....
|
||||
* </s:form>
|
||||
*
|
||||
@@ -61,7 +61,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <s:param value="%{'field1'}" />
|
||||
* <s:param value="%{'field2'}" />
|
||||
* </s:fielderror>
|
||||
* <s:form .... >>
|
||||
* <s:form .... >
|
||||
* ....
|
||||
* </s:form>
|
||||
*
|
||||
|
||||
@@ -23,12 +23,12 @@ package org.apache.struts2.components;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -45,9 +45,13 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="file", tldTagClass="org.apache.struts2.views.jsp.ui.FileTag", description="Render a file input field")
|
||||
@StrutsTag(
|
||||
name="file",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.FileTag",
|
||||
description="Render a file input field",
|
||||
allowDynamicAttributes=true)
|
||||
public class File extends UIBean {
|
||||
private final static Log log = LogFactory.getLog(File.class);
|
||||
private final static Logger LOG = LoggerFactory.getLogger(File.class);
|
||||
|
||||
final public static String TEMPLATE = "file";
|
||||
|
||||
@@ -70,13 +74,13 @@ public class File extends UIBean {
|
||||
String encType = (String) form.getParameters().get("enctype");
|
||||
if (!"multipart/form-data".equals(encType)) {
|
||||
// uh oh, this isn't good! Let's warn the developer
|
||||
log.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
|
||||
}
|
||||
|
||||
String method = (String) form.getParameters().get("method");
|
||||
if (!"post".equalsIgnoreCase(method)) {
|
||||
// uh oh, this isn't good! Let's warn the developer
|
||||
log.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
|
||||
LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,26 +20,6 @@
|
||||
*/
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
//import org.apache.struts2.portlet.context.PortletActionContext;
|
||||
//import org.apache.struts2.portlet.util.PortletUrlHelper;
|
||||
import org.apache.struts2.views.util.UrlHelper;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.config.Configuration;
|
||||
import com.opensymphony.xwork2.config.RuntimeConfiguration;
|
||||
@@ -48,11 +28,18 @@ import com.opensymphony.xwork2.config.entities.InterceptorMapping;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.TextUtils;
|
||||
import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory;
|
||||
import com.opensymphony.xwork2.validator.ActionValidatorManager;
|
||||
import com.opensymphony.xwork2.validator.FieldValidator;
|
||||
import com.opensymphony.xwork2.validator.ValidationInterceptor;
|
||||
import com.opensymphony.xwork2.validator.Validator;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -93,7 +80,11 @@ import com.opensymphony.xwork2.validator.Validator;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="form", tldTagClass="org.apache.struts2.views.jsp.ui.FormTag", description="Renders an input form")
|
||||
@StrutsTag(
|
||||
name="form",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.FormTag",
|
||||
description="Renders an input form",
|
||||
allowDynamicAttributes=true)
|
||||
public class Form extends ClosingUIBean {
|
||||
public static final String OPEN_TEMPLATE = "form";
|
||||
public static final String TEMPLATE = "form-close";
|
||||
@@ -116,6 +107,7 @@ public class Form extends ClosingUIBean {
|
||||
protected Configuration configuration;
|
||||
protected ObjectFactory objectFactory;
|
||||
protected UrlRenderer urlRenderer;
|
||||
protected ActionValidatorManager actionValidatorManager;
|
||||
|
||||
public Form(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -152,6 +144,11 @@ public class Form extends ClosingUIBean {
|
||||
public void setUrlRenderer(UrlRenderer urlRenderer) {
|
||||
this.urlRenderer = urlRenderer;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setActionValidatorManager(ActionValidatorManager mgr) {
|
||||
this.actionValidatorManager = mgr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -222,32 +219,26 @@ public class Form extends ClosingUIBean {
|
||||
* </ol>
|
||||
*/
|
||||
protected void populateComponentHtmlId(Form form) {
|
||||
boolean isAjax = "ajax".equalsIgnoreCase(this.theme);
|
||||
|
||||
String action = null;
|
||||
if (this.action != null) {
|
||||
// if it isn't specified, we'll make somethig up
|
||||
action = findString(this.action);
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
addParameter("id", escape(id));
|
||||
}
|
||||
|
||||
// if no id given, it will be tried to generate it from the action attribute
|
||||
// by the urlRenderer implementation
|
||||
urlRenderer.renderFormUrl(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isAjax
|
||||
* @param namespace
|
||||
* @param action
|
||||
* Evaluate client side JavaScript Enablement.
|
||||
* @param actionName the actioName to check for
|
||||
* @param namespace the namespace to check for
|
||||
* @param actionMethod the method to ckeck for
|
||||
*/
|
||||
|
||||
|
||||
protected void evaluateClientSideJsEnablement(String actionName, String namespace, String actionMethod) {
|
||||
|
||||
// Only evaluate if Client-Side js is to be enable when validate=true
|
||||
Boolean validate = (Boolean) getParameters().get("validate");
|
||||
if (validate != null && validate.booleanValue()) {
|
||||
if (validate != null && validate) {
|
||||
|
||||
addParameter("performValidation", Boolean.FALSE);
|
||||
|
||||
@@ -255,9 +246,8 @@ public class Form extends ClosingUIBean {
|
||||
ActionConfig actionConfig = runtimeConfiguration.getActionConfig(namespace, actionName);
|
||||
|
||||
if (actionConfig != null) {
|
||||
List interceptors = actionConfig.getInterceptors();
|
||||
for (Iterator i = interceptors.iterator(); i.hasNext();) {
|
||||
InterceptorMapping interceptorMapping = (InterceptorMapping) i.next();
|
||||
List<InterceptorMapping> interceptors = actionConfig.getInterceptors();
|
||||
for (InterceptorMapping interceptorMapping : interceptors) {
|
||||
if (ValidationInterceptor.class.isInstance(interceptorMapping.getInterceptor())) {
|
||||
ValidationInterceptor validationInterceptor = (ValidationInterceptor) interceptorMapping.getInterceptor();
|
||||
|
||||
@@ -280,10 +270,9 @@ public class Form extends ClosingUIBean {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
List all = ActionValidatorManagerFactory.getInstance().getValidators(actionClass, (String) getParameters().get("actionName"));
|
||||
List validators = new ArrayList();
|
||||
for (Iterator iterator = all.iterator(); iterator.hasNext();) {
|
||||
Validator validator = (Validator) iterator.next();
|
||||
List<Validator> all = actionValidatorManager.getValidators(actionClass, (String) getParameters().get("actionName"));
|
||||
List<Validator> validators = new ArrayList<Validator>();
|
||||
for (Validator validator : all) {
|
||||
if (validator instanceof FieldValidator) {
|
||||
FieldValidator fieldValidator = (FieldValidator) validator;
|
||||
if (fieldValidator.getFieldName().equals(name)) {
|
||||
@@ -311,7 +300,7 @@ public class Form extends ClosingUIBean {
|
||||
this.onsubmit = onsubmit;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Set action nane to submit to, without .action suffix", defaultValue="current action")
|
||||
@StrutsTagAttribute(description="Set action name to submit to, without .action suffix", defaultValue="current action")
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
@@ -342,7 +331,7 @@ public class Form extends ClosingUIBean {
|
||||
this.validate = validate;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="he portlet mode to display after the form submit")
|
||||
@StrutsTagAttribute(description="The portlet mode to display after the form submit")
|
||||
public void setPortletMode(String portletMode) {
|
||||
this.portletMode = portletMode;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
|
||||
@@ -49,7 +49,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="hidden", tldTagClass="org.apache.struts2.views.jsp.ui.HiddenTag", description="Render a hidden input field")
|
||||
@StrutsTag(
|
||||
name="hidden",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.HiddenTag",
|
||||
description="Render a hidden input field",
|
||||
allowDynamicAttributes=true)
|
||||
public class Hidden extends UIBean {
|
||||
final public static String TEMPLATE = "hidden";
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.dispatcher.Dispatcher;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.LocaleProvider;
|
||||
import com.opensymphony.xwork2.TextProviderFactory;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.LocalizedTextUtil;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
@@ -86,10 +86,16 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
public class I18n extends Component {
|
||||
protected boolean pushed;
|
||||
protected String name;
|
||||
protected Container container;
|
||||
|
||||
public I18n(ValueStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setContainer(Container container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public boolean start(Writer writer) {
|
||||
boolean result = super.start(writer);
|
||||
@@ -105,7 +111,7 @@ public class I18n extends Component {
|
||||
if (bundle != null) {
|
||||
final Locale locale = (Locale) getStack().getContext().get(ActionContext.LOCALE);
|
||||
TextProviderFactory tpf = new TextProviderFactory();
|
||||
Dispatcher.getInstance().getContainer().inject(tpf);
|
||||
container.inject(tpf);
|
||||
getStack().push(tpf.createInstance(bundle, new LocaleProvider() {
|
||||
public Locale getLocale() {
|
||||
return locale;
|
||||
@@ -129,7 +135,7 @@ public class I18n extends Component {
|
||||
return super.end(writer, body);
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Name of ressource bundle to use (eg foo/bar/customBundle)", required=true, defaultValue="String")
|
||||
@StrutsTagAttribute(description="Name of resource bundle to use (eg foo/bar/customBundle)", required=true, defaultValue="String")
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.Writer;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
|
||||
@@ -40,17 +40,16 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
import org.apache.struts2.RequestUtils;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.util.FastByteArrayOutputStream;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -98,7 +97,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
"(result of servlet or a JSP page)")
|
||||
public class Include extends Component {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(Include.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Include.class);
|
||||
|
||||
private static String encoding;
|
||||
private static boolean encodingDefined = true;
|
||||
@@ -115,7 +114,7 @@ public class Include extends Component {
|
||||
}
|
||||
|
||||
@Inject(StrutsConstants.STRUTS_I18N_ENCODING)
|
||||
public static void setDefaultEncoding(String encoding) {
|
||||
public void setDefaultEncoding(String encoding) {
|
||||
defaultEncoding = encoding;
|
||||
}
|
||||
|
||||
@@ -148,7 +147,7 @@ public class Include extends Component {
|
||||
try {
|
||||
urlBuf.append(URLEncoder.encode(values.get(i).toString(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
_log.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
|
||||
LOG.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
|
||||
}
|
||||
|
||||
concat = "&";
|
||||
@@ -162,7 +161,7 @@ public class Include extends Component {
|
||||
try {
|
||||
include(result, writer, req, res);
|
||||
} catch (Exception e) {
|
||||
LogFactory.getLog(getClass()).warn("Exception thrown during include of " + result, e);
|
||||
LOG.warn("Exception thrown during include of " + result, e);
|
||||
}
|
||||
|
||||
return super.end(writer, body);
|
||||
|
||||
@@ -20,16 +20,18 @@
|
||||
*/
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -72,7 +74,7 @@ import java.util.LinkedHashMap;
|
||||
@StrutsTag(name="inputtransferselect", tldTagClass="org.apache.struts2.views.jsp.ui.InputTransferSelectTag", description="Renders an input form")
|
||||
public class InputTransferSelect extends ListUIBean {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(InputTransferSelect.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(InputTransferSelect.class);
|
||||
|
||||
private static final String TEMPLATE = "inputtransferselect";
|
||||
|
||||
@@ -198,7 +200,7 @@ public class InputTransferSelect extends ListUIBean {
|
||||
|
||||
}
|
||||
else {
|
||||
_log.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
|
||||
LOG.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* </p> The next example iterates over a an action collection and passes every iterator value to another action. The
|
||||
* trick here lies in the use of the '[0]' operator. It takes the current iterator value and passes it on to the edit
|
||||
* action. Using the '[0]' operator has the same effect as using >s:property />. (The latter, however, does not
|
||||
* action. Using the '[0]' operator has the same effect as using <s:property />. (The latter, however, does not
|
||||
* work from inside the param tag). </p>
|
||||
*
|
||||
* <!-- END SNIPPET: example4description -->
|
||||
|
||||
@@ -53,8 +53,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="label", tldTagClass="org.apache.struts2.views.jsp.ui.LabelTag", description="Render a label that displays" +
|
||||
" read-only information")
|
||||
@StrutsTag(
|
||||
name="label",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.LabelTag",
|
||||
description="Render a label that displays read-only information",
|
||||
allowDynamicAttributes=true)
|
||||
public class Label extends UIBean {
|
||||
final public static String TEMPLATE = "label";
|
||||
|
||||
|
||||
@@ -25,15 +25,15 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.components.Param.UnnamedParametric;
|
||||
import org.apache.struts2.util.MakeIterator;
|
||||
import org.apache.struts2.util.MergeIteratorFilter;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -132,7 +132,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
"of a list of iterators into one iterator")
|
||||
public class MergeIterator extends ContextBean implements UnnamedParametric {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(MergeIterator.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MergeIterator.class);
|
||||
|
||||
private MergeIteratorFilter mergeIteratorFilter = null;
|
||||
private List _parameters;
|
||||
@@ -154,7 +154,7 @@ public class MergeIterator extends ContextBean implements UnnamedParametric {
|
||||
for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) {
|
||||
Object iteratorEntryObj = parametersIterator.next();
|
||||
if (! MakeIterator.isIterable(iteratorEntryObj)) {
|
||||
_log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
|
||||
continue;
|
||||
}
|
||||
mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));
|
||||
|
||||
@@ -27,15 +27,14 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -71,12 +70,16 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="optgroup", tldTagClass="org.apache.struts2.views.jsp.ui.OptGroupTag", description="Renders a Select Tag's OptGroup Tag")
|
||||
@StrutsTag(
|
||||
name="optgroup",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.OptGroupTag",
|
||||
description="Renders a Select Tag's OptGroup Tag",
|
||||
allowDynamicAttributes=true)
|
||||
public class OptGroup extends Component {
|
||||
|
||||
public static final String INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY = "optGroupInternalListUiBeanList";
|
||||
|
||||
private static Log _log = LogFactory.getLog(OptGroup.class);
|
||||
private static Logger LOG = LoggerFactory.getLogger(OptGroup.class);
|
||||
|
||||
protected HttpServletRequest req;
|
||||
protected HttpServletResponse res;
|
||||
@@ -102,7 +105,7 @@ public class OptGroup extends Component {
|
||||
public boolean end(Writer writer, String body) {
|
||||
Select select = (Select) findAncestor(Select.class);
|
||||
if (select == null) {
|
||||
_log.error("incorrect use of OptGroup component, this component must be used within a Select component",
|
||||
LOG.error("incorrect use of OptGroup component, this component must be used within a Select component",
|
||||
new IllegalStateException("incorrect use of OptGroup component, this component must be used within a Select component"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -95,7 +95,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
@StrutsTag(name="optiontransferselect", tldTagClass="org.apache.struts2.views.jsp.ui.OptionTransferSelectTag", description="Renders an input form")
|
||||
public class OptionTransferSelect extends DoubleListUIBean {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(OptionTransferSelect.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OptionTransferSelect.class);
|
||||
|
||||
private static final String TEMPLATE = "optiontransferselect";
|
||||
|
||||
@@ -331,7 +331,7 @@ public class OptionTransferSelect extends DoubleListUIBean {
|
||||
|
||||
}
|
||||
else {
|
||||
_log.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work");
|
||||
LOG.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.Writer;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
import org.apache.struts2.StrutsException;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
@@ -46,7 +46,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="password", tldTagClass="org.apache.struts2.views.jsp.ui.PasswordTag", description="Render an HTML input tag of type password")
|
||||
@StrutsTag(
|
||||
name="password",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.PasswordTag",
|
||||
description="Render an HTML input tag of type password",
|
||||
allowDynamicAttributes=true)
|
||||
public class Password extends TextField {
|
||||
final public static String TEMPLATE = "password";
|
||||
|
||||
|
||||
@@ -23,14 +23,13 @@ package org.apache.struts2.components;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.TextUtils;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -90,7 +89,7 @@ import com.opensymphony.xwork2.util.TextUtils;
|
||||
@StrutsTag(name="property", tldBodyContent="empty", tldTagClass="org.apache.struts2.views.jsp.PropertyTag",
|
||||
description="Print out expression which evaluates against the stack")
|
||||
public class Property extends Component {
|
||||
private static final Log LOG = LogFactory.getLog(Property.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Property.class);
|
||||
|
||||
public Property(ValueStack stack) {
|
||||
super(stack);
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.Writer;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
|
||||
@@ -56,7 +56,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="reset", tldTagClass="org.apache.struts2.views.jsp.ui.ResetTag", description="Render a reset button")
|
||||
@StrutsTag(
|
||||
name="reset",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.ResetTag",
|
||||
description="Render a reset button",
|
||||
allowDynamicAttributes=true)
|
||||
public class Reset extends FormButton {
|
||||
final public static String TEMPLATE = "reset";
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* multiple="true"
|
||||
* size="3"
|
||||
* required="true"
|
||||
* value="%{petDao.pets.{id}}"
|
||||
* />
|
||||
*
|
||||
* <s:select label="Months"
|
||||
@@ -77,7 +78,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <!-- END SNIPPET: exnote -->
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="select", tldTagClass="org.apache.struts2.views.jsp.ui.SelectTag", description="Render a select element")
|
||||
@StrutsTag(
|
||||
name="select",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.SelectTag",
|
||||
description="Render a select element",
|
||||
allowDynamicAttributes=true)
|
||||
public class Select extends ListUIBean {
|
||||
final public static String TEMPLATE = "select";
|
||||
|
||||
@@ -132,8 +137,8 @@ public class Select extends ListUIBean {
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description=" Creates a multiple select. The tag will pre-select multiple values" +
|
||||
" if the values are passed as an Array (of appropriate types) via the value attribute. Passing " +
|
||||
"a Collection may work too? Haven't tested this.", type="Boolean", defaultValue="false")
|
||||
" if the values are passed as an Array or a Collection(of appropriate types) via the value attribute. If one of the keys equals" +
|
||||
" one of the values in the Collection or Array it wil be selected", type="Boolean", defaultValue="false")
|
||||
public void setMultiple(String multiple) {
|
||||
this.multiple = multiple;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -10,12 +30,19 @@ import org.apache.struts2.views.util.UrlHelper;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link UrlRenderer} interface that creates URLs suitable in a servlet environment.
|
||||
*
|
||||
*/
|
||||
public class ServletUrlRenderer implements UrlRenderer {
|
||||
/**
|
||||
* Provide a logging instance.
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServletUrlRenderer.class);
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
@@ -29,7 +56,7 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
|
||||
String result;
|
||||
if (urlComponent.value == null && urlComponent.action != null) {
|
||||
result = urlComponent.determineActionURL(urlComponent.action, urlComponent.namespace, urlComponent.method, urlComponent.req, urlComponent.res, urlComponent.parameters, scheme, urlComponent.includeContext, urlComponent.encode);
|
||||
result = urlComponent.determineActionURL(urlComponent.action, urlComponent.namespace, urlComponent.method, urlComponent.req, urlComponent.res, urlComponent.parameters, scheme, urlComponent.includeContext, urlComponent.encode, urlComponent.forceAddSchemeHostAndPort, urlComponent.escapeAmp);
|
||||
} else {
|
||||
String _value = urlComponent.value;
|
||||
|
||||
@@ -38,7 +65,7 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
if (_value != null && _value.indexOf("?") > 0) {
|
||||
_value = _value.substring(0, _value.indexOf("?"));
|
||||
}
|
||||
result = UrlHelper.buildUrl(_value, urlComponent.req, urlComponent.res, urlComponent.parameters, scheme, urlComponent.includeContext, urlComponent.encode);
|
||||
result = UrlHelper.buildUrl(_value, urlComponent.req, urlComponent.res, urlComponent.parameters, scheme, urlComponent.includeContext, urlComponent.encode, urlComponent.forceAddSchemeHostAndPort, urlComponent.escapeAmp);
|
||||
}
|
||||
if ( urlComponent.anchor != null && urlComponent.anchor.length() > 0 ) {
|
||||
result += '#' + urlComponent.anchor;
|
||||
@@ -66,13 +93,11 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
public void renderFormUrl(Form formComponent) {
|
||||
String namespace = formComponent.determineNamespace(formComponent.namespace, formComponent.getStack(),
|
||||
formComponent.request);
|
||||
String action = null;
|
||||
String action;
|
||||
|
||||
if(formComponent.action != null) {
|
||||
action = formComponent.findString(formComponent.action);
|
||||
}
|
||||
|
||||
if (formComponent.action == null) {
|
||||
} else {
|
||||
// no action supplied? ok, then default to the current request
|
||||
// (action or general URL)
|
||||
ActionInvocation ai = (ActionInvocation) formComponent.getStack().getContext().get(
|
||||
@@ -127,15 +152,19 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
}
|
||||
|
||||
// if the id isn't specified, use the action name
|
||||
if (formComponent.getId() == null) {
|
||||
formComponent.addParameter("id", action);
|
||||
if (formComponent.getId() == null && action!=null ) {
|
||||
formComponent.addParameter("id", formComponent.escape(action));
|
||||
}
|
||||
} else if (action != null) {
|
||||
// Since we can't find an action alias in the configuration, we just
|
||||
// assume
|
||||
// the action attribute supplied is the path to be used as the uri
|
||||
// this
|
||||
// form is submitting to.
|
||||
// assume the action attribute supplied is the path to be used as
|
||||
// the URI this form is submitting to.
|
||||
|
||||
// Warn user that the specified namespace/action combo
|
||||
// was not found in the configuration.
|
||||
if (namespace != null) {
|
||||
LOG.warn("No configuration found for the specified action: '" + action + "' in namespace: '" + namespace + "'. Form action defaulting to 'action' attribute's literal value.");
|
||||
}
|
||||
|
||||
String result = UrlHelper.buildUrl(action, formComponent.request, formComponent.response, null);
|
||||
formComponent.addParameter("action", result);
|
||||
@@ -165,9 +194,7 @@ public class ServletUrlRenderer implements UrlRenderer {
|
||||
|
||||
// WW-1284
|
||||
// evaluate if client-side js is to be enabled. (if validation
|
||||
// interceptor
|
||||
// does allow validation eg. method is not filtered out)
|
||||
// interceptor does allow validation eg. method is not filtered out)
|
||||
formComponent.evaluateClientSideJsEnablement(actionName, namespace, actionMethod);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.io.Writer;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -45,10 +45,14 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*/
|
||||
@StrutsTag(name="submit", tldTagClass="org.apache.struts2.views.jsp.ui.SubmitTag", description="Render a submit button")
|
||||
@StrutsTag(
|
||||
name="submit",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.SubmitTag",
|
||||
description="Render a submit button",
|
||||
allowDynamicAttributes=true)
|
||||
public class Submit extends FormButton {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(Submit.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Submit.class);
|
||||
final public static String TEMPLATE = "submit";
|
||||
protected String src;
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.util.TextUtils;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -113,9 +113,13 @@ import com.opensymphony.xwork2.TextProvider;
|
||||
* @see Param
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="text", tldTagClass="org.apache.struts2.views.jsp.TextTag", description="Render a I18n text message")
|
||||
@StrutsTag(
|
||||
name="text",
|
||||
tldTagClass="org.apache.struts2.views.jsp.TextTag",
|
||||
description="Render a I18n text message",
|
||||
allowDynamicAttributes=true)
|
||||
public class Text extends ContextBean implements Param.UnnamedParametric {
|
||||
private static final Log LOG = LogFactory.getLog(Text.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Text.class);
|
||||
|
||||
protected List values = Collections.EMPTY_LIST;
|
||||
protected String actualName;
|
||||
|
||||
@@ -44,7 +44,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* @see TabbedPanel
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="textarea", tldTagClass="org.apache.struts2.views.jsp.ui.TextareaTag", description="Render HTML textarea tag.")
|
||||
@StrutsTag(
|
||||
name="textarea",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.TextareaTag",
|
||||
description="Render HTML textarea tag.",
|
||||
allowDynamicAttributes=true)
|
||||
public class TextArea extends UIBean {
|
||||
final public static String TEMPLATE = "textarea";
|
||||
|
||||
|
||||
@@ -51,7 +51,11 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </pre>
|
||||
|
||||
*/
|
||||
@StrutsTag(name="textfield", tldTagClass="org.apache.struts2.views.jsp.ui.TextFieldTag", description="Render an HTML input field of type text")
|
||||
@StrutsTag(
|
||||
name="textfield",
|
||||
tldTagClass="org.apache.struts2.views.jsp.ui.TextFieldTag",
|
||||
description="Render an HTML input field of type text",
|
||||
allowDynamicAttributes=true)
|
||||
public class TextField extends UIBean {
|
||||
/**
|
||||
* The name of the default template for the TextFieldTag
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -29,19 +30,19 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.StrutsConstants;
|
||||
import org.apache.struts2.components.template.Template;
|
||||
import org.apache.struts2.components.template.TemplateEngine;
|
||||
import org.apache.struts2.components.template.TemplateEngineManager;
|
||||
import org.apache.struts2.components.template.TemplateRenderingContext;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import org.apache.struts2.views.util.ContextUtil;
|
||||
|
||||
import com.opensymphony.xwork2.config.ConfigurationException;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* UIBean is the standard superclass of all Struts UI componentns.
|
||||
@@ -310,7 +311,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: tooltipdescription -->
|
||||
* <b>tooltipConfig is deprecated, use individual tooltip configuration attributes instead </>
|
||||
* <b>tooltipConfig is deprecated, use individual tooltip configuration attributes instead </b>
|
||||
*
|
||||
* Every Form UI component (in xhtml / css_xhtml or any other that extends them) can
|
||||
* have tooltips assigned to them. The Form component's tooltip related attribute, once
|
||||
@@ -400,7 +401,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
*/
|
||||
public abstract class UIBean extends Component {
|
||||
private static final Log LOG = LogFactory.getLog(UIBean.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UIBean.class);
|
||||
|
||||
protected HttpServletRequest request;
|
||||
protected HttpServletResponse response;
|
||||
@@ -465,6 +466,9 @@ public abstract class UIBean extends Component {
|
||||
protected String tooltipDelay;
|
||||
protected String tooltipCssClass;
|
||||
protected String tooltipIconPath;
|
||||
|
||||
// dynamic attributes
|
||||
protected Map<String,Object> dynamicAttributes = new HashMap<String,Object>();
|
||||
|
||||
protected String defaultTemplateDir;
|
||||
protected String defaultUITheme;
|
||||
@@ -760,9 +764,6 @@ public abstract class UIBean extends Component {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// tooltip & tooltipConfig
|
||||
if (tooltipConfig != null) {
|
||||
addParameter("tooltipConfig", findValue(tooltipConfig));
|
||||
@@ -821,8 +822,10 @@ public abstract class UIBean extends Component {
|
||||
|
||||
|
||||
}
|
||||
evaluateExtraParams();
|
||||
|
||||
addParameter("dynamicAttributes", dynamicAttributes);
|
||||
|
||||
evaluateExtraParams();
|
||||
}
|
||||
|
||||
protected String escape(String name) {
|
||||
@@ -902,7 +905,8 @@ public abstract class UIBean extends Component {
|
||||
|
||||
/**
|
||||
* Create HTML id element for the component and populate this component parmaeter
|
||||
* map.
|
||||
* map. Additionally, a parameter named escapedId is populated which contains the found id value filtered by
|
||||
* {@link #escape(String)}, needed eg. for naming Javascript identifiers based on the id value.
|
||||
*
|
||||
* The order is as follows :-
|
||||
* <ol>
|
||||
@@ -914,21 +918,24 @@ public abstract class UIBean extends Component {
|
||||
* @param form
|
||||
*/
|
||||
protected void populateComponentHtmlId(Form form) {
|
||||
String tryId;
|
||||
if (id != null) {
|
||||
// this check is needed for backwards compatibility with 2.1.x
|
||||
if (altSyntax()) {
|
||||
addParameter("id", findString(id));
|
||||
tryId = findString(id);
|
||||
} else {
|
||||
addParameter("id", id);
|
||||
tryId = id;
|
||||
}
|
||||
} else if (form != null) {
|
||||
addParameter("id", form.getParameters().get("id") + "_"
|
||||
+ escape(name != null ? findString(name) : null));
|
||||
tryId = form.getParameters().get("id") + "_"
|
||||
+ escape(name != null ? findString(name) : null);
|
||||
} else {
|
||||
addParameter("id", escape(name != null ? findString(name) : null));
|
||||
tryId = escape(name != null ? findString(name) : null);
|
||||
}
|
||||
addParameter("id", tryId);
|
||||
addParameter("escapedId", escape(tryId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get's the id for referencing element.
|
||||
* @return the id for referencing element.
|
||||
@@ -968,7 +975,7 @@ public abstract class UIBean extends Component {
|
||||
this.cssClass = cssClass;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="The css style definitions for element ro use")
|
||||
@StrutsTagAttribute(description="The css style definitions for element to use")
|
||||
public void setCssStyle(String cssStyle) {
|
||||
this.cssStyle = cssStyle;
|
||||
}
|
||||
@@ -1133,4 +1140,8 @@ public abstract class UIBean extends Component {
|
||||
public void setTooltipIconPath(String tooltipIconPath) {
|
||||
this.tooltipIconPath = tooltipIconPath;
|
||||
}
|
||||
|
||||
public void setDynamicAttributes(Map<String,Object> dynamicAttributes) {
|
||||
this.dynamicAttributes = dynamicAttributes;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user