001/* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016package org.opengion.hayabusa.taglib; 017 018import org.opengion.hayabusa.common.HybsSystem; 019import org.opengion.hayabusa.common.HybsSystemException; 020import org.opengion.fukurou.util.FileString; 021import org.opengion.fukurou.util.FileUtil; 022 023import org.opengion.fukurou.util.StringUtil ; 024import static org.opengion.fukurou.util.StringUtil.nval ; 025 026import java.io.File; 027import java.io.IOException; 028import java.util.List; 029 030/** 031 * 各種アクションを指定して、ファイル関連の操作をおこなうタグです。 032 * 033 * 各種アクション に応じた振る舞いを行います。 034 * 結果については、false の場合は、body 要素を表示して、終了します。 035 * これは、BODYにエラーメッセージを書いておくことを想定した作りになっています。 036 037 * 判定結果を反転したい場合は、notEquals 属性を使用してください。また、 038 * 結果に応じて、処理を止めたくない場合は、useStop 属性を false に指定することで、 039 * 後続処理を実行できます。 040 * 041 * [各種アクション] 042 * canRead 読み込めるかどうかを判定。 043 * canWrite 変更できるかどうか判定。 044 * createNewFile 空の新しいファイルを不可分 (atomic) に生成。(そのファイルがまだ存在しない場合だけ) 045 * delete ファイルまたはディレクトリを削除。 046 * renameTo ファイルまたはディレクトリ名を変更。 047 * exists ファイルが存在するかどうか判定。 048 * isDirectory ファイルがディレクトリであるかどうか判定。 049 * isFile ファイルが普通のファイルかどうか判定。 050 * isHidden ファイルが隠しファイルかどうか判定。 051 * mkdir ディレクトリを生成。 052 * mkdirs ディレクトリを複数生成。 053 * read ファイルを読み込んでjspWriterに出力 054 * existsLength ファイルサイズが0Byte以上のファイルが存在するかどうか判定。 055 * copy ファイルまたはディレクトリをコピー(file1 ⇒ file2 にコピー)。 056 * zip ファイルまたはディレクトリをZIPファイルに圧縮します。(file1⇒file2) 057 * 058 * @og.formSample 059 * ●形式:<og:file action="…" fileURL="…" >・・・</og:file> 060 * ●body:あり(EVAL_BODY_INCLUDE:BODYをインクルードし、{@XXXX} は解析しません) 061 * 062 * ●Tag定義: 063 * <og:file 064 * action ○【TAG】アクション(canRead,canWrite,createNewFile,delete,exists,isDirectory,isFile,isHidden,mkdir,mkdirs)を指定します(必須)。 065 * fileURL 【TAG】操作するファイルのディレクトリを指定します (初期値:FILE_URL[=filetemp/]) 066 * file1 【TAG】基準となるファイル名を指定します(コマンドの左辺のファイル名です) 067 * file2 【TAG】処理結果となるファイル名を指定します(コマンドの右辺のファイル名です) 068 * notEquals 【TAG】判定結果を反転させるかどうか[true/false]を指定します(初期値:false) 069 * useStop 【TAG】エラー時BODYを処理後に停止するかどうか[true/false]を指定します(初期値:true) 070 * encode 【TAG】ファイルを読み込む(action="READ")際のエンコードを指定します(初期値:OS依存文字コード) 071 * caseKey 【TAG】このタグ自体を利用するかどうかの条件キーを指定します(初期値:null) 5.7.7.2 (2014/06/20) 072 * caseVal 【TAG】このタグ自体を利用するかどうかの条件値を指定します(初期値:null) 5.7.7.2 (2014/06/20) 073 * caseNN 【TAG】指定の値が、null/ゼロ文字列 でない場合(Not Null=NN)は、このタグは使用されます(初期値:true) 5.7.7.2 (2014/06/20) 074 * caseNull 【TAG】指定の値が、null/ゼロ文字列 の場合は、このタグは使用されます(初期値:true) 5.7.7.2 (2014/06/20) 075 * debug 【TAG】デバッグ情報を出力するかどうか[true/false]を指定します(初期値:false) 076 * > ... Body ... 077 * </og:file> 078 * 079 * ●使用例 080 * ・ファイルの存在チェック→存在しなければエラーメッセージを表示。 081 * <og:file action="exists" fileURL="N:/CIR/" file1="{@USER.LKISB}/{@USER.LDNO1KAI}.cir/001.sht"> 082 * <og:message lbl="RKE_0157" comment="回路図が存在しません。" /> 083 * </og:file> 084 * 085 * ・N:/Filetemp/にユーザーディレクトリが存在しなければ作成。→失敗した場合エラーメッセージを表示。 086 * <og:file action="mkdir" fileURL="N:/Filetemp/{@USER.ID}" > 087 * <og:message comment="エラーが発生しました。システム管理者に連絡してください。" /> 088 * </og:file> 089 * 090 * ・N:/Filetemp/test.txt ファイルの削除。ファイルが存在しなくても処理を続ける。 091 * <og:file action="delete" fileURL="N:/Filetemp/" file1="test.txt" useStop="false" > 092 * <og:message comment="ファイルは存在しませんでした。" /> 093 * </og:file> 094 * 095 * @og.group その他部品 096 * 097 * @version 4.0 098 * @author Kazuhiko Hasegawa 099 * @since JDK5.0, 100 */ 101public class FileTag extends CommonTagSupport { 102 //* このプログラムのVERSION文字列を設定します。 {@value} */ 103 private static final String VERSION = "5.7.7.2 (2014/06/20)" ; 104 105 private static final long serialVersionUID = 577220140620L ; 106 107 /** action 引数に渡す事の出来る アクションコマンド 読み込めるかどうか {@value} */ 108 public static final String ACT_CANREAD = "canRead" ; 109 /** action 引数に渡す事の出来る アクションコマンド 変更できるかどうか {@value} */ 110 public static final String ACT_CANWRITE = "canWrite" ; 111 /** action 引数に渡す事の出来る アクションコマンド 空の新しいファイルを不可分 (atomic) に生成します (そのファイルがまだ存在しない場合だけ {@value} */ 112 public static final String ACT_CREATENEWFILE = "createNewFile" ; 113 /** action 引数に渡す事の出来る アクションコマンド ファイルまたはディレクトリを削除{@value} */ 114 public static final String ACT_DELETE = "delete" ; 115 /** action 引数に渡す事の出来る アクションコマンド ファイルが存在するかどうか {@value} */ 116 public static final String ACT_EXISTS = "exists" ; 117 /** action 引数に渡す事の出来る アクションコマンド ファイルがディレクトリであるかどうか{@value} */ 118 public static final String ACT_ISDIRECTORY = "isDirectory" ; 119 /** action 引数に渡す事の出来る アクションコマンド ファイルが普通のファイルかどうか{@value} */ 120 public static final String ACT_ISFILE = "isFile" ; 121 /** action 引数に渡す事の出来る アクションコマンド ファイルが隠しファイルかどうか {@value} */ 122 public static final String ACT_ISHIDDEN = "isHidden" ; 123 /** action 引数に渡す事の出来る アクションコマンド ディレクトリを生成します。 {@value} */ 124 public static final String ACT_MKDIR = "mkdir" ; 125 /** action 引数に渡す事の出来る アクションコマンド ディレクトリを生成します。 {@value} */ 126 public static final String ACT_MKDIRS = "mkdirs" ; 127 /** action 引数に渡す事の出来る アクションコマンド ファイル名を変更します。 {@value} */ 128 public static final String ACT_RENAMETO = "renameTo" ; // 3.5.6.5 (2004/08/09) 129 /** action 引数に渡す事の出来る アクションコマンド ファイルを読み込んで表示します。 {@value} */ 130 public static final String ACT_READ = "read" ; // 3.6.0.0 (2004/09/25) 131 /** action 引数に渡す事の出来る アクションコマンド ファイルサイズが0Byte以上のファイルが存在するかどうか判定。 {@value} */ 132 public static final String ACT_EXISTSLENGTH = "existsLength" ; // 3.8.5.2 (2006/05/31) 133 /** action 引数に渡す事の出来る アクションコマンド ファイルまたはディレクトリをコピーします。 {@value} */ 134 public static final String ACT_COPY = "copy" ; // 5.3.6.0 (2011/06/01) 135 /** action 引数に渡す事の出来る アクションコマンド ZIP圧縮します。 {@value} */ 136 public static final String ACT_ZIP = "zip" ; // 5.9.2.2 (2015/11/20) 137 138 /** action 引数に渡す事の出来る コマンド リスト */ 139 private static final String[] ACTION_LIST = new String[] { 140 ACT_CANREAD , ACT_CANWRITE , ACT_CREATENEWFILE , ACT_DELETE , ACT_EXISTS , ACT_ISDIRECTORY , 141 ACT_ISFILE , ACT_ISHIDDEN , ACT_MKDIR , ACT_MKDIRS , ACT_RENAMETO , ACT_READ , ACT_EXISTSLENGTH , ACT_COPY , ACT_ZIP }; 142 143 private String fileURL = HybsSystem.sys( "FILE_URL" ); 144 private String file1 = ""; 145 private String file2 = null; 146 private String action = null; 147 private boolean rtnCode = false; 148 149 private boolean notEquals = false; // 3.8.5.2 (2006/05/31) 判定結果を反転させて処理します。 150 private boolean useStop = true; // 3.8.5.2 (2006/05/31) エラー時BODYを処理後に停止(true)するかどうか 151 152 private String encode = null; // 5.1.9.0 (2010/08/01) READ時のエンコード指定 153 154 /** 155 * Taglibの開始タグが見つかったときに処理する doStartTag() を オーバーライドします。 156 * 157 * @og.rev 3.6.0.0 (2004/09/25) file オブジェクトの作成を actionExec 移動 158 * @og.rev 3.8.5.2 (2006/05/31) notEquals追加。 判定結果を反転させて処理します。 159 * @og.rev 5.7.7.2 (2014/06/20) caseKey,caseVal,caseNN,caseNull 属性を追加 160 * 161 * @return 後続処理の指示 162 */ 163 @Override 164 public int doStartTag() { 165 // 5.7.7.2 (2014/06/20) caseKey,caseVal,caseNN,caseNull 属性を追加 166 if( useTag() ) { 167 try { 168 rtnCode = notEquals ^ actionExec( action ); // 3.8.5.2 (2006/05/31) 排他的論理和(XOR) 169 } 170 catch( IOException ex ) { 171 String errMsg = "指定のアクションは実行できません。アクションエラー" 172 + HybsSystem.CR 173 + "action=[" + action + "] , " 174 + " fileURL=[" + fileURL + "]" 175 + " file1=[" + file1 + "]" 176 + " file2=[" + file2 + "]" ; 177 throw new HybsSystemException( errMsg,ex ); // 3.5.5.4 (2004/04/15) 引数の並び順変更 178 } 179 180 if( rtnCode ) { return SKIP_BODY ; } // Body を評価しない 181 else { return EVAL_BODY_INCLUDE ; } // Body インクルード( extends TagSupport 時) 182 } 183 184 return SKIP_BODY ; 185 } 186 187 /** 188 * Taglibの終了タグが見つかったときに処理する doEndTag() を オーバーライドします。 189 * 190 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応。release2() を doEndTag()で呼ぶ。 191 * @og.rev 3.8.5.2 (2006/05/31) useStop 追加。 エラー時BODYを処理後に停止(true)するかどうか 192 * @og.rev 5.7.7.2 (2014/06/20) caseKey,caseVal,caseNN,caseNull 属性を追加 193 * 194 * @return 後続処理の指示 195 */ 196 @Override 197 public int doEndTag() { 198 debugPrint(); // 4.0.0 (2005/02/28) 199 200 if( useTag() ) { 201 return ( useStop && !rtnCode ) ? SKIP_PAGE : EVAL_PAGE ; 202 } 203 204 return EVAL_PAGE ; 205 } 206 207 /** 208 * タグリブオブジェクトをリリースします。 209 * キャッシュされて再利用されるので、フィールドの初期設定を行います。 210 * 211 * @og.rev 2.0.0.4 (2002/09/27) カスタムタグの release() メソッドを、追加 212 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応。release2() を doEndTag()で呼ぶ。 213 * @og.rev 3.6.0.0 (2004/09/24) columns 、tableId 、file 削除 214 * @og.rev 3.8.5.2 (2006/05/31) notEquals 、useStop 追加 215 * @og.rev 5.1.9.0 (2010/08/01) READ時のエンコード指定 216 * 217 */ 218 @Override 219 protected void release2() { 220 super.release2(); 221 fileURL = HybsSystem.sys( "FILE_URL" ); 222 file1 = ""; 223 file2 = null; 224 action = null; 225 rtnCode = false; 226 notEquals = false; // 3.8.5.2 (2006/05/31) 判定結果を反転させて処理します。 227 useStop = true; // 3.8.5.2 (2006/05/31) エラー時BODYを処理後に停止(true)するかどうか 228 encode = null; // 5.1.9.0 (2010/08/01) READ時のエンコード指定 229 } 230 231 /** 232 * アクションを実行します。 233 * アクションは,指定のアクションコマンドに対応する処理を入力データに 234 * 対して行います。 235 * 236 * @og.rev 3.0.0.0 (2002/12/25) ACTION_LIST のチェックを削除 237 * @og.rev 3.6.0.0 (2004/09/25) ACT_read を追加 , file オブジェクトを移動 238 * @og.rev 3.8.5.2 (2006/05/31) existsLength 追加 239 * @og.rev 4.0.0.0 (2007/11/28) メソッドの戻り値をチェックします。 240 * @og.rev 5.1.9.0 (2010/08/01) READ時のエンコード指定 241 * @og.rev 5.3.6.0 (2011/06/01) ACT_copy 対応 242 * @og.rev 5.7.1.1 (2013/12/13) copy元(file1)のファイルが存在しなければ、エラーにします。 243 * @og.rev 5.9.2.2 (2015/11/12) ACT_ZIP追加 244 * 245 * @param action アクションコマンド(public static final 宣言されている文字列) 246 * 247 * @return 実行後のデータ 248 */ 249 private boolean actionExec( final String action ) throws IOException { 250 String directory = HybsSystem.url2dir( fileURL ); 251 File file = new File( StringUtil.urlAppend( directory,file1 ) ); 252 253 boolean rtnVal = false; 254 if( action != null ) { 255 if( ACT_CANREAD.equalsIgnoreCase( action ) ) { rtnVal = file.canRead(); } 256 else if( ACT_CANWRITE.equalsIgnoreCase( action ) ) { rtnVal = file.canWrite(); } 257 else if( ACT_CREATENEWFILE.equalsIgnoreCase( action ) ) { rtnVal = file.createNewFile(); } 258 else if( ACT_DELETE.equalsIgnoreCase( action ) ) { rtnVal = file.delete(); } 259 else if( ACT_EXISTS.equalsIgnoreCase( action ) ) { rtnVal = file.exists(); } 260 else if( ACT_ISDIRECTORY.equalsIgnoreCase( action ) ) { rtnVal = file.isDirectory(); } 261 else if( ACT_ISFILE.equalsIgnoreCase( action ) ) { rtnVal = file.isFile(); } 262 else if( ACT_ISHIDDEN.equalsIgnoreCase( action ) ) { rtnVal = file.isHidden(); } 263 else if( ACT_MKDIR.equalsIgnoreCase( action ) ) { 264 if( file.isDirectory() ) { rtnVal = true; } 265 else { rtnVal = file.mkdir(); } 266 } 267 else if( ACT_MKDIRS.equalsIgnoreCase( action ) ) { rtnVal = file.mkdirs(); } 268 else if( ACT_RENAMETO.equalsIgnoreCase( action ) ) { 269 if( file2 != null ) { 270 File newFile = new File( StringUtil.urlAppend( directory,file2 ) ); 271 if( newFile.exists() && !newFile.delete() ) { 272 String errMsg = "所定のファイルを削除できませんでした。[" + newFile + "]" ; 273 throw new RuntimeException( errMsg ); 274 } 275 rtnVal = file.renameTo( newFile ); 276 } 277 } 278 // 3.6.0.0 (2004/09/25) ACT_read を追加 279 else if( ACT_READ.equalsIgnoreCase( action ) ) { 280 if( file.isFile() ) { 281 FileString fs = new FileString(); 282 fs.setFilename( StringUtil.urlAppend( directory,file1 ) ); 283 if( encode != null ) { fs.setEncode( encode ); } // 5.1.9.0 (2010/08/01) READ時のエンコード指定 284 String val = fs.getValue(); 285 286 jspPrint( nval( getRequestParameter( val ),"" ) ); 287 rtnVal = true; 288 } 289 else { 290 String errMsg = "ファイルが存在しないか、ファイルではありません。" 291 + HybsSystem.CR 292 + "action=[" + action + "] , " 293 + " fileURL=[" + fileURL + "]" 294 + " directory=[" + directory + "]" 295 + " file1=[" + file1 + "]" ; 296 throw new HybsSystemException( errMsg ); 297 } 298 } 299 // 3.8.5.2 (2006/05/31) ファイルサイズが0Byte以上のファイルが存在するかどうか判定。 300 else if( ACT_EXISTSLENGTH.equalsIgnoreCase( action ) ) { 301 rtnVal = file.exists() && file.length() > 0L ; 302 } 303 // 5.3.6.0 (2011/06/01) ファイルコピー対応 304 // 6.0.0.1 (2014/04/25) These nested if statements could be combined 305 else if( ACT_COPY.equalsIgnoreCase( action ) && file2 != null ) { 306 File newFile = new File( StringUtil.urlAppend( directory,file2 ) ); 307 if( file.isFile() ) { 308 // FileUtil.copy 側で、toFile のフォルダを作成します。 309 rtnVal = FileUtil.copy( file, newFile ); 310 } 311 else if( file.isDirectory() ) { 312 rtnVal = FileUtil.copyDirectry( file, newFile ); 313 } 314 // 5.7.1.1 (2013/12/13) copy元(file1)のファイルが存在しなければ、エラーにします。 315 else if( !file.exists() ) { 316 String errMsg = "copy元(file1)のファイルが存在しません。" 317 + HybsSystem.CR 318 + "action=[" + action + "] , " 319 + " fileURL=[" + fileURL + "]" 320 + " directory=[" + directory + "]" 321 + " file1=[" + file1 + "]" 322 + " file2=[" + file2 + "]" ; 323 throw new HybsSystemException( errMsg ); 324 } 325 } 326 // 5.9.2.2 (2015/11/20) zip追加 327 else if( ACT_ZIP.equalsIgnoreCase( action ) && file2 != null ){ 328 //あるかないかだけ見る 329 if( file2.toLowerCase().indexOf( ".zip" ) < 0 ){ 330 file2 = file2 + ".zip"; 331 } 332 List<String> ziplist = org.opengion.fukurou.util.ZipFileUtil.compress( file.toString(), file2 ); 333 } 334 } 335 else { 336 String errMsg = "アクションが指定されていません。アクション NULL エラー" 337 + HybsSystem.CR 338 + " file=[" + file1 + "]" ; 339 throw new HybsSystemException( errMsg ); 340 } 341 342 return rtnVal; 343 } 344 345 /** 346 * 【TAG】アクション(canRead,canWrite,createNewFile,delete,exists,isDirectory,isFile,isHidden,mkdir,mkdirs)を指定します。 347 * 348 * @og.tag 349 * アクションは,HTMLから(get/post)指定されますので,ACT_xxx で設定される 350 * フィールド定数値のいづれかを、指定できます。 351 * 処理の結果が、false の場合は、body 要素を表示して終了します。 352 * useStop 属性と、notEquals 属性によって、上記の振る舞いをけることが可能です。 353 * 354 * canRead 読み込めるかどうかを判定。 355 * canWrite 変更できるかどうか判定。 356 * createNewFile 空の新しいファイルを不可分 (atomic) に生成。(そのファイルがまだ存在しない場合だけ) 357 * delete ファイルまたはディレクトリを削除。 358 * renameTo ファイルまたはディレクトリ名を変更。 359 * exists ファイルが存在するかどうか判定。 360 * isDirectory ファイルがディレクトリであるかどうか判定。 361 * isFile ファイルが普通のファイルかどうか判定。 362 * isHidden ファイルが隠しファイルかどうか判定。 363 * mkdir ディレクトリを生成。 364 * mkdirs ディレクトリを複数生成。 365 * read ファイルを読み込んでjspWriterに出力 366 * existsLength ファイルサイズが0Byte以上のファイルが存在するかどうか判定。 367 * copy ファイルまたはディレクトリをコピー(file1 ⇒ file2 にコピー)。 368 * 369 * @og.rev 3.0.0.0 (2002/12/25) ACTION_LIST のチェックを導入 370 * @og.rev 3.5.6.2 (2004/07/05) 文字列の連結にStringBuilderを使用します。 371 * 372 * @param cmd アクション文字列 373 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.FileTag.ACT_canRead">アクション定数</a> 374 */ 375 public void setAction( final String cmd ) { 376 action = getRequestParameter( cmd ); 377 378 if( ! check( action, ACTION_LIST ) ) { 379 380 StringBuilder errMsg = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 381 errMsg.append( "指定のアクションは実行できません。アクションエラー" ); 382 errMsg.append( HybsSystem.CR ); 383 errMsg.append( "action=[" ).append( action ).append( "] " ); 384 errMsg.append( HybsSystem.CR ); 385 386 for( int i=0; i<ACTION_LIST.length; i++ ) { 387 errMsg.append( " | " ); 388 errMsg.append( ACTION_LIST[i] ); 389 } 390 errMsg.append( " | " ); 391 throw new HybsSystemException( errMsg.toString() ); 392 } 393 } 394 395 /** 396 * 【TAG】操作するファイルのディレクトリを指定します 397 * (初期値:FILE_URL[={@og.value org.opengion.hayabusa.common.SystemData#FILE_URL}])。 398 * 399 * @og.tag 400 * この属性で指定されるディレクトリのファイルを操作します。 401 * 指定方法は、通常の fileURL 属性と同様に、先頭が、'/' (UNIX) または、2文字目が、 402 * ":" (Windows)の場合は、指定のURLそのままのディレクトリに、そうでない場合は、 403 * (初期値:システム定数のFILE_URL[={@og.value org.opengion.hayabusa.common.SystemData#FILE_URL}])。 404 * 405 * @og.rev 4.0.0.0 (2005/01/31) urlAppend メソッドの利用 406 * @og.rev 4.0.0.0 (2007/11/20) 指定されたディレクトリ名の最後が"\"or"/"で終わっていない場合に、"/"を付加する。 407 * 408 * @param url ファイルURL 409 * @see org.opengion.hayabusa.common.SystemData#FILE_URL 410 */ 411 public void setFileURL( final String url ) { 412 String furl = nval( getRequestParameter( url ),null ); 413 if( furl != null ) { 414 char ch = furl.charAt( furl.length()-1 ); 415 if( ch != '/' && ch != '\\' ) { furl = furl + "/"; } 416 fileURL = StringUtil.urlAppend( fileURL,furl ); 417 } 418 } 419 420 /** 421 * 【TAG】基準となるファイル名を指定します(コマンドの左辺のファイル名です)。 422 * 423 * @og.tag 424 * コマンドの左辺のファイル名です。 425 * 426 * @param fname ファイル名1 427 */ 428 public void setFile1( final String fname ) { 429 file1 = nval( getRequestParameter( fname ),file1 ); 430 } 431 432 /** 433 * 【TAG】処理結果となるファイル名を指定します(コマンドの右辺のファイル名です)。 434 * 435 * @og.tag 436 * コマンドの右辺のファイル名です。 437 * 438 * @param fname ファイル名2 439 */ 440 public void setFile2( final String fname ) { 441 file2 = nval( getRequestParameter( fname ),file2 ); 442 } 443 444 /** 445 * 【TAG】判定結果を反転させるかどうか[true/false]を指定します(初期値:false)。 446 * 447 * @og.tag 448 * 通常の判定結果において、不成立(false)の場合に、BODY を実行します。 449 * 通常の処理結果の正反対の処理を行います。 450 * 初期値は、通常 (true 以外)です。 451 * 452 * @og.rev 3.8.5.2 (2006/05/31) 新規追加 453 * 454 * @param flag [true:反転する/それ以外:通常] 455 */ 456 public void setNotEquals( final String flag ) { 457 notEquals = nval( getRequestParameter( flag ),notEquals ); 458 } 459 460 /** 461 * 【TAG】エラー時BODYを処理後に停止するかどうか[true/false]を指定します(初期値:true)。 462 * 463 * @og.tag 464 * 処理結果などに応じて、以下の処理を停止したい場合に、使用します。 465 * 通常は、条件を判定後、false の場合に、BODY部を出力(処理)した後に、 466 * 処理を停止します。(useStop="true") 467 * false を指定すると、判定結果に無関係に、以下の処理を実行します。 468 * 処理は継続したいが、警告表示する場合に、useStop="false" を指定します。 469 * 初期値は、停止する ("true")です。 470 * 471 * @og.rev 3.8.5.2 (2006/05/31) 新規追加 472 * 473 * @param flag [true:判定する/それ以外:しない] 474 */ 475 public void setUseStop( final String flag ) { 476 useStop = nval( getRequestParameter( flag ),useStop ); 477 } 478 479 /** 480 * 【TAG】ファイルを読み込む(action="READ")際のエンコードを指定します(初期値:OS依存文字コード)。 481 * 482 * @og.tag 483 * ファイルを読み込む(action="READ")際のエンコードを指定します。 484 * action="READ"以外場合には、この属性値は利用されません。 485 * 指定しない場合は、OS依存文字コードで読み込まれます。 486 * 487 * @og.rev 5.1.9.0 (2010/08/01) 新規作成 488 * 489 * @param enc ファイル読み込みのエンコード 490 */ 491 public void setEncode( final String enc ) { 492 encode = nval( getRequestParameter( enc ),encode ); 493 } 494 495 /** 496 * このオブジェクトの文字列表現を返します。 497 * 基本的にデバッグ目的に使用します。 498 * 499 * @return このクラスの文字列表現 500 */ 501 @Override 502 public String toString() { 503 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() ) 504 .println( "VERSION" ,VERSION ) 505 .println( "fileURL" ,fileURL ) 506 .println( "file1" ,file1 ) 507 .println( "file2" ,file2 ) 508 .println( "action" ,action ) 509 .println( "rtnCode" ,rtnCode ) 510 .println( "notEquals" ,notEquals ) 511 .println( "useStop" ,useStop ) 512 .println( "Other..." ,getAttributes().getAttribute() ) 513 .fixForm().toString() ; 514 } 515}