litesoft
@ 961
litesoft / trunk / DeviceDesktopTest / src / org / litesoft / html / ClientForwardServlet.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package org.litesoft.html; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class ClientForwardServlet extends HttpServlet { public static final String FRONT = "<!DOCTYPE html><html>\n<head>\n<meta charset='UTF-8'/>\n</head>\n<body>\n"; public static final String END = "\n</body>\n</html>"; private final String mReplaceData; private ClientForwardServlet( String pNewProtocol, String pNewPort ) { mReplaceData = pNewProtocol + "|" + pNewPort; } public ClientForwardServlet( String pNewProtocol ) { this( pNewProtocol, "" ); } public ClientForwardServlet( int pNewPort ) { this( "", Integer.toString( pNewPort ) ); } @Override protected void doGet( HttpServletRequest pRequest, HttpServletResponse pResponse ) throws ServletException, IOException { String zPath = pRequest.getPathInfo(); if ( zPath == null ) { zPath = "/"; } if ( zPath.endsWith( "/" ) ) { zPath += "index.html"; } if ( !zPath.endsWith( ".html" ) ) { System.out.println( "Can't Forward: " + zPath ); pResponse.sendError( HttpServletResponse.SC_NOT_FOUND ); return; } CacheHeaders.forever( pResponse ); pResponse.setContentType( "text/html" ); pResponse.getWriter().println( FRONT + mReplaceData + END ); } } |
Commits for litesoft/trunk/DeviceDesktopTest/src/org/litesoft/html/ClientForwardServlet.java
Revision | Author | Commited | Message |
---|---|---|---|
961 Diff | GeorgeS | Fri 01 Aug, 2014 03:13:31 +0000 | Externalization Work. |
935 Diff | GeorgeS | Fri 30 May, 2014 20:28:08 +0000 | Reformatted. |
927 Diff | GeorgeS | Mon 17 Mar, 2014 03:58:40 +0000 | Template system and index.html as a resource... |
924 Diff | GeorgeS | Fri 14 Mar, 2014 22:02:56 +0000 | Drop IWS |
923 Diff | GeorgeS | Fri 21 Feb, 2014 00:03:57 +0000 | Multi-Port Jetty |
922 Diff | GeorgeS | Tue 18 Feb, 2014 16:18:01 +0000 | Mini App ready for packaging... |
920 | GeorgeS | Sun 16 Feb, 2014 19:06:51 +0000 | DDT w/ Jetty |