You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/06/26 17:01:06 UTC
[tomcat] 03/04: Align examples web application with 9.0.x
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 51e55b4e53dc1a3f4f47609439bdb1ffd6f863de
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 26 17:56:33 2019 +0100
Align examples web application with 9.0.x
Code clean-up and remove unused code
---
.../WEB-INF/classes/LocalStrings_en.properties | 48 ---------------------
.../WEB-INF/classes/LocalStrings_es.properties | 2 +-
.../WEB-INF/classes/LocalStrings_fr.properties | 18 ++++----
.../CompressionServletResponseWrapper.java | 15 ++-----
.../jsp2/examples/simpletag/EchoAttributesTag.java | 5 ++-
.../examples/WEB-INF/classes/util/HTMLFilter.java | 5 +--
.../WEB-INF/classes/validators/DebugValidator.java | 2 +-
.../WEB-INF/classes/websocket/drawboard/Room.java | 4 +-
webapps/examples/WEB-INF/web.xml | 4 +-
webapps/examples/jsp/images/read.gif | Bin 1125 -> 0 bytes
webapps/examples/jsp/index.html | 1 -
webapps/examples/servlets/index.html | 1 -
12 files changed, 24 insertions(+), 81 deletions(-)
diff --git a/webapps/examples/WEB-INF/classes/LocalStrings_en.properties b/webapps/examples/WEB-INF/classes/LocalStrings_en.properties
deleted file mode 100644
index 2791a66..0000000
--- a/webapps/examples/WEB-INF/classes/LocalStrings_en.properties
+++ /dev/null
@@ -1,48 +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.
-
-cookies.cookies=Your browser is sending the following cookies:
-cookies.make-cookie=Create a cookie to send to your browser
-cookies.name=Name:
-cookies.no-cookies=Your browser isn't sending any cookies
-cookies.set=You just sent the following cookie to your browser:
-cookies.title=Cookies Example
-cookies.value=Value:
-
-helloworld.title=Hello World!
-
-requestheader.title=Request Header Example
-
-requestinfo.label.method=Method:
-requestinfo.label.pathinfo=Path Info:
-requestinfo.label.protocol=Protocol:
-requestinfo.label.remoteaddr=Remote Address:
-requestinfo.label.requesturi=Request URI:
-requestinfo.title=Request Information Example
-
-requestparams.firstname=First Name:
-requestparams.lastname=Last Name:
-requestparams.no-params=No Parameters, Please enter some
-requestparams.params-in-req=Parameters in this request:
-requestparams.title=Request Parameters Example
-
-sessions.adddata=Add data to your session
-sessions.created=Created:
-sessions.data=The following data is in your session:
-sessions.dataname=Name of Session Attribute:
-sessions.datavalue=Value of Session Attribute:
-sessions.id=Session ID:
-sessions.lastaccessed=Last Accessed:
-sessions.title=Sessions Example
diff --git a/webapps/examples/WEB-INF/classes/LocalStrings_es.properties b/webapps/examples/WEB-INF/classes/LocalStrings_es.properties
index 60a410e..eaac59a 100644
--- a/webapps/examples/WEB-INF/classes/LocalStrings_es.properties
+++ b/webapps/examples/WEB-INF/classes/LocalStrings_es.properties
@@ -36,7 +36,7 @@ requestparams.firstname=Nombre:
requestparams.lastname=Apellidos:
requestparams.no-params=No hay párametro. Por favor, usa alguno
requestparams.params-in-req=Parámetros en este Request:
-requestparams.title=Ejemplo de parámetros de Requerimiento:
+requestparams.title=Ejemplo de solicitud con parámetros:
sessions.adddata=Añade datos a tu sesión:
sessions.created=Creado:
diff --git a/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties b/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties
index 5ba2475..5ed4042 100644
--- a/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties
+++ b/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties
@@ -14,35 +14,35 @@
# limitations under the License.
cookies.cookies=Votre navigateur retourne les cookies suivant:
-cookies.make-cookie=Création d''un cookie à retourner à votre navigateur
+cookies.make-cookie=Création d'un cookie à retourner à votre navigateur
cookies.name=Nom:
cookies.no-cookies=Votre navigateur ne retourne aucun cookie
-cookies.set=Vous venez d''envoyer le cookie suivant à votre navigateur:
-cookies.title=Exemple d''utilisation de Cookies
+cookies.set=Vous venez d'envoyer le cookie suivant à votre navigateur:
+cookies.title=Exemple d'utilisation de Cookies
cookies.value=Valeur:
helloworld.title=Salut le Monde!
-requestheader.title=Exemple d''information sur les entête de requête
+requestheader.title=Exemple d'information sur les entêtes de requête
requestinfo.label.method=Méthode:
requestinfo.label.pathinfo=Info de chemin:
requestinfo.label.protocol=Protocole:
requestinfo.label.remoteaddr=Adresse distante:
requestinfo.label.requesturi=URI de requête:
-requestinfo.title=Exemple d''information sur la requête
+requestinfo.title=Exemple d'information sur la requête
requestparams.firstname=Prénom:
requestparams.lastname=Nom:
-requestparams.no-params=Pas de paramêtre, merci dans saisir quelqu'uns
+requestparams.no-params=Pas de paramêtre, merci d'en saisir quelques-uns
requestparams.params-in-req=Paramêtres dans la requête:
-requestparams.title=Exemple de requête avec paramêtres
+requestparams.title=Exemple de requête avec paramètres
sessions.adddata=Ajouter des données à votre session
sessions.created=Crée le:
sessions.data=Les données existantes dans votre session:
-sessions.dataname=Nom de l''Attribut de Session:
-sessions.datavalue=Valeur de l''Attribut de Session:
+sessions.dataname=Nom de l'Attribut de Session:
+sessions.datavalue=Valeur de l'Attribut de Session:
sessions.id=ID de Session:
sessions.lastaccessed=Dernier accès:
sessions.title=Exemple de Sessions
diff --git a/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java b/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java
index 60413c5..e12859d 100644
--- a/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java
+++ b/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java
@@ -229,8 +229,7 @@ public class CompressionServletResponseWrapper
System.out.println("stream is set to "+stream+" in getOutputStream");
}
- return (stream);
-
+ return stream;
}
/**
@@ -244,7 +243,7 @@ public class CompressionServletResponseWrapper
public PrintWriter getWriter() throws IOException {
if (writer != null)
- return (writer);
+ return writer;
if (stream != null)
throw new IllegalStateException("getOutputStream() has already been called for this response");
@@ -257,15 +256,9 @@ public class CompressionServletResponseWrapper
if (debug > 1) {
System.out.println("character encoding is " + charEnc);
}
- // HttpServletResponse.getCharacterEncoding() shouldn't return null
- // according the spec, so feel free to remove that "if"
- if (charEnc != null) {
- writer = new PrintWriter(new OutputStreamWriter(stream, charEnc));
- } else {
- writer = new PrintWriter(stream);
- }
+ writer = new PrintWriter(new OutputStreamWriter(stream, charEnc));
- return (writer);
+ return writer;
}
@Override
diff --git a/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java b/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
index 8cdd48c..c34237d 100644
--- a/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
+++ b/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
@@ -20,6 +20,7 @@ package jsp2.examples.simpletag;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.List;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
@@ -33,8 +34,8 @@ public class EchoAttributesTag
extends SimpleTagSupport
implements DynamicAttributes
{
- private final ArrayList<String> keys = new ArrayList<>();
- private final ArrayList<Object> values = new ArrayList<>();
+ private final List<String> keys = new ArrayList<>();
+ private final List<Object> values = new ArrayList<>();
@Override
public void doTag() throws JspException, IOException {
diff --git a/webapps/examples/WEB-INF/classes/util/HTMLFilter.java b/webapps/examples/WEB-INF/classes/util/HTMLFilter.java
index 9bc8cff..29463fb 100644
--- a/webapps/examples/WEB-INF/classes/util/HTMLFilter.java
+++ b/webapps/examples/WEB-INF/classes/util/HTMLFilter.java
@@ -37,7 +37,7 @@ public final class HTMLFilter {
public static String filter(String message) {
if (message == null)
- return (null);
+ return null;
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
@@ -60,8 +60,7 @@ public final class HTMLFilter {
result.append(content[i]);
}
}
- return (result.toString());
-
+ return result.toString();
}
diff --git a/webapps/examples/WEB-INF/classes/validators/DebugValidator.java b/webapps/examples/WEB-INF/classes/validators/DebugValidator.java
index d0ac758..596065b 100644
--- a/webapps/examples/WEB-INF/classes/validators/DebugValidator.java
+++ b/webapps/examples/WEB-INF/classes/validators/DebugValidator.java
@@ -76,7 +76,7 @@ public class DebugValidator extends TagLibraryValidator {
}
System.out.println();
System.out.println("-----------------------------------------------");
- return (null);
+ return null;
}
diff --git a/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java b/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
index 558273f..1d839fc 100644
--- a/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
+++ b/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
@@ -52,7 +52,7 @@ public final class Room {
* The number (single char) will be prefixed to the string when sending
* the message.
*/
- public static enum MessageType {
+ public enum MessageType {
/**
* '0': Error: contains error message.
*/
@@ -409,7 +409,7 @@ public final class Room {
* Note: This means a player object is actually a join between Room and
* Client.
*/
- public final class Player {
+ public static final class Player {
/**
* The room to which this player belongs.
diff --git a/webapps/examples/WEB-INF/web.xml b/webapps/examples/WEB-INF/web.xml
index e1b6e25..ac4840e 100644
--- a/webapps/examples/WEB-INF/web.xml
+++ b/webapps/examples/WEB-INF/web.xml
@@ -230,7 +230,7 @@
</jsp-property-group>
</jsp-config>
- <security-constraint>
+ <security-constraint>
<display-name>Example Security Constraint - part 1</display-name>
<web-resource-collection>
<web-resource-name>Protected Area - Allow methods</web-resource-name>
@@ -249,7 +249,7 @@
<role-name>role1</role-name>
</auth-constraint>
</security-constraint>
- <security-constraint>
+ <security-constraint>
<display-name>Example Security Constraint - part 2</display-name>
<web-resource-collection>
<web-resource-name>Protected Area - Deny methods</web-resource-name>
diff --git a/webapps/examples/jsp/images/read.gif b/webapps/examples/jsp/images/read.gif
deleted file mode 100644
index 66cb4e9..0000000
Binary files a/webapps/examples/jsp/images/read.gif and /dev/null differ
diff --git a/webapps/examples/jsp/index.html b/webapps/examples/jsp/index.html
index f61d5bf..977ed04 100644
--- a/webapps/examples/jsp/index.html
+++ b/webapps/examples/jsp/index.html
@@ -41,7 +41,6 @@ help:</p>
<ul style="list-style-type: none; padding-left: 0;">
<li><img src="images/execute.gif" alt=""> Execute the example</li>
<li><img src="images/code.gif" alt=""> Look at the source code for the example</li>
-<!-- <li><img src="images/read.gif" alt=""> Read more about this feature</li> -->
<li><img src="images/return.gif" alt=""> Return to this screen</li>
</ul>
diff --git a/webapps/examples/servlets/index.html b/webapps/examples/servlets/index.html
index 7299d2c..94931d4 100644
--- a/webapps/examples/servlets/index.html
+++ b/webapps/examples/servlets/index.html
@@ -43,7 +43,6 @@ help:</p>
<ul style="list-style-type: none; padding-left: 0;">
<li><img src="images/execute.gif" alt=""> Execute the example</li>
<li><img src="images/code.gif" alt=""> Look at the source code for the example</li>
-<!-- <li><img src="images/read.gif" alt=""> Read more about this feature</li> -->
<li><img src="images/return.gif" alt=""> Return to this screen</li>
</ul>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org