Esempio n. 1
0
 /*
  * MappingResultのOptionに従ってVelocityHandlerに処理を任せる 1)"velocityUse"がfalse以外
  * 2)"velocityExtentions"と拡張子が一致する TODO mapping.setOption(key, value)を使って最適化
  */
 private boolean isVelocityUse(MappingResult mapping, String path) {
   if (path == null) {
     return false;
   }
   String velocityUse = (String) mapping.getOption(MappingResult.PARAMETER_VELOCITY_USE);
   if ("false".equalsIgnoreCase(velocityUse)) {
     return false;
   }
   if (path.endsWith("ph-loader.js")) { // 特別扱い
     setRequestAttribute(ATTRIBUTE_RESPONSE_CONTENT_TYPE, "application/javascript");
     return true;
   }
   String velocityExtentionsParam =
       (String) mapping.getOption(MappingResult.PARAMETER_VELOCITY_EXTENTIONS);
   String[] velocityExtentions = defaultVelocityExtentions;
   if (velocityExtentionsParam != null) {
     velocityExtentions = velocityExtentionsParam.split(",");
   }
   for (int i = 0; i < velocityExtentions.length; i++) {
     if (path.endsWith(velocityExtentions[i])) {
       return true;
     }
   }
   return false;
 }
Esempio n. 2
0
 private String[] getWelcomeFiles(MappingResult mapping) {
   String welcomFiles = (String) mapping.getOption(MappingResult.PARAMETER_FILE_WELCOME_FILES);
   if (welcomFiles == null) {
     return defaultWelcomeFiles;
   }
   return welcomFiles.split(",");
 }
Esempio n. 3
0
 private boolean isListing(MappingResult mapping) {
   Object listing = mapping.getOption(MappingResult.PARAMETER_FILE_LISTING);
   if (listing == null) {
     return defaultListing;
   }
   return Boolean.TRUE.toString().equalsIgnoreCase(listing.toString());
 }
Esempio n. 4
0
  public void startResponseReqBody() {
    MappingResult mapping = getRequestMapping();
    if (Boolean.TRUE.equals(mapping.getOption("replay"))) {
      ReplayHelper helper = Config.getConfig().getReplayHelper();
      //			ByteBuffer[] body=bodyPage.getBuffer();
      if (helper.doReplay(this, null)) {
        return; // replayできた,bodyは消費されている
      }
    }

    if (response()) {
      responseEnd(); // TODO必要ないと思う
      return;
    }
  }