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