summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMohamed Abdelnour <mohamed.k.abdelnour@gmail.com>2021-05-29 02:27:30 +0200
committerDavid Peter <sharkdp@users.noreply.github.com>2021-06-01 22:36:56 +0200
commit64cbfbed470926c7ed18521da3081797d1b7633d (patch)
tree6cb5cacabf7a2092cd4d4153df30281bf774b18a /tests
parent1ced35ec760f4635156c56ba7d8a3a47bc7158a2 (diff)
Add Java Server Page (JSP) syntax test file
Diffstat (limited to 'tests')
-rw-r--r--tests/syntax-tests/highlighted/Java Server Page (JSP)/sessionDetail.jsp197
-rw-r--r--tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md1141
-rw-r--r--tests/syntax-tests/source/Java Server Page (JSP)/NOTICE68
-rw-r--r--tests/syntax-tests/source/Java Server Page (JSP)/sessionDetail.jsp197
4 files changed, 1603 insertions, 0 deletions
diff --git a/tests/syntax-tests/highlighted/Java Server Page (JSP)/sessionDetail.jsp b/tests/syntax-tests/highlighted/Java Server Page (JSP)/sessionDetail.jsp
new file mode 100644
index 00000000..2ac59da1
--- /dev/null
+++ b/tests/syntax-tests/highlighted/Java Server Page (JSP)/sessionDetail.jsp
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<%@page session="false" contentType="text/html; charset=ISO-8859-1" %>
+<%@page import="java.util.Enumeration" %>
+<%@page import="jakarta.servlet.http.HttpSession" %>
+<%@page import="org.apache.catalina.Session" %>
+<%@page import="org.apache.catalina.manager.JspHelper" %>
+<%@page import="org.apache.catalina.util.ContextName" %>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%--!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"--%>
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<% String path = (String) request.getAttribute("path");
+ String version = (String) request.getAttribute("version");
+ ContextName cn = new ContextName(path, version);
+ Session currentSession = (Session)request.getAttribute("currentSession");
+ String currentSessionId = null;
+ HttpSession currentHttpSession = null;
+ if (currentSession != null) {
+ currentHttpSession = currentSession.getSession();
+ currentSessionId = JspHelper.escapeXml(currentSession.getId());
+ } else {
+ currentSessionId = "Session invalidated";
+ }
+ String submitUrl = JspHelper.escapeXml(response.encodeURL(
+ ((HttpServletRequest) pageContext.getRequest()).getRequestURI() +
+ "?path=" + path + "&version=" + version));
+%>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
+ <meta http-equiv="pragma" content="no-cache"/><!-- HTTP 1.0 -->
+ <meta http-equiv="cache-control" content="no-cache,must-revalidate"/><!-- HTTP 1.1 -->
+ <meta http-equiv="expires" content="0"/><!-- 0 is an invalid value and should be treated as 'now' -->
+ <meta http-equiv="content-language" content="en"/>
+ <meta name="author" content="Cedrik LIME"/>
+ <meta name="copyright" content="copyright 2005-2021 the Apache Software Foundation"/>
+ <meta name="robots" content="noindex,nofollow,noarchive"/>
+ <title>Sessions Administration: details for <%= currentSessionId %></title>
+</head>
+<body>
+<% if (currentHttpSession == null) { %>
+ <h1><%=currentSessionId%></h1>
+<% } else { %>
+ <h1>Details for Session <%= currentSessionId %></h1>
+
+ <table style="text-align: left;" border="0">
+ <tr>
+ <th>Session Id</th>
+ <td><%= currentSessionId %></td>
+ </tr>
+ <tr>
+ <th>Guessed Locale</th>
+ <td><%= JspHelper.guessDisplayLocaleFromSession(currentSession) %></td>
+ </tr>
+ <tr>
+ <th>Guessed User</th>
+ <td><%= JspHelper.guessDisplayUserFromSession(currentSession) %></td>
+ </tr>
+ <tr>
+ <th>Creation Time</th>
+ <td><%= JspHelper.getDisplayCreationTimeForSession(currentSession) %></td>
+ </tr>
+ <tr>
+ <th>Last Accessed Time</th>
+ <td><%= JspHelper.getDisplayLastAccessedTimeForSession(currentSession) %></td>
+ </tr>
+ <tr>
+ <th>Session Max Inactive Interval</th>
+ <td><%= JspHelper.secondsToTimeString(currentSession.getMaxInactiveInterval()) %></td>
+ </tr>
+ <tr>
+ <th>Used Time</th>
+ <td><%= JspHelper.getDisplayUsedTimeForSession(currentSession) %></td>
+ </tr>
+ <tr>
+ <th>Inactive Time</th>
+ <td><%= JspHelper.getDisplayInactiveTimeForSession(currentSession) %></td>
+ </tr>
+ <tr>
+ <th>TTL</th>
+ <td><%= JspHelper.getDisplayTTLForSession(currentSession) %></td>
+ </tr>
+ </table>
+
+ <form method="post" action="<%= submitUrl %>">
+ <div>
+ <input type="hidden" name="sessionId" value="<%= currentSessionId %>" />
+ <input type="hidden" name="action" value="sessionDetail" />
+ <%
+ if ("Primary".equals(request.getParameter("sessionType"))) {
+ %>
+ <input type="hidden" name="sessionType" value="Primary" />
+ <%
+ }
+ %> <input type="submit" value="Refresh" />
+ </div>
+ </form>
+
+ <div class="error"><%= JspHelper.escapeXml(request.getAttribute("error")) %></div>
+ <div class="message"><%= JspHelper.escapeXml(request.getAttribute("message")) %></div>
+
+ <table style="text-align: left;" border="1" cellpadding="2" cellspacing="2">
+ <% int nAttributes = 0;
+ Enumeration<String> attributeNamesEnumeration = currentHttpSession.getAttributeNames();
+ while (attributeNamesEnumeration.hasMoreElements()) {
+ attributeNamesEnumeration.nextElement();
+ ++nAttributes;
+ }
+ %>
+ <caption style="font-variant: small-caps;"><%= JspHelper.formatNumber(nAttributes) %> attributes</caption>
+ <thead>
+ <tr>
+ <th>Remove Attribute</th>
+ <th>Attribute name</th>
+ <th>Attribute value</th>
+ </tr>
+ </thead>
+ <%--tfoot>
+ <tr>
+ <td colspan="3" style="text-align: center;">
+ TODO: set Max Inactive Interval on sessions
+ </td>
+ </tr>
+ </tfoot--%>
+ <tbody>
+ <% attributeNamesEnumeration = currentHttpSession.getAttributeNames();
+ while (attributeNamesEnumeration.hasMoreElements()) {
+ String attributeName = attributeNamesEnumeration.nextElement();
+ %>
+ <tr>
+ <td align="center">
+ <form method="post" action="<%= submitUrl %>">
+ <div>
+ <input type="hidden" name="action" value="removeSessionAttribute" />
+ <input type="hidden" name="sessionId" value="<%= currentSessionId %>" />
+ <input type="hidden" name="attributeName" value="<%= JspHelper.escapeXml(attributeName) %>" />
+ <%
+ if ("Primary".equals(request.getParameter("sessionType"))) {
+ %>
+ <input type="submit" value="Remove" />
+ <input type="hidden" name="sessionType" value="Primary" />
+ <%
+ } else {
+ out.print("Primary sessions only");
+ }
+ %>
+ </div>
+ </form>
+ </td>
+ <td><%= JspHelper.escapeXml(attributeName) %></td>
+ <td><% Object attributeValue = currentHttpSession.getAttribute(attributeName); %><span title="<%= attributeValue == null ? "" : attributeValue.getClass().toString() %>"><%= JspHelper.escapeXml(attributeValue) %></span></td>
+ </tr>
+ <% } // end while %>
+ </tbody>
+ </table>
+<% } // endif%>
+
+<form method="post" action="<%=submitUrl%>">
+ <p style="text-align: center;">
+ <input type="submit" value="Return to session list" />
+ </p>
+</form>
+
+<%--div style="display: none;">
+<p>
+ <a href="http://validator.w3.org/check?uri=referer"><img
+ src="http://www.w3.org/Icons/valid-html401"
+ alt="Valid HTML 4.01!" height="31" width="88"></a>
+ <a href="http://validator.w3.org/check?uri=referer"><img
+ src="http://www.w3.org/Icons/valid-xhtml10"
+ alt="Valid XHTML 1.0!" height="31" width="88" /></a>
+ <a href="http://validator.w3.org/check?uri=referer"><img
+ src="http://www.w3.org/Icons/valid-xhtml11"
+ alt="Valid XHTML 1.1!" height="31" width="88" /></a>
+</p>
+</div--%>
+
+</body>
+</html>
diff --git a/tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md b/tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md
new file mode 100644
index 00000000..cb4f7f5d
--- /dev/null
+++ b/tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md
@@ -0,0 +1,1141 @@
+The `sessionDetail.jsp` file has been added from https://github.com/apache/tomcat under the following license:
+
+```text
+
+ 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 on