1+ /*
2+ * Copyright 2016 Google Inc. All Rights Reserved.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117package com .google .appengine .demos ;
218
319import java .io .IOException ;
1329public class DumpServlet extends HttpServlet {
1430
1531 @ Override
16- protected void doGet (HttpServletRequest request ,
17- HttpServletResponse response ) throws ServletException ,
18- IOException {
32+ protected void doGet (HttpServletRequest request , HttpServletResponse response )
33+ throws ServletException , IOException {
1934 response .setContentType ("text/html" );
2035 response .setStatus (HttpServletResponse .SC_OK );
2136
@@ -28,19 +43,42 @@ protected void doGet(HttpServletRequest request,
2843 out .printf ("getServletContextName=%s%n" , getServletContext ().getServletContextName ());
2944 out .printf ("virtualServerName=%s%n" , getServletContext ().getVirtualServerName ());
3045 out .printf ("contextPath=%s%n" , getServletContext ().getContextPath ());
31- out .printf ("version=%d.%d%n" , getServletContext ().getMajorVersion (), getServletContext ().getMinorVersion ());
32- out .printf ("effectiveVersion=%d.%d%n" , getServletContext ().getEffectiveMajorVersion (), getServletContext ().getEffectiveMinorVersion ());
46+ out .printf (
47+ "version=%d.%d%n" ,
48+ getServletContext ().getMajorVersion (),
49+ getServletContext ().getMinorVersion ());
50+ out .printf (
51+ "effectiveVersion=%d.%d%n" ,
52+ getServletContext ().getEffectiveMajorVersion (),
53+ getServletContext ().getEffectiveMinorVersion ());
3354 out .println ("</pre>" );
3455 out .println ("<h2>Request Fields:</h2>" );
3556 out .println ("<pre>" );
36- out .printf ("remoteHost/Addr:port=%s/%s:%d%n" , request .getRemoteHost (), request .getRemoteAddr (), request .getRemotePort ());
37- out .printf ("localName/Addr:port=%s/%s:%d%n" , request .getLocalName (), request .getLocalAddr (), request .getLocalPort ());
38- out .printf ("scheme=%s method=%s protocol=%s%n" , request .getScheme (), request .getMethod (), request .getProtocol ());
57+ out .printf (
58+ "remoteHost/Addr:port=%s/%s:%d%n" ,
59+ request .getRemoteHost (),
60+ request .getRemoteAddr (),
61+ request .getRemotePort ());
62+ out .printf (
63+ "localName/Addr:port=%s/%s:%d%n" ,
64+ request .getLocalName (),
65+ request .getLocalAddr (),
66+ request .getLocalPort ());
67+ out .printf (
68+ "scheme=%s method=%s protocol=%s%n" ,
69+ request .getScheme (),
70+ request .getMethod (),
71+ request .getProtocol ());
3972 out .printf ("serverName:serverPort=%s:%d%n" , request .getServerName (), request .getServerPort ());
4073 out .printf ("requestURI=%s%n" , request .getRequestURI ());
4174 out .printf ("requestURL=%s%n" , request .getRequestURL ().toString ());
42- out .printf ("contextPath|servletPath|pathInfo=%s|%s|%s%n" , request .getContextPath (), request .getServletPath (), request .getPathInfo ());
43- out .printf ("session/new=%s/%b%n" , request .getSession (true ).getId (), request .getSession ().isNew ());
75+ out .printf (
76+ "contextPath|servletPath|pathInfo=%s|%s|%s%n" ,
77+ request .getContextPath (),
78+ request .getServletPath (),
79+ request .getPathInfo ());
80+ out .printf (
81+ "session/new=%s/%b%n" , request .getSession (true ).getId (), request .getSession ().isNew ());
4482 out .println ("</pre>" );
4583 out .println ("<h2>Request Headers:</h2>" );
4684 out .println ("<pre>" );
0 commit comments