Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
csrster committed Oct 10, 2016
1 parent 3c929ea commit ec62624
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 506 deletions.
Expand Up @@ -113,19 +113,17 @@ public GUIWebServer() {
//set the port on which tomcat should run
server.setPort(port);
boolean taglibsScanningDisabled = false;

if (System.getProperty(Constants.SKIP_JARS_PROPERTY) == null) {
log.info("Scanning for taglibs is disabled as " + Constants.SKIP_JARS_PROPERTY + " is unset."); // Only log this once for all contexts
taglibsScanningDisabled = true;
}

//add webapps to tomcat
for (int i = 0; i < webApps.length; i++) {

//add webapps to tomcat
for (String webappFilename: webApps) {
// Construct webbase from the name of the webapp.
// (1) If the webapp is webpages/History, the webbase is /History
// (2) If the webapp is webpages/History.war, the webbase is /History
String webappFilename = new File(webApps[i]).getName();
String webbase = "/" + webappFilename;
final String warSuffix = ".war";
if (webappFilename.toLowerCase().endsWith(warSuffix)) {
Expand All @@ -141,25 +139,25 @@ public GUIWebServer() {

try {
//add the jar file to tomcat
String warfile = new File(basedir, webApps[i]).getAbsolutePath();
String warfile = new File(basedir, webappFilename).getAbsolutePath();
StandardContext ctx = (StandardContext) server.addWebapp(webbase, warfile);
if (taglibsScanningDisabled) {
StandardJarScanFilter jarScanFilter = (StandardJarScanFilter) ctx.getJarScanner().getJarScanFilter();
// Disable scanning for taglibs
jarScanFilter.setTldSkip("*");
}
if (i==0) {
if (webappFilename.equals(webApps[0])) {
//Re-add the 1st context as also the root context
StandardContext rootCtx = (StandardContext) server.addWebapp("/", warfile);
if (taglibsScanningDisabled) {
StandardJarScanFilter jarScanFilter = (StandardJarScanFilter) rootCtx.getJarScanner().getJarScanFilter();
StandardJarScanFilter jarScanFilter = (StandardJarScanFilter) rootCtx.getJarScanner().getJarScanFilter();
// Disable scanning for taglibs
jarScanFilter.setTldSkip("*");
}
}
}
catch (ServletException e) {
log.error("Unable to add webapp " + webApps[i], e);
log.error("Unable to add webapp " + webappFilename, e);
}
}
}
Expand All @@ -171,7 +169,6 @@ public GUIWebServer() {
* @return the instance
*/
public static synchronized GUIWebServer getInstance() {
log.debug("Inside getInstance");
if (instance == null) {
instance = new GUIWebServer();
instance.startServer();
Expand Down
Expand Up @@ -58,8 +58,8 @@
*/
public class HTMLUtils {
/** Date format for FMT timestamps */
private static final SimpleDateFormat DATE_FMT =
new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
private static final String DATE_FMT_STRING = "yyyy/MM/dd HH:mm:ss";


/** Web page title placeholder. */
private static String TITLE_PLACEHOLDER = "STRING_1";
Expand Down Expand Up @@ -913,6 +913,7 @@ public static Long parseLong(Locale loc, String paramValue, String parameterName
* @return the String value found in the timestamp
*/
public static String parseDate(Date timestamp) {
return timestamp != null ? DATE_FMT.format(timestamp) : "-";
SimpleDateFormat fmt = new SimpleDateFormat(DATE_FMT_STRING);
return timestamp != null ? fmt.format(timestamp) : "-";
}
}

0 comments on commit ec62624

Please sign in to comment.