Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame^] | 1 | <html><body><pre>
|
| 2 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
| 3 | <%@page contentType="text/html; charset=UTF-8" %>
|
| 4 | <html>
|
| 5 | <!--
|
| 6 | Licensed to the Apache Software Foundation (ASF) under one or more
|
| 7 | contributor license agreements. See the NOTICE file distributed with
|
| 8 | this work for additional information regarding copyright ownership.
|
| 9 | The ASF licenses this file to You under the Apache License, Version 2.0
|
| 10 | (the "License"); you may not use this file except in compliance with
|
| 11 | the License. You may obtain a copy of the License at
|
| 12 |
|
| 13 | http://www.apache.org/licenses/LICENSE-2.0
|
| 14 |
|
| 15 | Unless required by applicable law or agreed to in writing, software
|
| 16 | distributed under the License is distributed on an "AS IS" BASIS,
|
| 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 18 | See the License for the specific language governing permissions and
|
| 19 | limitations under the License.
|
| 20 | -->
|
| 21 | <head>
|
| 22 | <title>JSP Chat</title>
|
| 23 | </head>
|
| 24 |
|
| 25 | <body bgcolor="#FFFFFF">
|
| 26 |
|
| 27 | <form method="POST" action='chat' name="postForm">
|
| 28 | <input type="hidden" name="action" value="post">
|
| 29 | Message: <input type="text" name="message">
|
| 30 | <input type="submit">
|
| 31 | </form>
|
| 32 |
|
| 33 | <br>
|
| 34 | <%
|
| 35 | String serverName = request.getServerName();
|
| 36 | if ("localhost".equals(serverName)) {
|
| 37 | serverName = "127.0.0.1";
|
| 38 | } else if ("127.0.0.1".equals(serverName)) {
|
| 39 | serverName = "localhost";
|
| 40 | }
|
| 41 |
|
| 42 | String chatUrl = request.getScheme() + "://" + serverName + ":"
|
| 43 | + request.getServerPort() + request.getContextPath()
|
| 44 | + request.getServletPath();
|
| 45 |
|
| 46 | // strip "post.jsp" from the address
|
| 47 | chatUrl = chatUrl.substring(0, chatUrl.lastIndexOf("/") + 1);
|
| 48 | %>
|
| 49 | <a target="_blank" href="<%=chatUrl %>">Click to open a new chat window</a>
|
| 50 | <em>Note</em>: To avoid hitting the limit on the count of simultaneous
|
| 51 | connections to the same host, imposed by the
|
| 52 | <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4">HTTP specification</a>,
|
| 53 | the second chat window should be opened using a different URL, e.g. with
|
| 54 | an IP address instead of the host name.
|
| 55 | </body>
|
| 56 | </html>
|
| 57 | </pre></body></html>
|