Compare commits

..

1 Commits

Author SHA1 Message Date
Ted Nathan Husted df365f17ea WW-1650 Tag r500931 as Struts 2.0.4
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_0_4@500932 13f79535-47bb-0310-9956-ffa450edef68
2007-01-29 03:40:41 +00:00
4755 changed files with 208528 additions and 361673 deletions
-14
View File
@@ -1,14 +0,0 @@
# Documentation https://s.apache.org/asfyaml
notifications:
commits: commits@struts.apache.org
# Send all issue emails (new, closed, comments) to issues@
issues: issues@struts.apache.org
# Send new/closed PR notifications to dev@
pullrequests_status: dev@struts.apache.org
# Send individual PR comments/reviews to issues@
pullrequests_comment: issues@struts.apache.org
# Link opened PRs with JIRA
jira_options: link label worklog
github:
del_branch_on_merge: true
-48
View File
@@ -1,48 +0,0 @@
# IDEA
.idea
*.iml
*.ipr
*.iws
# Eclipse
.classpath
.project
.settings/
.metadata/
Servers/
# Java annotation processor (APT)
.factorypath
#VSCode
.vscode
# OSX
.DS_Store
# Scripts
*.sh
# jenv
.java-version
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
plugins/testng/test-output
test-output
# Sonar
/.sonar/
# Tidelift CLI scanner
.tidelift
-117
View File
@@ -1,117 +0,0 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
-18
View File
@@ -1,18 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
-29
View File
@@ -1,29 +0,0 @@
dist: jammy
language: java
sudo: false
jdk:
- openjdk11
- openjdk17
install: true
env:
global:
- secure: iI7IpfDtS+LUyS2yNuRCR3KelNyvBHuoMQ3gb1UNmR5SSL7jO/p3olQWrQROs28FJ+dpE3lHyIjoHrebKQGJHHAgTG2XWxn+G3fDsf+wSSFSLoDGj0o2SgGXooBbR2dccnNZHCyQaOyE2cIPWaOxrQZFE4No70LQB4mrP/gdkoc=
matrix:
include:
- jdk: openjdk8
env: STRUTS_IT=true # do integration tests and coverage reports when jdk 11 and 17 tests prospered
script:
- if [ "$STRUTS_IT" == "true" ]; then
./mvnw clean install -DskipTests -DskipAssembly -B;
./mvnw test org.jacoco:jacoco-maven-plugin:report org.jacoco:jacoco-maven-plugin:report-integration org.eluder.coveralls:coveralls-maven-plugin:report -Ptravis-coveralls -DskipAssembly -B;
else
./mvnw clean package test -DskipAssembly -B;
fi;
cache:
directories:
- $HOME/.m2
Vendored
-256
View File
@@ -1,256 +0,0 @@
#!groovy
pipeline {
agent none
options {
buildDiscarder logRotator(daysToKeepStr: '14', numToKeepStr: '10')
timeout(80)
disableConcurrentBuilds()
skipStagesAfterUnstable()
quietPeriod(30)
}
triggers {
pollSCM 'H/15 * * * *'
}
stages {
stage('Prepare') {
agent {
label 'ubuntu'
}
stages {
stage('Clean up') {
steps {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
}
stage('JDK 17') {
agent {
label 'ubuntu'
}
tools {
jdk 'jdk_17_latest'
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Build') {
steps {
sh './mvnw -B clean install -DskipTests -DskipAssembly'
}
}
stage('Test') {
steps {
sh './mvnw -B test'
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
}
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
stage('JDK 11') {
agent {
label 'ubuntu'
}
tools {
jdk 'jdk_11_latest'
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Build') {
steps {
sh './mvnw -B clean install -DskipTests -DskipAssembly'
}
}
stage('Test') {
steps {
sh './mvnw -B test'
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
}
}
}
stage('Code Quality') {
when {
branch 'master'
}
steps {
withCredentials([string(credentialsId: 'asf-struts-sonarcloud', variable: 'SONARCLOUD_TOKEN')]) {
sh './mvnw sonar:sonar -DskipAssembly -Dsonar.login=${SONARCLOUD_TOKEN}'
}
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
stage('JDK 8') {
agent {
label 'ubuntu'
}
tools {
jdk 'jdk_1.8_latest'
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Build') {
steps {
sh './mvnw -B clean install -DskipTests -DskipAssembly'
}
}
stage('Test') {
steps {
sh './mvnw -B test'
// step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm])
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
}
}
}
stage('Build Source & JavaDoc') {
when {
branch 'master'
}
steps {
dir("local-snapshots-dir/") {
deleteDir()
}
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly'
}
}
stage('Deploy Snapshot') {
when {
branch 'master'
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly'
}
}
}
stage('Upload nightlies') {
when {
branch 'master'
}
steps {
sshPublisher(publishers: [
sshPublisherDesc(
configName: 'Nightlies',
transfers: [
sshTransfer(
remoteDirectory: '/struts/snapshot',
removePrefix: 'assembly/target/assembly/out',
sourceFiles: 'assembly/target/assembly/out/struts-*.zip'
)
],
verbose: true
)
])
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
}
post {
// If this build failed, send an email to the list.
failure {
script {
emailext(
to: "dev@struts.apache.org",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
from: "Mr. Jenkins <jenkins@builds.apache.org>",
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
body: """
There is a build failure in ${env.JOB_NAME}.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
Mr. Jenkins
Director of Continuous Integration
"""
)
}
}
// If this build didn't fail, but there were failing tests, send an email to the list.
unstable {
script {
emailext(
to: "dev@struts.apache.org",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
from: "Mr. Jenkins <jenkins@builds.apache.org>",
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
body: """
Some tests have failed in ${env.JOB_NAME}.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
Mr. Jenkins
Director of Continuous Integration
"""
)
}
}
// Send an email, if the last build was not successful and this one is.
fixed {
script {
emailext(
to: "dev@struts.apache.org",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
from: 'Mr. Jenkins <jenkins@builds.apache.org>',
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal",
body: """
The build for ${env.JOB_NAME} completed successfully and is back to normal.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
Changes: ${env.BUILD_URL}changes
--
Mr. Jenkins
Director of Continuous Integration
"""
)
}
}
}
}
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
-108
View File
@@ -1,108 +0,0 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
The Apache Struts web framework
-------------------------------
[![Build Status @ Jenkins](https://builds.apache.org/buildStatus/icon?job=Struts%2FStruts+Core%2Fmaster)](https://ci-builds.apache.org/job/Struts/job/Struts%20Core/job/master/)
[![Build Status @ Travis](https://travis-ci.com/apache/struts.svg?branch=master)](https://app.travis-ci.com/apache/struts)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.struts/struts2-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.struts/struts2-core/)
[![Javadocs](https://javadoc.io/badge/org.apache.struts/struts2-core.svg)](https://javadoc.io/doc/org.apache.struts/struts2-core)
[![Coverage Status](https://coveralls.io/repos/github/apache/struts/badge.svg)](https://coveralls.io/github/apache/struts)
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
The Apache Struts web framework is a free open-source solution for creating Java web applications.
## Documentation
More information can be found on the [homepage](https://struts.apache.org/). Please read the [Security Guide](https://struts.apache.org/security/),
and the [JavaDocs](https://struts.apache.org/maven/struts2-core/apidocs/index.html) can be browsed.
Questions related to the usage of Apache Struts should be posted to the [user mailing list](https://struts.apache.org/mail.html).
## Description
Web applications differ from conventional websites in that web applications can create a dynamic response. Many websites
deliver only static pages. A web application can interact with databases and business logic engines to customize a response.
Web applications based on JavaServer Pages sometimes commingle database code, page design code, and control flow code.
In practice, we find that unless these concerns are separated, larger applications become difficult to maintain.
One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model
represents the business or database code, the View represents the page design code, and the Controller represents
the navigational code. The Struts framework is designed to help developers create web applications that utilize
an MVC architecture.
The framework provides three key components:
- A “request” handler provided by the application developer that is mapped to a standard URI.
- A “response” handler that transfers control to another resource which completes the response.
- A tag library that helps developers create interactive form-based applications with server pages.
The frameworks architecture and tags are buzzword compliant. Struts works well
with conventional REST applications and with technologies like SOAP and AJAX.
## The Apache Struts Project
The Apache Struts Project is the open source community that creates and maintains the Apache Struts framework.
The project consists of a diverse group of volunteers who share common values regarding collaborative, community-based
open source development. The Apache Struts Project is proud to share these values with our parent organization:
The Apache Software Foundation.
The project is called “Struts” because the framework is meant to furnish the “invisible underpinnings” that support
professional application development. Struts provides the glue that joins the various elements of the standard Java
platform into a coherent whole. Our goal is to leverage existing standards by producing the missing pieces we need to create
enterprise-grade applications that are easy to maintain over time.
The Apache Struts Project offered two major versions of the Struts framework. Currently we are only maintaining the Struts 2
version. It is recommended to upgrade all Struts 1.x applications to Struts 2. Please do not start new application development
using Struts 1.x, as we are no longer issuing security patches.
Struts 2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts
communities joined forces to create Struts 2. The 2.x framework is the best choice for teams who value elegant solutions
to difficult problems.
## Why should you use Apache Struts?
Apache Struts is a modern, maintained and full-featured web framework. As it has been around for years and grown a huge user
base it is unlikely it will go away anytime soon. Not only that, we have dedicated users and developers
on the project. Apache Struts is licensed under the Apache License 2.0 and this will not change. We maintain a clean IP
and you are “safe” to use the project. Sometimes you are not “safe” to use a project when a company controls the SCM.
Access to Source Code doesnt mean it is free. With Apache Struts, you are not only free to “do what you want with it”,
you can even contribute (which is not always the case). And best of all: you can become a part of the core team too.
It is usually very easy to integrate other technologies with Apache Struts. If you are using an ORM like Apache Cayenne,
Hibernate or JDBC, you will not have any restrictions. Apache Struts is not even tied too much to a frontend technology.
In old days it was JSP, then came Velocity and Freemarker. Nowadays you might build your web application with just static
HTML and AngularJS. Or you might want to use Sitemesh or Tiles. This all is no problem due to Struts' elegant and easy-to-use
extension mechanisms.
Unlike other, component-oriented frameworks, we do not aim to hide the stateless nature of the web. We think it is
perfectly acceptable to build upon a Request/Response cycle. We also think the MVC pattern is not so bad, just because
it is old. In fact, we believe the Apache Struts architecture is clean and easy to understand.
Of course, if you wish to build components on the server side which render on the front end side, you will most likely
not want Struts. This is a different approach which promises to reduce the amount of HTML/JavaScript knowledge needed
and to create reusable components for the view layer. Projects like Wicket and Tapestry serve this purpose very well.
As with every framework, you need to decide if it makes sense for you to build components or if you prefer
the Struts approach.
## Commercial Support
The Apache Struts community does not offer commercial support by itself.
Some Apache Struts maintainers are working with [Tidelift](https://tidelift.com/) to provide commercial support and
invest paid working time in the improvement of the Apache Struts framework. For more information, visit
the [Tidelift resources regarding Apache Struts](https://tidelift.com/subscription/pkg/maven-org-apache-struts-struts2-core?utm_source=maven-org-apache-struts-struts2-core&utm_medium=referral&utm_campaign=readme)
-39
View File
@@ -1,39 +0,0 @@
# Security Policy
## Supported Versions
Please vist the [Releases](https://struts.apache.org/releases.html#prior-releases) page to see full information about each version
and what potential vulnerability it can have:
| Version | Supported |
| ------- | ------------------ |
| 2.5.20 | :white_check_mark: |
| 2.3.37 | :white_check_mark: |
## Reporting New Security Issues with thr Apache Struts
([original](https://struts.apache.org/security.html))
The Apache Struts project takes a very active stance in eliminating security problems
and denial of service attacks against applications using the Apache Struts framework.
**We strongly encourage folks to report such security problems to our private security mailing list first,
before disclosing them in a public forum**.
We cannot accept regular bug reports or other queries at this address, we ask that you use our
[issue tracker (JIRA)](https://issues.apache.org/jira/browse/WW) for those.
```
All mail sent to this address that does not relate to security problems in the Apache Struts source code will be ignored
```
Note that all networked servers are subject to denial of service attacks, and we cannot promise magic
workarounds to generic problems (such as a client streaming lots of data to your server, or re-requesting
the same URL repeatedly). In general our philosophy is to avoid any attacks which can cause the server
to consume resources in a non-linear relationship to the size of inputs.
The mailing address is: [security@struts.apache.org](mailto:security@struts.apache.org)
[General network server security tips](http://httpd.apache.org/docs/trunk/misc/security_tips.html)
[The Apache Security Team](http://www.apache.org/security/)
+54
View File
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.0.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-api</artifactId>
<packaging>jar</packaging>
<name>Struts 2 API</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/api/</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/api/</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/api/</url>
</scm>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
<!-- has to be compile for StrutsTestCase, which is part of the base package so others can write unit tests -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
<version>2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<showPackage>false</showPackage>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,45 @@
package org.apache.struts2;
/**
* Default action interface. Provided purely for user convenience. Struts does not require actions to implement any
* interfaces. Actions need only implement a public, no argument method which returns {@code String}. If a user does
* not specify a method name, Struts defaults to {@code execute()}.
*
* <p>For example:
*
* <pre>
* static import ResultNames.*;
*
* public class MyAction <b>implements Action</b> {
*
* public String execute() {
* return SUCCESS;
* }
* }
* </pre>
*
* <p>is equivalent to:
*
* <pre>
* static import ResultNames.*;
*
* public class MyAction {
*
* public String execute() {
* return SUCCESS;
* }
* }
* </pre>
*
* @author crazybob@google.com (Bob Lee)
*/
public interface Action {
/**
* Executes this action.
*
* @return result name which matches a result name from the action mapping in the configuration file. See {@link
* ResultNames} for common suggestions.
*/
String execute();
}
@@ -0,0 +1,41 @@
package org.apache.struts2;
/**
* Implemented by actions which may need to record errors or messages.
*
* <pre>
* static import ResultNames.*;
*
* public class SetName implements MessageAware {
*
* Messages messages;
* String name;
*
* public String execute() {
* return SUCCESS;
* }
*
* public void setName(String name) {
* if ("".equals(name))
* messages.forField("name").addError("name.required");
*
* this.name = name;
* }
*
* public void setMessages(Messages messages) {
* this.messages = messages;
* }
* }
* </pre>
*
* @author crazybob@google.com (Bob Lee)
*/
public interface MessageAware {
/**
* Sets messages.
*
* @param messages messages
*/
void setMessages(Messages messages);
}
@@ -0,0 +1,196 @@
package org.apache.struts2;
import java.util.List;
import java.util.Set;
import java.util.Map;
/**
* Collection of messages. Supports nesting messages by field name.
*
* <p>Uses keys when adding instead of actual messages to decouple code from messages.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface Messages {
// TODO: Use Object[] for args instead of String[].
/**
* Message severity.
*/
public enum Severity {
/**
* Informational messages.
*/
INFO,
/**
* Warning messages.
*/
WARN,
/**
* Error messages.
*/
ERROR,
}
/**
* Gets nested messages for the given field.
*
* <p>Supports dot notation to represent nesting. For example:
*
* <pre>
* messages.forField("foo").forField("bar") == messages.forField("foo.bar")
* </pre>
*
* @param fieldName name of the field
* @return nested {@code Messages} for given field name
*/
Messages forField(String fieldName);
/**
* Gets map of field name to messages for that field.
*
* @return map of field name to {@code Messages}
*/
Map<String, Messages> forFields();
/**
* Adds informational message.
*
* @param key message key
* @see Severity.INFO
*/
void addInformation(String key);
/**
* Adds informational message.
*
* @param key message key
* @param arguments message arguments
* @see Severity.INFO
*/
void addInformation(String key, String... arguments);
/**
* Adds warning message.
*
* @param key message key
* @see Severity.WARN
*/
void addWarning(String key);
/**
* Adds warning message.
*
* @param key message key
* @param arguments message arguments
* @see Severity.WARN
*/
void addWarning(String key, String... arguments);
/**
* Adds error message.
*
* @param key message key
* @see Severity.ERROR
*/
void addError(String key);
/**
* Adds error message.
*
* @param key message key
* @param arguments message arguments
* @see Severity.ERROR
*/
void addError(String key, String... arguments);
/**
* Adds message.
*
* @param severity message severity
* @param key message key
*/
void add(Severity severity, String key);
/**
* Adds request-scoped message.
*
* @param severity message severity
* @param key message key
* @param arguments message arguments
*/
void add(Severity severity, String key, String... arguments);
/**
* Gets set of severities for which this {@code Messages} instance has messages. Not recursive.
*
* @return unmodifiable set of {@link Severity} sorted from least to most severe
*/
Set<Severity> getSeverities();
/**
* Gets message strings for the given severity. Not recursive.
*
* @param severity message severity
* @return unmodifiable list of messages
*/
List<String> forSeverity(Severity severity);
/**
* Gets error message strings for this {@code Messages} instance. Not recursive.
*
* @return unmodifiable list of messages
*/
List<String> getErrors();
/**
* Gets error message strings for this {@code Messages} instance. Not recursive.
*
* @return unmodifiable list of messages
*/
List<String> getWarnings();
/**
* Gets informational message strings for this {@code Messages} instance. Not recursive.
*
* @return unmodifiable list of messages
*/
List<String> getInformation();
/**
* Returns true if this or a nested {@code Messages} instance has error messages.
*
* @see Severity.ERROR
*/
boolean hasErrors();
/**
* Returns true if this or a nested {@code Messages} instance has warning messages.
*
* @see Severity.WARN
*/
boolean hasWarnings();
/**
* Returns true if this or a nested {@code Messages} instance has informational messages.
*
* @see Severity.INFO
*/
boolean hasInformation();
/**
* Returns true if this and all nested {@code Messages} instances have no messages.
*/
boolean isEmpty();
/**
* Returns true if this and all nested {@code Messages} instances have no messages for the given severity.
*
* @param severity message severity
*/
boolean isEmpty(Severity severity);
}
@@ -0,0 +1,36 @@
package org.apache.struts2;
/**
* Commonly used result names returned by action methods.
*
* @author crazybob@google.com (Bob Lee)
*/
public final class ResultNames {
private ResultNames() {}
/**
* The action executed successfully.
*/
public static final String SUCCESS = "success";
/**
* The action requires more input, i.e.&nbsp;a validation error occurred.
*/
public static final String INPUT = "input";
/**
* The action requires the user to log in before executing.
*/
public static final String LOGIN = "login";
/**
* The action execution failed irrecoverably.
*/
public static final String ERROR = "error";
/**
* The action executed successfully, but do not execute a result.
*/
public static final String NONE = "none";
}
@@ -0,0 +1,17 @@
package org.apache.struts2;
import org.apache.struts2.MessageAware;
/**
* Implemented by actions which wish to execute some validation logic before their action method. Useful for
* cross-field validations.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface Validatable extends MessageAware {
/**
* Validates input. Executes before action method.
*/
public void validate();
}
@@ -0,0 +1,18 @@
package org.apache.struts2.servlet;
import java.util.Map;
/**
* Implemented by actions which need direct access to the request parameters.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface ParameterAware {
/**
* Sets parameters.
*
* @param parameters map of parameter name to parameter values
*/
void setParameters(Map<String, String[]> parameters);
}
@@ -0,0 +1,18 @@
package org.apache.struts2.servlet;
import javax.servlet.http.HttpServletRequest;
/**
* Implemented by actions which need direct access to the servlet request.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface ServletRequestAware {
/**
* Sets the servlet request.
*
* @param request servlet request.
*/
void setServletRequest(HttpServletRequest request);
}
@@ -0,0 +1,18 @@
package org.apache.struts2.servlet;
import javax.servlet.http.HttpServletResponse;
/**
* Implemented by actions which need direct access to the servlet response.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface ServletResponseAware {
/**
* Sets the servlet response.
*
* @param response servlet response
*/
void setServletResponse(HttpServletResponse response);
}
@@ -0,0 +1,59 @@
package org.apache.struts2.spi;
import java.lang.reflect.Method;
/**
* Context of an action execution.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface ActionContext {
/**
* Gets action instance.
*/
Object getAction();
/**
* Gets action method.
*/
Method getMethod();
/**
* Gets action name.
*/
String getActionName();
/**
* Gets the path for the action's namespace.
*/
String getNamespacePath();
/**
* Gets the {@link Result} instance for the action.
*
* @return {@link Result} instance or {@code null} if we don't have a result yet.
*/
Result getResult();
/**
* Adds a result interceptor for the action. Enables executing code before and after a result, executing an
* alternate result, etc.
*/
void addResultInterceptor(Result interceptor);
/**
* Gets context of action which chained to us.
*
* @return context of previous action or {@code null} if this is the first action in the chain
*/
ActionContext getPrevious();
/**
* Gets context of action which this action chained to.
*
* @return context of next action or {@code null} if we haven't chained to another action yet or this is the last
* action in the chain.
*/
ActionContext getNext();
}
@@ -0,0 +1,16 @@
package org.apache.struts2.spi;
/**
* Intercepts an action request.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface Interceptor {
/**
* Intercepts an action request.
*
* @param requestContext current request context
*/
String intercept(RequestContext requestContext) throws Exception;
}
@@ -0,0 +1,101 @@
package org.apache.struts2.spi;
import org.apache.struts2.Messages;
import javax.servlet.ServletContext;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
* Request context. A single request may span multiple actions with action chaining.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface RequestContext {
/**
* Gets context of the currently executing action.
*
* @return current action context
*/
ActionContext getActionContext();
/**
* Convenience method.&nbsp;Equivalent to {@code getActionContext().getAction()}.
*
* @return currently executing action
*/
Object getAction();
/**
* Gets map of request parameters.
*/
Map<String, String[]> getParameterMap();
/**
* Gets map of request attributes.
*/
Map<String, Object> getAttributeMap();
/**
* Gets map of session attributes.
*/
Map<String, Object> getSessionMap();
/**
* Gets map of application (servlet context) attributes.
*/
Map<String, Object> getApplicationMap();
/**
* Finds cookies with the given name,
*/
List<Cookie> findCookiesForName(String name);
/**
* Gets locale.
*/
Locale getLocale();
/**
* Sets locale. Stores the locale in the session for future requests.
*/
void setLocale(Locale locale);
/**
* Gets messages.
*/
Messages getMessages();
/**
* Gets the servlet request.
*/
HttpServletRequest getServletRequest();
/**
* Gets the servlet response.
*/
HttpServletResponse getServletResponse();
/**
* Gets the servlet context.
*/
ServletContext getServletContext();
/**
* Gets the value stack.
*/
ValueStack getValueStack();
/**
* Invokes the next interceptor or the action method if no more interceptors remain.
*
* @return result name
* @throws IllegalStateException if already invoked or called from the action
*/
String proceed() throws Exception;
}
@@ -0,0 +1,19 @@
package org.apache.struts2.spi;
import org.apache.struts2.spi.RequestContext;
/**
* Implemented by actions that need access to the current {@link org.apache.struts2.spi.RequestContext}. Use
* judiciously.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface RequestContextAware {
/**
* Sets {@link org.apache.struts2.spi.RequestContext}.
*
* @param requestContext
*/
void setRequestContext(RequestContext requestContext);
}
@@ -0,0 +1,18 @@
package org.apache.struts2.spi;
import org.apache.struts2.spi.RequestContext;
/**
* The result of an action request. Struts creates a new {@code Result} instance for each request.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface Result {
/**
* Executes result.
*
* @param requestContext
*/
void execute(RequestContext requestContext) throws Exception;
}
@@ -0,0 +1,93 @@
package org.apache.struts2.spi;
/**
* A central fixture of the Struts framework, the {@code ValueStack} is a stack which contains the actions
* which have executed in addition to other objects. Users can get and set values on the stack using expressions. The
* {@code ValueStack} will search down the stack starting with the most recent objects until it finds an object to
* which the expression can apply.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface ValueStack extends Iterable<Object> {
/**
* Gets the top, most recent object from the stack without changing the stack.
*
* @return the top object
*/
Object peek();
/**
* Removes the top, most recent object from the stack.
*
* @return the top object
*/
Object pop();
/**
* Pushes an object onto the stack.
*
* @param o
*/
void push(Object o);
/**
* Creates a shallow copy of this stack.
*
* @return a new stack which contains the same objects as this one
*/
ValueStack clone();
/**
* Queries the stack. Starts with the top, most recent object. If the expression can apply to the object, this
* method returns the result of evaluating the expression. If the expression does not apply, this method moves
* down the stack to the next object and repeats. Returns {@code null} if the expression doesn't apply to any
* objects.
*
* @param expression
* @return the evaluation of the expression against the first applicable object in the stack
*/
Object get(String expression);
/**
* Queries the stack and converts the result to the specified type. Starts with the top, most recent object. If
* the expression can apply to the object, this method returns the result of evaluating the expression converted
* to the specified type. If the expression does not apply, this method moves down the stack to the next object
* and repeats. Returns {@code null} if the expression doesn't apply to any objects.
*
* @param expression
* @param asType the type to convert the result to
* @return the evaluation of the expression against the first applicable object in the stack converted to the
* specified type
*/
<T> T get(String expression, Class<T> asType);
/**
* Queries the stack and converts the result to a {@code String}. Starts with the top, most recent object. If the
* expression can apply to the object, this method returns the result of evaluating the expression converted to a
* {@code String}. If the expression does not apply, this method moves down the stack to the next object and
* repeats. Returns {@code null} if the expression doesn't apply to any objects.
*
* @param expression
* @return the evaluation of the expression against the first applicable object in the stack converted to a {@code
* String}
*/
String getString(String expression);
/**
* Sets a value on an object from the stack. This method starts at the top, most recent object. If the expression
* applies to that object, this methods sets the given value on that object using the expression and converting
* the type as necessary. If the expression does not apply, this method moves to the next object and repeats.
*
* @param expression
* @param value
*/
void set(String expression, Object value);
/**
* Returns the number of object on the stack.
*
* @return size of stack
*/
int size();
}
+5
View File
@@ -0,0 +1,5 @@
Apache Struts
Copyright 2000-2007 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
+6
View File
@@ -0,0 +1,6 @@
Apache Struts
Copyright 2006 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/
+10
View File
@@ -0,0 +1,10 @@
README.txt - blank
This is an "empty" application that you can deploy as the basis of your own
application.
For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
----------------------------------------------------------------------------
+67
View File
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.0.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-blank</artifactId>
<packaging>war</packaging>
<name>Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/blank/</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/blank/</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/blank/</url>
</scm>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty6-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee_1.4_spec</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,30 @@
/*
* $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 example;
import com.opensymphony.xwork2.ActionSupport;
/**
* Base Action class for the Tutorial package.
*/
public class ExampleSupport extends ActionSupport {
}
@@ -0,0 +1,61 @@
/*
* $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 example;
/**
* <code>Set welcome message.</code>
*/
public class HelloWorld extends ExampleSupport {
public String execute() throws Exception {
setMessage(getText(MESSAGE));
return SUCCESS;
}
/**
* Provide default valuie for Message property.
*/
public static final String MESSAGE = "HelloWorld.message";
/**
* Field for Message property.
*/
private String message;
/**
* Return Message property.
*
* @return Message property
*/
public String getMessage() {
return message;
}
/**
* Set Message property.
*
* @param message Text to display on HelloWorld page.
*/
public void setMessage(String message) {
this.message = message;
}
}
@@ -0,0 +1,59 @@
/*
* $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 example;
public class Login extends ExampleSupport {
public String execute() throws Exception {
if (isInvalid(getUsername())) return INPUT;
if (isInvalid(getPassword())) return INPUT;
return SUCCESS;
}
private boolean isInvalid(String value) {
return (value == null || value.length() == 0);
}
private String username;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
@@ -0,0 +1,3 @@
@echo off
set CLASSPATH=..\..\..\lib\xwork-2.0-beta-1.jar
javac *.java -d ..\..\..\classes
+5
View File
@@ -0,0 +1,5 @@
Apache Struts
Copyright 2000-2007 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
+25
View File
@@ -0,0 +1,25 @@
<?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="example" namespace="/example" extends="struts-default">
<action name="HelloWorld" class="example.HelloWorld">
<result>/example/HelloWorld.jsp</result>
</action>
<action name="Login_*" method="{1}" class="example.Login">
<result name="input">/example/Login.jsp</result>
<result type="redirect-action">Menu</result>
</action>
<action name="*" class="example.ExampleSupport">
<result>/example/{1}.jsp</result>
</action>
<!-- Add actions here -->
</package>
</struts>
@@ -0,0 +1,16 @@
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="username">
<field-validator type="requiredstring">
<message key="requiredstring"/>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message key="requiredstring"/>
</field-validator>
</field>
</validators>
@@ -0,0 +1,5 @@
HelloWorld.message= Struts is up and running ...
requiredstring = ${getText(fieldName)} is required.
password = Password
username = User Name
Missing.message = This feature is under construction. Please try again in the next interation.
@@ -0,0 +1,5 @@
HelloWorld.message= ¡Struts está bien! ...
requiredstring = ${getText(fieldName)} se requiere.
password = Contraseña
username = Nombre de Usuario
Missing.message = ¡en obras! ¡seguir intentando!
+15
View File
@@ -0,0 +1,15 @@
<?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>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<include file="example.xml"/>
<!-- Add packages here -->
</struts>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts Blank</display-name>
<filter>
<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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
@@ -0,0 +1,28 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title><s:text name="HelloWorld.message"/></title>
</head>
<body>
<h2><s:property value="message"/></h2>
<h3>Languages</h3>
<ul>
<li>
<s:url id="url" action="HelloWorld">
<s:param name="request_locale">en</s:param>
</s:url>
<s:a href="%{url}">English</s:a>
</li>
<li>
<s:url id="url" action="HelloWorld">
<s:param name="request_locale">es</s:param>
</s:url>
<s:a href="%{url}">Espanol</s:a>
</li>
</ul>
</body>
</html>
@@ -0,0 +1,15 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Sign On</title>
</head>
<body>
<s:form action="Login">
<s:textfield key="username"/>
<s:password key="password" />
<s:submit/>
</s:form>
</body>
</html>
@@ -0,0 +1,3 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:include value="Missing.jsp"/>
@@ -0,0 +1,11 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>Missing Feature</title></head>
<body>
<p>
<s:text name="Missing.message"/>
</p>
</body>
</html>
@@ -0,0 +1,3 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:include value="Missing.jsp"/>
@@ -0,0 +1,18 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Welcome</title>
<link href="<s:url value="/css/examplecss"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<h3>Commands</h3>
<ul>
<li><a href="<s:url action="Login_input"/>">Sign On</a></li>
<li><a href="<s:url action="Register"/>">Register</a></li>
</ul>
</body>
</html>
+10
View File
@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=example/HelloWorld.action">
</head>
<body>
<p>Loading ...</p>
</body>
</html>
@@ -0,0 +1,97 @@
/*
* $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 example;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.config.RuntimeConfiguration;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
import java.util.Map;
import java.util.List;
import org.apache.struts2.StrutsTestCase;
public class ConfigTest extends StrutsTestCase {
protected void assertSuccess(String result) throws Exception {
assertTrue("Expected a success result!",
ActionSupport.SUCCESS.equals(result));
}
protected void assertInput(String result) throws Exception {
assertTrue("Expected an input result!",
ActionSupport.INPUT.equals(result));
}
protected Map assertFieldErrors(ActionSupport action) throws Exception {
assertTrue(action.hasFieldErrors());
return action.getFieldErrors();
}
protected void assertFieldError(Map field_errors, String field_name, String error_message) {
List errors = (List) field_errors.get(field_name);
assertNotNull("Expected errors for " + field_name, errors);
assertTrue("Expected errors for " + field_name, errors.size()>0);
// TODO: Should be a loop
assertEquals(error_message,errors.get(0));
}
protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
configurationManager.addConfigurationProvider(c);
configurationManager.reload();
}
protected ActionConfig assertClass(String namespace, String action_name, String class_name) {
RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
ActionConfig config = configuration.getActionConfig(namespace, action_name);
assertNotNull("Mssing action", config);
assertTrue("Wrong class name: [" + config.getClassName() + "]",
class_name.equals(config.getClassName()));
return config;
}
protected ActionConfig assertClass(String action_name, String class_name) {
return assertClass("", action_name, class_name);
}
protected void assertResult(ActionConfig config, String result_name, String result_value) {
Map results = config.getResults();
ResultConfig result = (ResultConfig) results.get(result_name);
Map params = result.getParams();
String value = (String) params.get("actionName");
if (value == null)
value = (String) params.get("location");
assertTrue("Wrong result value: [" + value + "]",
result_value.equals(value));
}
public void testConfig() throws Exception {
assertNotNull(configurationManager);
}
}
@@ -0,0 +1,37 @@
/*
* $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 example;
import com.opensymphony.xwork2.ActionSupport;
import junit.framework.TestCase;
public class HelloWorldTest extends TestCase {
public void testHelloWorld() throws Exception {
HelloWorld hello_world = new HelloWorld();
String result = hello_world.execute();
assertTrue("Expected a success result!",
ActionSupport.SUCCESS.equals(result));
assertTrue("Expected the default message!",
hello_world.getText(HelloWorld.MESSAGE).equals(hello_world.getMessage()));
}
}
@@ -0,0 +1,55 @@
/*
* $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 example;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import java.util.Map;
public class LoginTest extends ConfigTest {
public void FIXME_testLoginConfig() throws Exception {
ActionConfig config = assertClass("example", "Login_input", "example.Login");
assertResult(config, ActionSupport.SUCCESS, "Menu");
assertResult(config, ActionSupport.INPUT, "/example/Login.jsp");
}
public void testLoginSubmit() throws Exception {
Login login = new Login();
login.setUsername("username");
login.setPassword("password");
String result = login.execute();
assertSuccess(result);
}
// Needs access to an envinronment that includes validators
public void FIXME_testLoginSubmitInput() throws Exception {
Login login = new Login();
String result = login.execute();
assertInput(result);
Map errors = assertFieldErrors(login);
assertFieldError(errors,"username","Username is required.");
assertFieldError(errors,"password","Password is required.");
}
}
+18
View File
@@ -0,0 +1,18 @@
README.txt - mailreader
The MailReader demonstrates a localized application with a master/child
CRUD workflow.
This rendition also demonstrates using wildcards to "normalize" an
application.
See the Sandbox for other MailReader examples using other architectures.
* http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/
For more about the MailReader applicaton genneraly, visit Struts University.
* http://www.StrutsUniversity.org/
----------------------------------------------------------------------------
+63
View File
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.0.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-mailreader</artifactId>
<packaging>war</packaging>
<name>Starter Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/mailreader/</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/mailreader/</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/mailreader/</url>
</scm>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>struts-mailreader-dao</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${pom.version}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,3 @@
password=Enter your Password here ==>
struts.logo.path=struts-power.gif
struts.logo.alt=Powered by Struts
@@ -0,0 +1 @@
.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b==>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="autodetect">
<!-- add your spring beans here -->
</beans>
@@ -0,0 +1,47 @@
<?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="mailreader-default" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="authentication"
class="mailreader2.AuthenticationInterceptor"/>
<interceptor-stack name="user" >
<interceptor-ref name="authentication" />
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
<interceptor-stack name="user-submit" >
<interceptor-ref name="token-session" />
<interceptor-ref name="user"/>
</interceptor-stack>
<interceptor-stack name="guest" >
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="user"/>
<global-results>
<result name="error">/pages/Error.jsp</result>
<result name="invalid.token">/pages/Error.jsp</result>
<result name="login" type="redirect-action">Login_input</result>
</global-results>
<global-exception-mappings>
<exception-mapping
result="error"
exception="java.lang.Throwable"/>
</global-exception-mappings>
</package>
</struts>
@@ -0,0 +1,63 @@
<?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="mailreader-support" namespace="/" extends="mailreader-default">
<action name="Tour">
<result>/tour.html</result>
<interceptor-ref name="guest"/>
</action>
<action name="Welcome" class="mailreader2.Welcome">
<result>/Welcome.jsp</result>
<interceptor-ref name="guest"/>
</action>
<action name="Logout" class="mailreader2.Logout">
<result type="redirect-action">Welcome</result>
</action>
<action name="Login_*" method="{1}" class="mailreader2.Login">
<result name="input">/Login.jsp</result>
<result name="cancel" type="redirect-action">Welcome</result>
<result type="redirect-action">MainMenu</result>
<result name="expired" type="chain">ChangePassword</result>
<exception-mapping
exception="org.apache.struts.apps.mailreader.dao.ExpiredPasswordException"
result="expired"/>
<interceptor-ref name="guest"/>
</action>
<action name="Registration_*" method="{1}" class="mailreader2.Registration">
<result name="input">/Registration.jsp</result>
<result type="redirect-action">MainMenu</result>
<interceptor-ref name="guest"/>
</action>
</package>
<package name="subscription" namespace="/" extends="mailreader-support">
<global-results>
<result name="input">/Subscription.jsp</result>
<result type="redirect-action">Registration_input</result>
</global-results>
<action name="Subscription_save" method="save" class="mailreader2.Subscription">
<interceptor-ref name="user-submit" />
</action>
<action name="Subscription_*" method="{1}" class="mailreader2.Subscription" />
</package>
<package name="wildcard" namespace="/" extends="mailreader-support">
<action name="*" class="mailreader2.MailreaderSupport">
<result>/{1}.jsp</result>
</action>
</package>
</struts>
@@ -0,0 +1,234 @@
/*
* $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 org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.io.*;
/**
* <p><code>ServletContextListener</code> that initializes and finalizes the
* persistent storage of User and Subscription information for the Struts
* Demonstration Application, using an in-memory database backed by an XML
* file.</p>
* <p/>
* <p><strong>IMPLEMENTATION WARNING</strong> - If this web application is run
* from a WAR file, or in another environment where reading and writing of the
* web application resource is impossible, the initial contents will be copied
* to a file in the web application temporary directory provided by the
* container. This is for demonstration purposes only - you should
* <strong>NOT</strong> assume that files written here will survive a restart
* of your servlet container.</p>
* <p/>
* <p>This class was borrowed from the Shale Mailreader. Changes were:</p>
* <p/>
* <ul>
* <p/>
* <li>Path to database.xml (under classes here). </li>
* <p/>
* <li>Class to store protocol list (an array here). </li>
* <p/>
* </ul>
* <p>
* DEVELOPMENT NOTE - Another approach would be to instantiate the database via Spring.
* </p>
*/
public final class ApplicationListener implements ServletContextListener {
// ------------------------------------------------------ Manifest Constants
/**
* <p>Appication scope attribute key under which the in-memory version of
* our database is stored.</p>
*/
public static final String DATABASE_KEY = "database";
/**
* <p>Application scope attribute key under which the valid selection
* items for the protocol property is stored.</p>
*/
public static final String PROTOCOLS_KEY = "protocols";
// ------------------------------------------------------ Instance Variables
/**
* <p>The <code>ServletContext</code> for this web application.</p>
*/
private ServletContext context = null;
/**
* The {@link MemoryUserDatabase} object we construct and make available.
*/
private MemoryUserDatabase database = null;
/**
* <p>Logging output for this plug in instance.</p>
*/
private Log log = LogFactory.getLog(this.getClass());
// ------------------------------------------------------------- Properties
/**
* <p>The web application resource path of our persistent database storage
* file.</p>
*/
private String pathname = "/WEB-INF/database.xml";
/**
* <p>Return the application resource path to the database.</p>
*
* @return application resource path path to the database
*/
public String getPathname() {
return (this.pathname);
}
/**
* <p>Set the application resource path to the database.</p>
*
* @param pathname to the database
*/
public void setPathname(String pathname) {
this.pathname = pathname;
}
// ------------------------------------------ ServletContextListener Methods
/**
* <p>Gracefully shut down this database, releasing any resources that
* were allocated at initialization.</p>
*
* @param event ServletContextEvent to process
*/
public void contextDestroyed(ServletContextEvent event) {
log.info("Finalizing memory database plug in");
if (database != null) {
try {
database.close();
} catch (Exception e) {
log.error("Closing memory database", e);
}
}
context.removeAttribute(DATABASE_KEY);
context.removeAttribute(PROTOCOLS_KEY);
database = null;
context = null;
}
/**
* <p>Initialize and load our initial database from persistent
* storage.</p>
*
* @param event The context initialization event
*/
public void contextInitialized(ServletContextEvent event) {
log.info("Initializing memory database plug in from '" +
pathname + "'");
// Remember our associated ServletContext
this.context = event.getServletContext();
// Construct a new database and make it available
database = new MemoryUserDatabase();
try {
String path = calculatePath();
if (log.isDebugEnabled()) {
log.debug(" Loading database from '" + path + "'");
}
database.setPathname(path);
database.open();
} catch (Exception e) {
log.error("Opening memory database", e);
throw new IllegalStateException("Cannot load database from '" +
pathname + "': " + e);
}
context.setAttribute(DATABASE_KEY, database);
}
// -------------------------------------------------------- Private Methods
/**
* <p>Calculate and return an absolute pathname to the XML file to contain
* our persistent storage information.</p>
*
* @throws Exception if an input/output error occurs
*/
private String calculatePath() throws Exception {
// Can we access the database via file I/O?
String path = context.getRealPath(pathname);
if (path != null) {
return (path);
}
// Does a copy of this file already exist in our temporary directory
File dir = (File)
context.getAttribute("javax.servlet.context.tempdir");
File file = new File(dir, "struts-example-database.xml");
if (file.exists()) {
return (file.getAbsolutePath());
}
// Copy the static resource to a temporary file and return its path
InputStream is =
context.getResourceAsStream(pathname);
BufferedInputStream bis = new BufferedInputStream(is, 1024);
FileOutputStream os =
new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(os, 1024);
byte buffer[] = new byte[1024];
while (true) {
int n = bis.read(buffer);
if (n <= 0) {
break;
}
bos.write(buffer, 0, n);
}
bos.close();
bis.close();
return (file.getAbsolutePath());
}
}
@@ -0,0 +1,31 @@
package mailreader2;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Action;
import java.util.Map;
import org.apache.struts.apps.mailreader.dao.User;
public class AuthenticationInterceptor implements Interceptor {
public void destroy () {}
public void init() {}
public String intercept(ActionInvocation actionInvocation) throws Exception {
Map session = actionInvocation.getInvocationContext().getSession();
User user = (User) session.get(Constants.USER_KEY);
boolean isAuthenticated = (null!=user) && (null!=user.getDatabase());
if (!isAuthenticated) {
return Action.LOGIN;
}
else {
return actionInvocation.invoke();
}
}
}
@@ -0,0 +1,128 @@
/*
* $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;
/**
* <p> Manifest constants for the MailReader application. </p>
*/
public final class Constants {
// --- Tokens ----
/**
* <p> The token representing a "cancel" request. </p>
*/
public static final String CANCEL = "cancel";
/**
* <p> The token representing a "create" task. </p>
*/
public static final String CREATE = "Create";
/**
* <p> The application scope attribute under which our user database is
* stored. </p>
*/
public static final String DATABASE_KEY = "database";
/**
* <p> The token representing a "edit" task. </p>
*/
public static final String DELETE = "Delete";
/**
* <p> The token representing a "edit" task. </p>
*/
public static final String EDIT = "Edit";
/**
* <p> The package name for this application. </p>
*/
public static final String PACKAGE = "org.apache.struts.apps.mailreader";
/**
* <p> The session scope attribute under which the Subscription object
* currently selected by our logged-in User is stored. </p>
*/
public static final String SUBSCRIPTION_KEY = "subscription";
/**
* <p> The session scope attribute under which the User object for the
* currently logged in user is stored. </p>
*/
public static final String USER_KEY = "user";
/**
* <p>The token representing the "Host" property.
*/
public static final String HOST = "host";
// ---- Error Messages ----
/**
* <p>
* A static message in case message resource is not loaded.
* </p>
*/
public static final String ERROR_MESSAGES_NOT_LOADED =
"ERROR: Message resources not loaded -- check servlet container logs for error messages.";
/**
* <p>
* A static message in case database resource is not loaded.
* <p>
*/
public static final String ERROR_DATABASE_NOT_LOADED =
"ERROR: User database not loaded -- check servlet container logs for error messages.";
/**
* <p>
* A standard key from the message resources file, to test if it is available.
* <p>
*/
public static final String ERROR_DATABASE_MISSING = "error.database.missing";
/**
* <P>
* A "magic" username to trigger an ExpiredPasswordException for testing.
*</p>
*/
public static final String EXPIRED_PASSWORD_EXCEPTION = "ExpiredPasswordException";
/**
* <p>
* Name of field to associate with authentification errors.
* <p>
*/
public static final String PASSWORD_MISMATCH_FIELD = "password";
// ---- Log Messages ----
/**
* <p> Message to log if saving a user fails. </p>
*/
public static final String LOG_DATABASE_SAVE_ERROR =
" Unexpected error when saving User: ";
}
@@ -0,0 +1,48 @@
/*
* $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 org.apache.struts.apps.mailreader.dao.User;
import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException;
/**
* <p> Validate a user login. </p>
*/
public final class Login extends MailreaderSupport {
public String execute() throws ExpiredPasswordException {
User user = findUser(getUsername(), getPassword());
if (user != null) {
setUser(user);
}
if (hasErrors()) {
return INPUT;
}
return SUCCESS;
}
}
@@ -0,0 +1,14 @@
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="username">
<field-validator type="requiredstring">
<message key="error.username.required"/>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message key="error.password.required"/>
</field-validator>
</field>
</validators>
@@ -0,0 +1,35 @@
/*
* $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;
/**
* <p> Log user out of the current session. </p>
*/
public class Logout extends MailreaderSupport {
public String execute() {
setUser(null);
return SUCCESS;
}
}
@@ -0,0 +1,562 @@
/*
* $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 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 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 org.springframework.beans.BeanUtils;
import java.util.Map;
/**
* <p> Base Action for MailreaderSupport application. </p>
* <p/>
* <p> Note that this class does NOT implement model driven because of the way
* the pre-existing model is designed. The MailReader DAO includes immutable
* fields that can only be set on construction, and some objects do not have a
* default construction. One approach would be to mirror all the DAO
* properties on the Actions. As an alternative, this implementations uses the
* DAO properties where possible, and uses local Action properties only as
* needed. To create new objects, a blank temporary object is constructed, and
* the page uses a mix of local Action properties and DAO properties. When the
* new object is to be saved, the local Action properties are used to create
* the object using the DAO factory methods, the input values are copied from
* the temporary object, and the new object is saved. It's kludge, but it
* avoids creating unnecessary local properties. Pick your poison.</p>
*/
public class MailreaderSupport extends ActionSupport
implements SessionAware, ApplicationAware {
/**
* Return CANCEL so apropriate result can be selected.
* @return "cancel" so apropriate result can be selected.
*/
public String cancel() {
return Constants.CANCEL;
}
// ---- ApplicationAware ----
/**
* <p>Field to store application context or its proxy.</p>
* <p/>
* <p>The application context lasts for the life of the application. A
* reference to the database is stored in the application context at
* startup.</p>
*/
private Map application;
/**
* <p>Store a new application context.</p>
*
* @param value A Map representing application state
*/
public void setApplication(Map value) {
application = value;
}
/**
* <p>Provide application context.</p>
*/
public Map getApplication() {
return application;
}
// ---- SessionAware ----
/**
* <p>Field to store session context, or its proxy.</p>
*/
private Map session;
/**
* <p>Store a new session context.</p>
*
* @param value A Map representing session state
*/
public void setSession(Map value) {
session = value;
}
/**
* <p>Provide session context.</p>
*
* @return session context
*/
public Map getSession() {
return session;
}
// ---- Task property (utilized by UI) ----
/**
* <p>Field to store workflow task.</p>
* <p/>
* <p>The Task is used to track the state of the CRUD workflows. It can be
* set to Constant.CREATE, Constant.EDIT, or Constant.DELETE as
* needed.</p>
*/
private String task = null;
/**
* <p>Provide worklow task.</p>
*
* @return Returns the task.
*/
public String getTask() {
return task;
}
/**
* <p>Store new workflow task.</p>
*
* @param value The task to set.
*/
public void setTask(String value) {
task = value;
}
// ---- Token property (utilized by UI) ----
/**
* <p>Field to store double-submit guard.</p>
*/
private String token = null;
/**
* <p>Provide Token.</p>
*
* @return Returns the token.
*/
public String getToken() {
return token;
}
/**
* <p>Store new Token.</p>
*
* @param value The token to set.
*/
public void setToken(String value) {
token = value;
}
// ---- Host property ----
/**
* <p>Field to store Subscription host.</p>
* <p/>
* <p> The host is an immutable property of the Subscrtion DAP object, so
* we need to store it locally until we are ready to create the
* Subscription. </p>
*/
private String host;
/**
* <p>Provide tSubscription host.</p>
*
* @return host property
*/
public String getHost() {
return host;
}
/**
* <p>Store new Subscription host.</p>
*
* @param value
*/
public void setHost(String value) {
host = value;
}
// ---- Password property ----
/**
* <p>Field to store User password property.</p>
* <p/>
* <p>The User DAO object password proerty is immutable, so we store it
* locally until we are ready to create the object.</p>
*/
private String password = null;
/**
* <p>Provide User password</p>
*
* @return Returns the password.
*/
public String getPassword() {
return password;
}
/**
* <p>Store new User Password</p>
*
* @param value The password to set.
*/
public void setPassword(String value) {
password = value;
}
// ---- Password2 property (confirmation) ----
/**
* <p>Field to store the User password confirmation.</p>
* <p/>
* <p>When a User object is created, we ask the client to enter the
* password twice, to help ensure the password is being typed
* correctly.</p>
*/
private String password2 = null;
/**
* <p>Provide the User password confirmation.</p>
*
* @return Returns the confirmationpassword.
*/
public String getPassword2() {
return password2;
}
/**
* <p>Store a new User password confirmation.</p>
*
* @param value The confirmation password to set.
*/
public void setPassword2(String value) {
password2 = value;
}
// ---- Username property ----
/**
* <p>Field to store User username.</p>
* <p/>
* <p>The User DAO object password proerty is immutable, so we store it
* locally until we are ready to create the object.</p>
*/
private String username = null;
/**
* <p>Provide User username.</p>
*
* @return Returns the User username.
*/
public String getUsername() {
return username;
}
/**
* <p>Store new User username</p>
*
* @param value The username to set.
*/
public void setUsername(String value) {
username = value;
}
// ---- Database property ----
/**
* <p>Provide reference to UserDatabase, or null if the database is not
* available. </p>
*
* @return a reference to the UserDatabase or null if the database is not
* available
*/
public UserDatabase getDatabase() {
Object db = getApplication().get(Constants.DATABASE_KEY);
if (db == null) {
this.addActionError(getText("error.database.missing"));
}
return (UserDatabase) db;
}
/**
* <p>Store a new reference to UserDatabase</p>
*
* @param database
*/
public void setDatabase(UserDatabase database) {
getApplication().put(Constants.DATABASE_KEY, database);
}
// ---- User property ----
/**
* <p>Provide reference to User object for authenticated user.</p>
*
* @return User object for authenticated user.
*/
public User getUser() {
return (User) getSession().get(Constants.USER_KEY);
}
/**
* <p>Store new reference to User Object.</p>
*
* @param user User object for authenticated user
*/
public void setUser(User user) {
getSession().put(Constants.USER_KEY, user);
}
/**
* <p>Obtain User object from database, or return null if the credentials
* are not found or invalid.</p>
*
* @param username User username
* @param password User password
* @return User object or null if not found
* @throws ExpiredPasswordException
*/
public User findUser(String username, String password)
throws ExpiredPasswordException {
// FIXME: Stupid testing hack to compensate for inadequate DAO layer
if (Constants.EXPIRED_PASSWORD_EXCEPTION.equals(username)) {
throw new ExpiredPasswordException(Constants.EXPIRED_PASSWORD_EXCEPTION);
}
User user = getDatabase().findUser(username);
if ((user != null) && !user.getPassword().equals(password)) {
user = null;
}
if (user == null) {
this.addFieldError(Constants.PASSWORD_MISMATCH_FIELD,
getText("error.password.mismatch"));
}
return user;
}
/**
* <p><code>Log</code> instance for this application. </p>
*/
protected Log log = LogFactory.getLog(Constants.PACKAGE);
/**
* <p> Persist the User object, including subscriptions, to the database.
* </p>
*
* @throws java.lang.Exception on database error
*/
public void saveUser() throws Exception {
try {
getDatabase().save();
} catch (Exception e) {
String message = Constants.LOG_DATABASE_SAVE_ERROR + getUser()
.getUsername();
log.error(message, e);
throw new Exception(message, e);
}
}
public void createInputUser() {
User user = new MemoryUser(null, null);
setUser(user);
}
/**
* <p> Verify input for creating a new user, create the user, and process
* the login. </p>
*
* @return A new User and empty Errors if create succeeds, or null and
* Errors if create fails
*/
public User createUser(String username, String password) {
UserDatabase database = getDatabase();
User user;
try {
user = database.findUser(username);
}
catch (ExpiredPasswordException e) {
user = getUser(); // Just so that it is not null
}
if (user != null) {
this.addFieldError("username", "error.username.unique");
return null;
}
return database.createUser(username);
}
// Since user.username is immutable, we have to use some local properties
/**
* <p>Use the current User object to create a new User object, and make
* the new User object the authenticated user.</p>
* <p/>
* <p>The "current" User object is usually a temporary object being used
* to capture input.</p>
*
* @param _username User username
* @param _password User password
*/
public void copyUser(String _username, String _password) {
User input = getUser();
input.setPassword(_password);
User user = createUser(_username, _password);
if (null != user) {
BeanUtils.copyProperties(input,user);
setUser(user);
}
}
// ---- Subscription property ----
/**
* <p>Obtain the cached Subscription object, if any. </p>
*
* @return Cached Subscription object or null
*/
public Subscription getSubscription() {
return (Subscription) getSession().get(Constants.SUBSCRIPTION_KEY);
}
/**
* <p>Store new User Subscription.</p>
*
* @param subscription
*/
public void setSubscription(Subscription subscription) {
getSession().put(Constants.SUBSCRIPTION_KEY, subscription);
}
/**
* <p> Obtain User Subscription object for the given host, or return null
* if not found. </p>
*
* <p>It would be possible for this code to throw a NullPointerException,
* but the ExceptionHandler in the xwork.xml will catch that for us.</p>
*
* @return The matching Subscription or null
*/
public Subscription findSubscription(String host) {
Subscription subscription;
subscription = getUser().findSubscription(host);
return subscription;
}
/**
* <p>Obtain uSER Subscription for the local Host property.</p>
* <p/>
* <p>Usually, the host property will be set from the client request,
* because it was embedded in a link to the Subcription action.
*
* @return Subscription or null if not found
*/
public Subscription findSubscription() {
return findSubscription(getHost());
}
/**
* <p>Provide a "temporary" User Subscription object that can be used to
* capture input values.</p>
*/
public void createInputSubscription() {
Subscription sub = new MemorySubscription(getUser(), null);
setSubscription(sub);
setHost(sub.getHost());
}
/**
* <p>Provide new User Subscription object for the given host, or null if
* the host is not unique.</p>
*
* @param host
* @return New User Subscription object or null
*/
public Subscription createSubscription(String host) {
Subscription sub;
sub = findSubscription(host);
if (null != sub) {
// FIXME - localization - "error.host.unique")
addFieldError(Constants.HOST,"That hostname is already defined");
return null;
}
return getUser().createSubscription(host);
}
/**
* <p>Create a new Subscription from the current Subscription object,
* making the new Subscription the current Subscription. </p>
* <p/>
* <p>Usually, the "current" Subscription is a temporary object being used
* to capture input values.</p>
*
* @param host
*/
public void copySubscription(String host) {
Subscription input = getSubscription();
Subscription sub = createSubscription(host);
if (null != sub) {
BeanUtils.copyProperties(input, sub);
setSubscription(sub);
setHost(sub.getHost());
}
}
/**
* <p>Delete the current Subscription object from the database.</p>
*/
public void removeSubscription() {
getUser().removeSubscription(getSubscription());
getSession().remove(Constants.SUBSCRIPTION_KEY);
}
/**
* <p>Provide MailServer Host for current User Subscription.</p>
*
* @return MailServer Host for current User Subscription
*/
public String getSubscriptionHost() {
Subscription sub = getSubscription();
if (null == sub) {
return null;
}
return sub.getHost();
}
}
@@ -0,0 +1,96 @@
button.cancel=Cancel
button.confirm=Confirm
button.doSubmit=DO_SUBMIT
button.doReset=DO_RESULT
button.doCancel=org.apache.struts.taglib.html.CANCEL
button.reset=Reset
button.save=Save
change.message=Your password has expired. Please ask the system administrator to change it.
change.try=Try Again
change.title=Password Has Expired
database.load=Cannot load database from {0}
error.database.missing=User database is missing, cannot validate login credentials
error.fromAddress.format=Invalid format for From Address
error.fromAddress.required=From Address is required
error.fullName.required=Full Name is required
error.host.required=Mail Server is required
error.noSubscription=No Subscription bean in user session
error.password.expired=Your password has expired for username {0}
error.password.required=Password is required
error.password2.required=Confirmation password is required
error.password.match=Password and confirmation password must match
error.password.mismatch=Invalid username and/or password, please try again
error.replyToAddress.format=Invalid format for Reply To Address
struts.messages.invalid.token=Cannot submit this form out of order
error.type.invalid=Server Type must be 'imap' or 'pop3'
error.type.required=Server Type is required
error.username.required=Username is required
error.username.unique=That username is already in use - please select another
errors.footer=</ul><hr>
errors.header=<h3><font color="red">Validation Error</font></h3><p>You must correct the following error(s) before proceeding:</p><ul>
errors.prefix=<li>
errors.suffix=</li>
errors.ioException=I/O exception rendering error messages: {0}
expired.password=User Password has expired for {0}
heading.autoConnect=Auto
heading.subscriptions=Current Subscriptions
heading.host=Host Name
heading.user=User Name
heading.type=Server Type
heading.action=Action
index.heading=MailReader Demonstration Application Options
index.login=Log on to the MailReader Demonstration Application
index.registration=Register with the MailReader Demonstration Application
index.title=MailReader Demonstration Application
index.tour=A Walking Tour of the MailReader Demonstration Application
linkSubscription.io=I/O Error: {0}
linkSubscription.noSubscription=No subscription under attribute {0}
linkUser.io=I/O Error: {0}
linkUser.noUser=No user under attribute {0}
login.title=MailReader Demonstration Application - Login
mainMenu.heading=Main Menu Options for
mainMenu.logout=Log off MailReader Demonstration Application
mainMenu.registration=Edit your user registration profile
mainMenu.title=MailReader Demonstration Application - Main Menu
option.imap=IMAP Protocol
option.pop3=POP3 Protocol
# prompt.
host=Mail Server
password=Password
password2=(Repeat) Password
username=Username
registration.addSubscription=Add
registration.deleteSubscription=Delete
registration.editSubscription=Edit
registration.title.create=Register for the MailReader Demonstration Application
registration.title.edit=Edit Registration for the MailReader Demonstration Application
subscription.autoConnect=Auto Connect
subscription.password=Mail Password
subscription.type=Server Type
subscription.username=Mail Username
subscription.title.create=Create New Mail Subscription
subscription.title.delete=Delete Existing Mail Subscription
subscription.title.edit=Edit Existing Mail Subscription
user.fromAddress=From Address
user.fullName=Full Name
user.replyToAddress=Reply To Address
# Standard error messages for validator framework checks
errors.required=${getText(fieldName)} is required.
errors.minlength=${getText(fieldName)} cannot be less than {1} characters.
errors.maxlength=${getText(fieldName)} cannot be greater than {1} characters.
errors.invalid=${getText(fieldName)} is invalid.
errors.byte=${getText(fieldName)} must be an byte.
errors.short=${getText(fieldName)} must be an short.
errors.integer=${getText(fieldName)} must be an integer.
errors.long=${getText(fieldName)} must be an long.
errors.float=${getText(fieldName)} must be an float.
errors.double=${getText(fieldName)} must be an double.
errors.date=${getText(fieldName)} is not a date.
errors.range=${getText(fieldName)} is not in the range ${minLength} through ${maxLength}.
errors.creditcard=${getText(fieldName)} is not a valid credit card number.
errors.email=${getText(fieldName)} is an invalid e-mail address.
errors.literal=${getText(fieldName)}
@@ -0,0 +1,89 @@
button.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
button.confirm=\u78ba\u8a8d
button.reset=\u30ea\u30bb\u30c3\u30c8
button.save=\u4fdd\u5b58
change.message=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u6709\u52B9\u671F\u9650\u304C\u904E\u304E\u307E\u3057\u305F\u3002\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u4E0B\u3055\u3044
change.try=\u518D\u8A66\u884C
change.title=\u30d1\u30b9\u30ef\u30fc\u30c9\u671f\u9650\u5207\u308c
database.load= {0} \u304B\u3089\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
error.database.missing=\u30E6\u30FC\u30B6\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u30ED\u30B0\u30AA\u30F3\u306E\u8A8D\u8A3C\u304C\u51FA\u6765\u307E\u305B\u3093
error.fromAddress.format=From\u30A2\u30C9\u30EC\u30B9\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
error.fromAddress.required=From\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
error.fullName.required=\u30D5\u30EB\u30CD\u30FC\u30E0\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
error.host.required=\u30E1\u30FC\u30EB\u30B5\u30FC\u30D0\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
error.noSubscription=Subscription bean \u304c\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u4e2d\u306b\u3042\u308a\u307e\u305b\u3093
error.password.expired=\u30E6\u30FC\u30B6 {0} \u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u6709\u52B9\u671F\u9650\u304C\u904E\u304E\u307E\u3057\u305F
error.password.required=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u5FC5\u8981\u3067\u3059
error.password2.required=\u30D1\u30B9\u30EF\u30FC\u30C9(\u78BA\u8A8D\u7528)\u304C\u5FC5\u8981\u3067\u3059
error.password.match=\u30D1\u30B9\u30EF\u30FC\u30C9\u3068\u78BA\u8A8D\u7528\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u3066\u3044\u307E\u305B\u3093
error.password.mismatch=\u30E6\u30FC\u30B6\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E0D\u6B63\u3067\u3059\u3002\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
error.replyToAddress.format=\u8FD4\u4FE1\u30A2\u30C9\u30EC\u30B9\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
struts.messages.invalid.token=\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306E\u5185\u5BB9\u304C\u6B63\u3057\u304F\u306A\u3044\u305F\u3081\u9001\u4FE1\u3059\u308B\u3053\u3068\u304C\u51FA\u6765\u307E\u305B\u3093
error.type.invalid=\u30B5\u30FC\u30D0\u30BF\u30A4\u30D7\u306F 'imap' \u304B 'pop3'\u306E\u3069\u3061\u3089\u304B\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093
error.type.required=\u30B5\u30FC\u30D0\u30BF\u30A4\u30D7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
error.username.required=\u30E6\u30FC\u30B6\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
error.username.unique=\u305D\u306E\u30E6\u30FC\u30B6\u540D\u306F\u65E2\u306B\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u3002 \u5225\u306E\u30E6\u30FC\u30B6\u540D\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044
errors.footer=</ul><hr>
errors.header=<h3><font color="red">\u5165\u529b\u30c1\u30a7\u30c3\u30af\u30a8\u30e9\u30fc</font></h3><p>\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044:</p><ul>
errors.prefix=<li>
errors.suffix=</li>
errors.ioException=I/O\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f: {0}
expired.password=\u30E6\u30FC\u30B6 {0} \u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u6709\u52B9\u671F\u9650\u304C\u904E\u304E\u307E\u3057\u305F
heading.autoConnect=\u81ea\u52d5\u63a5\u7d9a
heading.subscriptions=\u73fe\u5728\u306e\u8cfc\u8aad\u60c5\u5831
heading.host=\u30db\u30b9\u30c8\u540d
heading.user=\u30e6\u30fc\u30b6\u540d
heading.type=\u30b5\u30fc\u30d0\u30bf\u30a4\u30d7
heading.action=\u64cd\u4f5c
index.heading=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30aa\u30d7\u30b7\u30e7\u30f3
index.login=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30ed\u30b0\u30aa\u30f3
index.registration=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30e6\u30fc\u30b6\u767b\u9332
index.title=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3(Struts 1.1-dev)
index.tour=\u30b5\u30f3\u30d7\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u6563\u7b56\u3059\u308b
linkSubscription.io=I/O\u30a8\u30e9\u30fc: {0}
linkSubscription.noSubscription=\u5c5e\u6027 {0} \u306b\u8cfc\u8aad\u60c5\u5831\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
linkUser.io=I/O\u30a8\u30e9\u30fc: {0}
linkUser.noUser=\u5c5e\u6027 {0} \u306b\u30e6\u30fc\u30b6\u60c5\u5831\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
login.title=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30ed\u30b0\u30aa\u30f3
mainMenu.heading=\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc
mainMenu.logout=MailReader \u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u30aa\u30d5
mainMenu.registration=\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6
mainMenu.title=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc
option.imap=IMAP \u30d7\u30ed\u30c8\u30b3\u30eb
option.pop3=POP3 \u30d7\u30ed\u30c8\u30b3\u30eb
# prompt.
autoConnect=\u81ea\u52d5\u63a5\u7d9a
fromAddress=From\u30a2\u30c9\u30ec\u30b9
fullName=\u30d5\u30eb\u30cd\u30fc\u30e0
mailHostname=\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0
mailPassword=\u30e1\u30fc\u30eb\u30d1\u30b9\u30ef\u30fc\u30c9
mailServerType=\u30b5\u30fc\u30d0\u30bf\u30a4\u30d7
mailUsername=\u30e1\u30fc\u30eb\u30e6\u30fc\u30b6\u540d
.password=\u30d1\u30b9\u30ef\u30fc\u30c9
password2=\u30d1\u30b9\u30ef\u30fc\u30c9(\u78ba\u8a8d\u7528)
replyToAddress=\u8fd4\u4fe1\u30a2\u30c9\u30ec\u30b9
username=\u30e6\u30fc\u30b6\u540d
registration.addSubscription=\u65b0\u898f\u4f5c\u6210
registration.deleteSubscription=\u524a\u9664
registration.editSubscription=\u7de8\u96c6
registration.title.create=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30e6\u30fc\u30b6\u767b\u9332
registration.title.edit=MailReader\u30c7\u30e2\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 - \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u7de8\u96c6
subscription.title.create=\u30e1\u30fc\u30eb\u8cfc\u8aad\u60c5\u5831\u306e\u65b0\u898f\u4f5c\u6210
subscription.title.delete=\u30e1\u30fc\u30eb\u8cfc\u8aad\u60c5\u5831\u306e\u524a\u9664
subscription.title.edit=\u30e1\u30fc\u30eb\u8cfc\u8aad\u60c5\u5831\u306e\u7de8\u96c6
# Standard error messages for validator framework checks
errors.required=${getText(fieldName)} \u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002
errors.minlength=${getText(fieldName)} \u306f {1} \u6587\u5b57\u4ee5\u4e0a\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.maxlength=${getText(fieldName)} \u306f {2} \u6587\u5b57\u4ee5\u4e0b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.invalid=${getText(fieldName)} \u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002
errors.byte=${getText(fieldName)} \u306fbyte\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.short=${getText(fieldName)} \u306fshort\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.integer=${getText(fieldName)} \u306finteger\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.long=${getText(fieldName)} \u306flong\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.float=${getText(fieldName)} \u306ffloat\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.double=${getText(fieldName)} \u306fdouble\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.date=${getText(fieldName)} \u306f\u65e5\u4ed8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
errors.range=${getText(fieldName)} \u306f {1} \u304b\u3089 {2} \u306e\u9593\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.creditcard=${getText(fieldName)} \u306f\u6b63\u3057\u3044\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u756a\u53f7\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
errors.email=${getText(fieldName)} \u306f\u6b63\u3057\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
@@ -0,0 +1,89 @@
button.cancel=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c
button.confirm=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c
button.reset=\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c
button.save=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c
change.message=Your password has expired. Please ask the system administrator to change it.
change.try=Try Again
change.title=Password Has Expired
database.load=\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0438\u0437 {0}
error.database.missing=\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f - \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.
error.fromAddress.format=\u0412 \u043f\u043e\u043b\u0435 '\u0410\u0434\u0440\u0435\u0441 \u041e\u0442:' \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435.
error.fromAddress.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0432 \u043f\u043e\u043b\u0435 '\u0410\u0434\u0440\u0435\u0441 \u041e\u0442:'.
error.fullName.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f.
error.host.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440.
error.noSubscription=\u041f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f
error.password.expired=Your password has expired for username {0}
error.password.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c.
error.password2.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f.
error.password.match=\u041f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442.
error.password.mismatch=\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u044f \u0438/\u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044c - \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0441\u043d\u043e\u0432\u0430.
error.replyToAddress.format=\u0412 \u043f\u043e\u043b\u0435 '\u0410\u0434\u0440\u0435\u0441 \u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430:' \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435.
struts.messages.invalid.token=\u042d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 - \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.
error.type.invalid=\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0438\u043f\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043b\u0438\u0448\u044c 'imap' \u0438\u043b\u0438 'pop3'
error.type.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0438\u043f \u0441\u0435\u0440\u0432\u0435\u0440\u0430
error.username.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f
error.username.unique=\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f - \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0434\u0440\u0443\u0433\u043e\u0435 \u0438\u043c\u044f.
errors.footer=</ul><hr>
errors.header=<h3><font color="red">\u041e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445</font></h3><p>\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0438:</p><ul>
errors.prefix=<li>
errors.suffix=</li>
errors.ioException=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430/\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445: {0}
expired.password=User Password has expired for {0}
heading.autoConnect=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438
heading.subscriptions=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438
heading.host=\u0421\u0435\u0440\u0432\u0435\u0440
heading.user=\u0418\u043c\u044f
heading.type=\u0422\u0438\u043f \u0441\u0435\u0440\u0432\u0435\u0440\u0430
heading.action=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435
index.heading=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b'
index.login=\u0412\u043e\u0439\u0442\u0438 \u043a\u0430\u043a \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c
index.registration=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f
index.title=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b' (Struts 1.1-dev)
index.tour=\u041e\u0431\u0437\u043e\u0440 \u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b'
linkSubscription.io=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438): {0}
linkSubscription.noSubscription=\u0410\u0442\u0440\u0438\u0431\u0443\u0442 {0} \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.
linkUser.io=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f): {0}
linkUser.noUser=\u0410\u0442\u0440\u0438\u0431\u0443\u0442 {0} \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0438\u043b\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.
login.title=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b - \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u043c\u0435\u043d\u0438 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f.
mainMenu.heading=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e \u0434\u043b\u044f
mainMenu.logout=\u0412\u044b\u0439\u0442\u0438
mainMenu.registration=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
mainMenu.title=\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 '\u0427\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b' - \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e
option.imap=\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b IMAP
option.pop3=\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b POP3
# prompt.
autoConnect=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435:
fromAddress=\u0410\u0434\u0440\u0435\u0441 \u041e\u0442:
fullName=\u041f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f:
mailHostname=\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440:
mailPassword=\u041f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430:
mailServerType=\u0422\u0438\u043f \u0441\u0435\u0440\u0432\u0435\u0440\u0430:
mailUsername=\u0418\u043c\u044f \u0434\u043b\u044f \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430:
password=\u041f\u0430\u0440\u043e\u043b\u044c:
password2=(\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435) \u041f\u0430\u0440\u043e\u043b\u044c:
replyToAddress=\u0410\u0434\u0440\u0435\u0441 \u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430:
username=\u0418\u043c\u044f:
registration.addSubscription=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c
registration.deleteSubscription=\u0423\u0434\u0430\u043b\u0438\u0442\u044c
registration.editSubscription=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c
registration.title.create=\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f
registration.title.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438
subscription.title.create=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443
subscription.title.delete=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443
subscription.title.edit=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443
# Standard error messages for validator framework checks
errors.required=${getText(fieldName)} is required.
errors.minlength=${getText(fieldName)} cannot be less than {1} characters.
errors.maxlength=${getText(fieldName)} cannot be greater than {2} characters.
errors.invalid=${getText(fieldName)} is invalid.
errors.byte=${getText(fieldName)} must be an byte.
errors.short=${getText(fieldName)} must be an short.
errors.integer=${getText(fieldName)} must be an integer.
errors.long=${getText(fieldName)} must be an long.
errors.float=${getText(fieldName)} must be an float.
errors.double=${getText(fieldName)} must be an double.
errors.date=${getText(fieldName)} is not a date.
errors.range=${getText(fieldName)} is not in the range {1} through {2}.
errors.creditcard=${getText(fieldName)} is not a valid credit card number.
errors.email=${getText(fieldName)} is an invalid e-mail address.
@@ -0,0 +1,28 @@
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="password">
<field-validator type="requiredstring">
<message key="error.password.required"/>
</field-validator>
<field-validator type="stringlength">
<param name="trim">true</param>
<param name="minLength">4</param>
<param name="maxLength">10</param>
<message key="errors.range"/>
</field-validator>
</field>
<field name="password2">
<field-validator type="requiredstring">
<message key="error.password2.required"/>
</field-validator>
</field>
<validator type="expression">
<param name="expression">password eq password2</param>
<message key="error.password.match"/>
</validator>
</validators>
@@ -0,0 +1,32 @@
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="username">
<field-validator type="requiredstring">
<message key="error.username.required"/>
</field-validator>
</field>
<field name="user.fullName">
<field-validator type="requiredstring">
<message key="error.fullName.required"/>
</field-validator>
</field>
<field name="user.fromAddress">
<field-validator type="requiredstring">
<message key="error.fromAddress.required"/>
</field-validator>
<field-validator type="email">
<message key="errors.email"/>
</field-validator>
</field>
<field name="user.replyToAddress">
<field-validator type="email">
<message key="errors.email"/>
</field-validator>
</field>
</validators>
@@ -0,0 +1,122 @@
/*
* $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 org.apache.struts.apps.mailreader.dao.User;
/**
* <p>Insert or update a User object to the persistent store. </p>
*/
public class Registration extends MailreaderSupport {
/**
* <p>Double check that there is not a valid User login. </p>
*
* @return True if there is not a valid User login
*/
private boolean isCreating() {
User user = getUser();
return (null == user) || (null == user.getDatabase());
}
/**
* <p> Retrieve User object to edit or null if User does not exist. </p>
*
* @return The "Success" result for this mapping
* @throws Exception on any error
*/
public String input() throws Exception {
if (isCreating()) {
createInputUser();
setTask(Constants.CREATE);
} else {
setTask(Constants.EDIT);
setUsername(getUser().getUsername());
setPassword(getUser().getPassword());
setPassword2(getUser().getPassword());
}
return INPUT;
}
/**
* <p>Insert or update a Registration.</p>
*
* @return The "outcome" result code
* @throws Exception on any error
*/
public String save() throws Exception {
return execute();
}
/**
* <p> Insert or update a User object to the persistent store. </p>
* <p/>
* <p> If a User is not logged in, then a new User is created and
* automatically logged in. Otherwise, the existing User is updated. </p>
*
* @return The "outcome" result code
* @throws Exception on any error
*/
public String execute()
throws Exception {
boolean creating = Constants.CREATE.equals(getTask());
creating = creating && isCreating(); // trust but verify
if (creating) {
User user = findUser(getUsername(), getPassword());
boolean haveUser = (user != null);
if (haveUser) {
addActionError(getText("error.username.unique"));
return INPUT;
}
copyUser(getUsername(), getPassword());
} else {
// FIXME: Any way to call the RegisrationSave validators from here?
String newPassword = getPassword();
if (newPassword != null) {
String confirmPassword = getPassword2();
boolean matches = ((null != confirmPassword)
&& (confirmPassword.equals(newPassword)));
if (matches) {
getUser().setPassword(newPassword);
} else {
addActionError(getText("error.password.match"));
return INPUT;
}
}
}
saveUser();
return SUCCESS;
}
}
@@ -0,0 +1,23 @@
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="subscription.username">
<field-validator type="requiredstring">
<message key="error.username.required"/>
</field-validator>
</field>
<field name="subscription.password">
<field-validator type="requiredstring">
<message key="error.password.required"/>
</field-validator>
</field>
<field name="subscription.type">
<field-validator type="requiredstring">
<message key="error.type.invalid"/>
</field-validator>
</field>
</validators>
@@ -0,0 +1,11 @@
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="host">
<field-validator type="requiredstring">
<message key="error.host.required"/>
</field-validator>
</field>
</validators>
@@ -0,0 +1,145 @@
/*
* $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.Preparable;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* <p> Provide an Edit method for retrieving an existing subscription, and a
* Save method for updating or inserting a subscription. </p>
*/
public class Subscription extends MailreaderSupport
implements Preparable {
/**
* <p>Field to store list of MailServer types</p>
*/
private Map types = null;
/**
* <p>Provide the list of MailServer types.</p>
*
* @return List of MailServer types
*/
public Map getTypes() {
return types;
}
/**
* <p>Setup the MailerServer types and set the local Host property from
* the User Subscription (if any). </p>
*/
public void prepare() {
Map m = new LinkedHashMap();
m.put("imap", "IMAP Protocol");
m.put("pop3", "POP3 Protocol");
types = m;
setHost(getSubscriptionHost());
}
/**
* <p>Setup a temporary User Subscription object to capture input
* values.</p>
*
* @return INPUT
*/
public String input() {
createInputSubscription();
setTask(Constants.CREATE);
return INPUT;
}
/**
* <p>Load User Subscription for the local Host property.</p>
* <p/>
* <p>Usually, the Host is being set from the request by a link to an Edit
* or Delete task.</p>
*
* @return INPUT or Error, if Subscription is not found
*/
public String find() {
org.apache.struts.apps.mailreader.dao.Subscription
sub = findSubscription();
if (sub == null) {
return ERROR;
}
setSubscription(sub);
return INPUT;
}
/**
* <p>Prepare to present a confirmation page before removing
* Subscription.</p>
*
* @return INPUT or Error, if Subscription is not found
*/
public String delete() {
setTask(Constants.DELETE);
return find();
}
/**
* <p>Prepare to edit User Subscription.</p>
*
* @return INPUT or Error, if Subscription is not found
*/
public String edit() {
setTask(Constants.EDIT);
return find();
}
/**
* <p> Examine the Task property and DELETE, CREATE, or save the User
* Subscription, as appropriate. </p>
*
* @return SUCCESS
* @throws Exception on a database error
*/
public String save() throws Exception {
if (Constants.DELETE.equals(getTask())) {
removeSubscription();
}
if (Constants.CREATE.equals(getTask())) {
copySubscription(getHost());
}
if (hasErrors()) return INPUT;
saveUser();
return SUCCESS;
}
}
@@ -0,0 +1,49 @@
/*
* $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;
/**
* Verify that essential resources are available.
*/
public class Welcome extends MailreaderSupport {
public String execute() {
// Confirm message resources loaded
String message = getText(Constants.ERROR_DATABASE_MISSING);
if (Constants.ERROR_DATABASE_MISSING.equals(message)) {
addActionError(Constants.ERROR_MESSAGES_NOT_LOADED);
}
// Confirm database loaded
if (null==getDatabase()) {
addActionError(Constants.ERROR_DATABASE_NOT_LOADED);
}
if (hasErrors()) {
return ERROR;
}
else {
return SUCCESS;
}
}
}
+17
View File
@@ -0,0 +1,17 @@
<?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>
<constant name="struts.action.extension" value="do" />
<constant name="struts.devMode" value="false" />
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.objectFactory" value="spring" />
<include file="mailreader-default.xml"/>
<include file="mailreader-support.xml"/>
</struts>
@@ -0,0 +1,5 @@
Apache Struts
Copyright 2000-2007 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
@@ -0,0 +1,25 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><s:text name="change.title"/></title>
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<p>
<s:text name="change.message"/>
</p>
<p>
<a href="<s:url action="Login_input"/>">
<s:text name="change.try"/>
</a>
</p>
</body>
</html>
+40
View File
@@ -0,0 +1,40 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Unexpected Error</title>
</head>
<body>
<h2>An unexpected error has occured</h2>
<p>
Please report this error to your system administrator
or appropriate technical support personnel.
Thank you for your cooperation.
</p>
<hr/>
<h3>Error Message</h3>
<s:actionerror />
<p>
<s:property value="%{exception.message}"/>
</p>
<hr/>
<h3>Technical Details</h3>
<p>
<s:property value="%{exceptionStack}"/>
</p>
<jsp:include page="Footer.jsp"/>
</body>
</html>
@@ -0,0 +1,6 @@
<%@ taglib uri="/struts-tags" prefix="s" %>
<hr/>
<p>
<a href="<s:url action="Welcome" />"><s:text name="index.title"/></a>
</p>
+30
View File
@@ -0,0 +1,30 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><s:text name="login.title"/></title>
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body onLoad="self.focus();document.Login.username.focus()">
<s:actionerror />
<s:form action="Login" validate="true">
<s:textfield key="username" />
<s:password key="password" showPassword="true"/>
<s:submit key="button.save"/>
<s:reset key="button.reset"/>
<s:submit action="Login_cancel" key="button.cancel"
onclick="form.onsubmit=null"/>
</s:form>
<jsp:include page="Footer.jsp"/>
</body>
</html>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/">
</Context>
@@ -0,0 +1,25 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><s:text name="mainMenu.title"/></title>
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<h3><s:text name="mainMenu.heading"/> <s:property
value="user.fullName"/></h3>
<ul>
<li><a href="<s:url action="Registration_input" />">
<s:text name="mainMenu.registration"/>
</a>
</li>
<li><a href="<s:url action="Logout"/>">
<s:text name="mainMenu.logout"/>
</a>
</ul>
</body>
</html>
@@ -0,0 +1,115 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<s:if test="task=='Create'">
<title><s:text name="registration.title.create"/></title>
</s:if>
<s:if test="task=='Edit'">
<title><s:text name="registration.title.edit"/></title>
</s:if>
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body onLoad="self.focus();document.Registration_save_username.focus()">
<s:actionerror/>
<s:form action="Registration_save" validate="false">
<s:token />
<s:hidden name="task"/>
<s:if test="task == 'Create'">
<s:textfield key="username"/>
</s:if>
<s:else>
<s:label key="username"/>
<s:hidden name="username"/>
</s:else>
<s:password key="password"/>
<s:password key="password2"/>
<s:textfield key="user.fullName"/>
<s:textfield key="user.fromAddress"/>
<s:textfield key="user.replyToAddress"/>
<s:if test="task == 'Create'">
<s:submit key="button.save" action="Registration_save"/>
<s:reset key="button.reset"/>
<s:submit action="Welcome" key="button.cancel"
onclick="form.onsubmit=null"/>
</s:if>
<s:else>
<s:submit key="button.save" action="Registration"/>
<s:reset key="button.reset"/>
<s:submit action="MainMenu" key="button.cancel"
onclick="form.onsubmit=null"/>
</s:else>
</s:form>
<s:if test="task == 'Edit'">
<div align="center">
<h3><s:text name="heading.subscriptions"/></h3>
</div>
<table border="1" width="100%">
<tr>
<th align="center" width="30%">
<s:text name="heading.host"/>
</th>
<th align="center" width="25%">
<s:text name="heading.user"/>
</th>
<th align="center" width="10%">
<s:text name="heading.type"/>
</th>
<th align="center" width="10%">
<s:text name="heading.autoConnect"/>
</th>
<th align="center" width="15%">
<s:text name="heading.action"/>
</th>
</tr>
<s:iterator value="user.subscriptions">
<tr>
<td align="left">
<s:property value="host"/>
</td>
<td align="left">
<s:property value="username"/>
</td>
<td align="center">
<s:property value="type"/>
</td>
<td align="center">
<s:property value="autoConnect"/>
</td>
<td align="center">
<a href="<s:url action="Subscription_delete"><s:param name="host" value="host"/></s:url>">
<s:text name="registration.deleteSubscription"/>
</a>
&nbsp;
<a href="<s:url action="Subscription_edit"><s:param name="host" value="host"/></s:url>">
<s:text name="registration.editSubscription"/>
</a>
</td>
</tr>
</s:iterator>
</table>
<a href="<s:url action="Subscription_input"/>"><s:text
name="registration.addSubscription"/></a>
</s:if>
<jsp:include page="Footer.jsp"/>
</body>
</html>
@@ -0,0 +1,60 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<s:if test="task=='Create'">
<title><s:text name="subscription.title.create"/></title>
</s:if>
<s:if test="task=='Edit'">
<title><s:text name="subscription.title.edit"/></title>
</s:if>
<s:if test="task=='Delete'">
<title><s:text name="subscription.title.delete"/></title>
</s:if>
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body onLoad="self.focus();document.Subscription.username.focus()">
<s:actionerror/>
<s:form action="Subscription_save" validate="true">
<s:token />
<s:hidden name="task"/>
<s:label key="username" name="user.username"/>
<s:if test="task == 'Create'">
<s:textfield key="host"/>
</s:if>
<s:else>
<s:label key="host"/>
<s:hidden name="host"/>
</s:else>
<s:if test="task == 'Delete'">
<s:label key="subscription.username"/>
<s:label key="subscription.password"/>
<s:label key="subscription.type"/>
<s:label key="subscription.autoConnect"/>
<s:submit key="button.confirm"/>
</s:if>
<s:else>
<s:textfield key="subscription.username"/>
<s:textfield key="subscription.password"/>
<s:select key="subscription.type" list="types"/>
<s:checkbox key="subscription.autoConnect"/>
<s:submit key="button.save"/>
<s:reset key="button.reset"/>
</s:else>
<s:submit action="Registration_input"
key="button.cancel"
onclick="form.onsubmit=null"/>
</s:form>
<jsp:include page="Footer.jsp"/>
</body>
</html>
@@ -0,0 +1,13 @@
<?xml version='1.0'?>
<database>
<user username="user" fromAddress="John.User@somewhere.com"
fullName="John Q. User" password="pass">
<subscription host="mail.hotmail.com" autoConnect="false"
password="bar" type="pop3" username="user1234">
</subscription>
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
type="imap" username="jquser">
</subscription>
</user>
</database>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Struts 2 Mailreader</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
<filter>
<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.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Application Listener for Mailreader database -->
<listener>
<listener-class>
mailreader2.ApplicationListener
</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
@@ -0,0 +1,56 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><s:text name="index.title"/></title>
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<h3><s:text name="index.heading"/></h3>
<ul>
<li><a href="<s:url action="Registration_input"/>"><s:text
name="index.registration"/></a></li>
<li><a href="<s:url action="Login_input"/>"><s:text
name="index.login"/></a></li>
</ul>
<h3>Language Options</h3>
<ul>
<li>
<s:url id="en" action="Welcome">
<s:param name="request_locale">en</s:param>
</s:url>
<s:a href="%{en}">English</s:a>
</li>
<li>
<s:url id="ja" action="Welcome">
<s:param name="request_locale">ja</s:param>
</s:url>
<s:a href="%{ja}">Japanese</s:a>
</li>
<li>
<s:url id="ru" action="Welcome">
<s:param name="request_locale">ru</s:param>
</s:url>
<s:a href="%{ru}">Russian</s:a>
</li>
</ul>
<hr/>
<p><s:i18n name="alternate">
<img src="<s:text name="struts.logo.path"/>"
alt="<s:text name="struts.logo.alt"/>"/>
</s:i18n></p>
<p><a href="<s:url action="Tour" />"><s:text name="index.tour"/></a></p>
</body>
</html>
@@ -0,0 +1,46 @@
/**
* Mailreader stylesheet
*/
body {
background-color: #FFFFFF;
color: #000000;
link: 000066;
visited: #660066;
active: #33CCCC;
}
A:hover {
color: #FF0000;
}
h1 {
font-family: Arial, Helvetica, sans-serif;
}
h2 {
font-family: Arial, Helvetica, sans-serif;
}
h3 {
font-family: Arial, Helvetica, sans-serif;
}
h4 {
font-family: Arial, Helvetica, sans-serif;
}
h5 {
font-family: Arial, Helvetica, sans-serif;
}
h6 {
font-family: Arial, Helvetica, sans-serif;
}
font.hint {
font-style: italic;
font-size: 80%;
font-family: Arial, Helvetica, sans-serif;
text-align: left;
}
@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=Welcome.do">
</head>
<body>
<p>Loading ...</p>
</body>
</html>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff
+145 -55
View File
@@ -1,48 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
/*
* 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.
*
* 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$
*/
-->
<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">
<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>6.0.3</version>
<version>2.0.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
<name>Struts 2 Webapps</name>
<name>Webapps</name>
<modules>
<module>blank</module>
<module>mailreader</module>
<module>portlet</module>
<module>showcase</module>
<module>rest-showcase</module>
</modules>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<distributionManagement>
<site>
<id>apache-site</id>
<url>scp://people.apache.org/www/struts.apache.org/struts2/apps</url>
</site>
</distributionManagement>
<profiles>
<profile>
<id>hostedqa</id>
<dependencies>
<dependency>
<groupId>com.hostedqa</groupId>
<artifactId>hostedqa-remote-ant</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>codehaus</id>
<name>codehaus</name>
<url>http://repository.codehaus.org</url>
</repository>
<repository>
<id>maven-hostedqa</id>
<name>maven-hostedqa</name>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<url>http://maven.hostedqa.com</url>
</repository>
</repositories>
<build>
<resources>
<!-- Include resources under src/main/java in WEB-INF/classes -->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<taskdef resource="hostedqatasks" classpathref="maven.plugin.classpath"/>
<upload file="${project.build.directory}/${project.build.finalName}.war"
account="struts" email="${email}"
password="${password}" resourceId="${resourceId}"/>
<maven.site.skip>true</maven.site.skip>
<maven.site.deploy.skip>true</maven.site.deploy.skip>
</properties>
<playsuite suiteId="${suiteId}" clientConfigs="${clientConfigs}" appConfigs="${appConfigs}" account="struts"
email="${email}"
password="${password}"/>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.hostedqa</groupId>
<artifactId>hostedqa-remote-ant</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat5x</containerId>
<home>${cargo.tomcat5x.home}</home>
<log>${project.build.directory}/tomcat5x.log</log>
<output>${project.build.directory}/tomcat5x.out</output>
</container>
<configuration>
<home>${project.build.directory}/tomcat5x</home>
</configuration>
</configuration>
</plugin>
<!-- Include source code under WEB-INF/src/java -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
@@ -51,14 +155,16 @@
<id>copy-sources</id>
<phase>process-sources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/${project.artifactId}/WEB-INF/src/java" failonerror="false">
<fileset dir="${basedir}/src/main/java" />
<tasks>
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java"
failonerror="false">
<fileset dir="${basedir}/src/main/java"/>
</copy>
<copy todir="${project.build.directory}/${project.artifactId}/WEB-INF/src/java" failonerror="false">
<fileset dir="${basedir}/src/main/resources" />
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java"
failonerror="false">
<fileset dir="${basedir}/src/main/resources"/>
</copy>
</target>
</tasks>
</configuration>
<goals>
<goal>run</goal>
@@ -66,42 +172,26 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>LICENSE.txt</include>
<include>NOTICE.txt</include>
</includes>
</resource>
</webResources>
<warSourceExcludes>WEB-INF/classes/LICENSE.txt,WEB-INF/classes/NOTICE.txt</warSourceExcludes>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
<finalName>${pom.artifactId}</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${project.version}</version>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.platformVersion}</version>
<artifactId>spring-mock</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
+17
View File
@@ -0,0 +1,17 @@
README.txt - portlet
This is a simple example of using the portlet API with Struts applications.
For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
WARNING - Additional configuration required for deployment
Due to difference in portlet contrainer implementations, the porlet
WAR is not ready-to-run. Extract the porlet WAR, and then copy the
contents of apps/portlet/src/main/etc/<your_portal_server>/ into the
WAR's WEB-INF directory.
----------------------------------------------------------------------------
+70
View File
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.0.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet</artifactId>
<packaging>war</packaging>
<name>Portlet Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</connection>
<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>
<dependencies>
<dependency>
<groupId>portlet-api</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>velocity-tools</groupId>
<artifactId>velocity-tools</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.8</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>
<version>2.0</version>
</dependency>
</dependencies>
</project>
+63
View File
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>struts-portlet</display-name>
<!-- 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>
</context-param>
<filter>
<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>
<listener>
<listener-class>
org.apache.struts2.portlet.context.ServletContextHolderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.exoplatform.services.portletcontainer.impl.servlet.PortletApplicationListener
</listener-class>
</listener>
<servlet>
<servlet-name>preparator</servlet-name>
<servlet-class>
org.apache.struts2.portlet.context.PreparatorServlet
</servlet-class>
</servlet>
<servlet>
<servlet-name>dwr</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>PortletWrapper</servlet-name>
<servlet-class>
org.exoplatform.services.portletcontainer.impl.servlet.ServletWrapper
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>PortletWrapper</servlet-name>
<url-pattern>/PortletWrapper</url-pattern>
</servlet-mapping>
</web-app>
@@ -0,0 +1,2 @@
Put the empty 'struts-portlet' file in the $CATALINA_HOME/webapps/gridsphere/WEB-INF/CustomPortal/portlets
folder of your Gridsphere installation. You will need to add the gridsphere-ui-tags-2.1.2.jar to your project.
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app-collection>
<portlet-app-def>
<portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet">
<portlet-name>JSR Portlet Servlet</portlet-name>
<servlet-name>PortletServlet</servlet-name>
</portlet-app>
<concrete-portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet.1">
<concrete-portlet>
<portlet-name>Portlet Servlet</portlet-name>
<default-locale>en</default-locale>
<language locale="en">
<title>Portlet Servlet</title>
<title-short>Portlet Servlet</title-short>
<description>A JSR Portlet Loader</description>
<keywords>portlet servlet</keywords>
</language>
</concrete-portlet>
</concrete-portlet-app>
</portlet-app-def>
</portlet-app-collection>

Some files were not shown because too many files have changed in this diff Show More