Subversion Repository Public Repository

litesoft

Diff Revisions 960 vs 961 for /trunk/DeviceDesktopTest/src/org/litesoft/html/ClientForwardServlet.java

Diff revisions: vs.
  @@ -4,43 +4,35 @@
4 4 import javax.servlet.http.*;
5 5 import java.io.*;
6 6
7 - public class ClientForwardServlet extends HttpServlet
8 - {
7 + public class ClientForwardServlet extends HttpServlet {
9 8 public static final String FRONT = "<!DOCTYPE html><html>\n<head>\n<meta charset='UTF-8'/>\n</head>\n<body>\n";
10 9 public static final String END = "\n</body>\n</html>";
11 10
12 11 private final String mReplaceData;
13 12
14 - private ClientForwardServlet( String pNewProtocol, String pNewPort )
15 - {
13 + private ClientForwardServlet( String pNewProtocol, String pNewPort ) {
16 14 mReplaceData = pNewProtocol + "|" + pNewPort;
17 15 }
18 16
19 - public ClientForwardServlet( String pNewProtocol )
20 - {
17 + public ClientForwardServlet( String pNewProtocol ) {
21 18 this( pNewProtocol, "" );
22 19 }
23 20
24 - public ClientForwardServlet( int pNewPort )
25 - {
21 + public ClientForwardServlet( int pNewPort ) {
26 22 this( "", Integer.toString( pNewPort ) );
27 23 }
28 24
29 25 @Override
30 26 protected void doGet( HttpServletRequest pRequest, HttpServletResponse pResponse )
31 - throws ServletException, IOException
32 - {
27 + throws ServletException, IOException {
33 28 String zPath = pRequest.getPathInfo();
34 - if ( zPath == null )
35 - {
29 + if ( zPath == null ) {
36 30 zPath = "/";
37 31 }
38 - if ( zPath.endsWith( "/" ) )
39 - {
32 + if ( zPath.endsWith( "/" ) ) {
40 33 zPath += "index.html";
41 34 }
42 - if ( !zPath.endsWith( ".html" ) )
43 - {
35 + if ( !zPath.endsWith( ".html" ) ) {
44 36 System.out.println( "Can't Forward: " + zPath );
45 37 pResponse.sendError( HttpServletResponse.SC_NOT_FOUND );
46 38 return;