Example #1
0
 private String readFileHeader(String filename) {
   String value;
   try {
     value = WaarpStringUtils.readFileException(filename);
   } catch (InvalidArgumentException e) {
     logger.error("Error while trying to open: " + filename, e);
     return "";
   } catch (FileTransferException e) {
     logger.error("Error while trying to read: " + filename, e);
     return "";
   }
   StringBuilder builder = new StringBuilder(value);
   WaarpStringUtils.replace(
       builder,
       REPLACEMENT.XXXLOCALXXX.toString(),
       Integer.toString(Configuration.configuration.getLocalTransaction().getNumberLocalChannel())
           + " "
           + Thread.activeCount());
   WaarpStringUtils.replace(
       builder,
       REPLACEMENT.XXXNETWORKXXX.toString(),
       Integer.toString(
           Configuration.configuration.getLocalTransaction().getNumberLocalChannel()));
   WaarpStringUtils.replace(
       builder, REPLACEMENT.XXXHOSTIDXXX.toString(), Configuration.configuration.getHOST_ID());
   if (authentHttp.isAuthenticated()) {
     WaarpStringUtils.replace(
         builder,
         REPLACEMENT.XXXADMINXXX.toString(),
         Messages.getString("HttpSslHandler.1")); // $NON-NLS-1$
   } else {
     WaarpStringUtils.replace(
         builder,
         REPLACEMENT.XXXADMINXXX.toString(),
         Messages.getString("HttpSslHandler.0")); // $NON-NLS-1$
   }
   TrafficCounter trafficCounter =
       Configuration.configuration.getGlobalTrafficShapingHandler().trafficCounter();
   WaarpStringUtils.replace(
       builder,
       REPLACEMENT.XXXBANDWIDTHXXX.toString(),
       Messages.getString("HttpSslHandler.IN")
           + (trafficCounter.lastReadThroughput() >> 20)
           + //$NON-NLS-1$
           Messages.getString("HttpSslHandler.MOPS")
           + //$NON-NLS-1$
           Messages.getString("HttpSslHandler.OUT")
           + //$NON-NLS-1$
           (trafficCounter.lastWriteThroughput() >> 20)
           + Messages.getString("HttpSslHandler.MOPS")); // $NON-NLS-1$
   WaarpStringUtils.replace(builder, REPLACEMENT.XXXLANGXXX.toString(), lang);
   return builder.toString();
 }
Example #2
0
 private String index() {
   String index = REQUEST.index.readFileUnique(this);
   StringBuilder builder = new StringBuilder(index);
   WaarpStringUtils.replaceAll(
       builder, REPLACEMENT.XXXHOSTIDXXX.toString(), Configuration.configuration.getHOST_ID());
   WaarpStringUtils.replaceAll(
       builder, REPLACEMENT.XXXADMINXXX.toString(), "Administrator Connected");
   WaarpStringUtils.replace(builder, REPLACEMENT.XXXVERSIONXXX.toString(), Version.ID);
   return builder.toString();
 }