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.servlet; 017 018import org.opengion.fukurou.system.OgRuntimeException ; // 6.4.2.0 (2016/01/29) 019import java.io.File; 020import java.io.IOException; 021import java.io.PrintWriter; 022import java.lang.reflect.Field; 023import java.net.URL; 024import java.util.Enumeration; 025import java.util.Map; 026import java.util.concurrent.ConcurrentMap; // 6.4.3.3 (2016/03/04) 027import java.util.jar.JarEntry; 028import java.util.jar.JarFile; 029 030import javax.servlet.ServletContext; 031import javax.servlet.ServletException; 032import javax.servlet.http.HttpServlet; 033import javax.servlet.http.HttpServletRequest; 034import javax.servlet.http.HttpServletResponse; 035import javax.servlet.http.HttpSession; 036 037import org.opengion.fukurou.db.ConnectionFactory; 038import org.opengion.fukurou.util.Attributes; 039import org.opengion.fukurou.util.HybsEntry; 040import org.opengion.fukurou.util.StringUtil; 041import org.opengion.fukurou.system.BuildNumber; // 6.4.2.0 (2016/01/29) hayabusa.common.BuildNumber → fukurou.system.BuildNumber に移動 042import org.opengion.fukurou.system.Closer ; // 5.5.2.6 (2012/05/25) 043import org.opengion.hayabusa.common.HybsSystem; 044import org.opengion.hayabusa.common.SystemManager; 045import org.opengion.hayabusa.common.SystemParameter; 046import org.opengion.hayabusa.common.UserSummary; 047import static org.opengion.fukurou.system.HybsConst.CR ; // 6.1.0.0 (2014/12/26) 048import static org.opengion.fukurou.system.HybsConst.BUFFER_MIDDLE; // 6.1.0.0 (2014/12/26) refactoring 049 050import org.opengion.hayabusa.resource.ResourceFactory; // 5.9.1.0 (2015/10/02) 051import org.opengion.hayabusa.resource.UserInfo; // 5.9.1.0 (2015/10/02) 052 053import javax.servlet.ServletRegistration; // 6.3.4.0 (2015/08/01) 054import javax.servlet.FilterRegistration; // 6.3.4.0 (2015/08/01) 055 056/** 057 * サーバー管理情報を取得するAdminサーブレットです。 058 * 059 * 引数(URL)に応じて、サーバーの状態結果を返します。 060 * 一般には、http://サーバー:ポート/システムID/jsp/admin?COMMAND=コマンド の 061 * 形式のURL でアクセスします。 062 * 063 * ・COMMAND=infomation 064 * 【サーバー情報】 065 * OS情報 = Windows 7 Service Pack 1 x86 (32) 066 * サーバー名 = 10374232-0004 ( 172.27.26.164 ) 067 * サーブレット = Apache Tomcat/8.0.22 068 * TOMCAT_HOME = C:\opengionV6\apps\tomcat8.0.22 069 * JDKバージョン = Java HotSpot(TM) Server VM 1.8.0_45-b15 070 * JAVA_HOME = C:\opengionV6\apps\jdk180u45\jre 071 * 【実行環境】 072 * REAL_PATH = C:/opengionV6/uap/webapps/gf/ 073 * バージョンNo = openGion 6.2.4.0 Release6 Builds (2015142) 074 * 作成日時 = 2015/05/22 15:31:53 075 * 【ログイン情報】 076 * ログイン人数 = 2 名 ( 明細情報 ) 077 * 【メモリ情報】 078 * 空きメモリ = 129 [MByte] 079 * 合計メモリ = 209 [MByte] 080 * 使用率 = 38 [%] 081 * 【ディスク情報】 082 * 083 * ・COMMAND=close 084 * リソース情報のキャッシュを全てクリアします。 085 * 086 * ・COMMAND=loginUser 087 * 現在のログインユーザーの明細情報を表示します。 088 * SORT=[JNAME,ID,ROLES,IPADDRESS,LOGINTIME] ソートキー 089 * DIREC=[true,false] true:昇順/false:降順 090 * 091 * ・COMMAND=plugin 092 * 現在のプラグインのバージョン情報を表示します。 093 * 094 * ・COMMAND=systemResource 095 * 現在のシステムリソースの設定情報を表示します。 096 * 097 * ・COMMAND=AccessStop&stop=[true/false] 098 * アクセスストップフィルターの制御(停止、許可)を行います。 099 * 100 * ※ 6.4.4.1 (2016/03/18) 101 * ・COMMAND=commonMessage&type=[set/clear]&message=共通情報 102 * 共通情報を登録します。errorMessageタグに表示されます。 103 * 104 * ・common/gamen/01_ADMIN/parameter.jsp 105 * 現在のシステムリソースの設定情報を表示します。 106 * 107 * ・common/gamen/01_ADMIN/systemInfo.jsp 108 * システム定数のシステム起動情報を表示します。 109 * 110 * @og.rev 3.5.3.0 (2003/10/27) Admin JSP を Servlet化して、エンジンと共に供給します。 111 * @og.rev 4.0.0.0 (2005/08/31) プラグインのバージョン情報の表示機能を追加 112 * @og.group その他機能 113 * 114 * @version 4.0 115 * @author Kazuhiko Hasegawa 116 * @since JDK5.0, 117 */ 118public final class HybsAdmin extends HttpServlet { 119 private static final long serialVersionUID = 624120150522L ; // 6.2.4.1 (2015/05/22) 120 121 private static final String JSP = HybsSystem.sys( "JSP" ); // jspフォルダの正規パス 122 123 private static final long MB = 1024*1024 ; // 6.2.4.1 (2015/05/22) 124 private static final long GB = 1024*1024*1024 ; // 6.2.4.1 (2015/05/22) 125 126 private static final String HEADER = 127 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + CR + 128 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"" + CR + 129 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + CR + 130 "<html xmlns=\"http://www.w3.org/1999/xhtml\" >" + CR + 131 "<head>" + CR + 132 " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" + CR + 133 " <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />" + CR + 134 " <link rel=\"stylesheet\" href=\"" + JSP + "/common/default.css\" type=\"text/css\" />" + CR + 135 " <link rel=\"stylesheet\" href=\"" + JSP + "/custom/custom.css\" type=\"text/css\" />" + CR + 136 " <title>Hybs Admin</title>" + CR + 137 "</head>" + CR; 138 139 // 3.5.3.1 (2003/10/31) User情報のテーブルの設定を、システムリソース より行う。 140 private static final String TABLE_HEADER = getTableHeaderTag() ; 141 142 private static final String SERVER_INFO = HybsSystem.sys( "SERVER_INFO" ); // 10374232-0004 ( 200.1.50.239 ) 143 private static final String SERVLET_INFO = HybsSystem.sys( "SERVLET_INFO" ); // Apache Tomcat/7.0.39 144 private static final String REAL_PATH = HybsSystem.sys( "REAL_PATH" ); // C:/opengion/uap/webapps/gf/ 145 private static final String TOMCAT_HOME = HybsSystem.sys( "TOMCAT_HOME" ); // C:/opengion/apps/tomcat5.5.17 146 private static final String JAVA_HOME = HybsSystem.sys( "JAVA_HOME" ); // C:/opengion/apps/jdk170u25/jre 147 148 // 5.6.6.0 (2013/07/05) getLoginUser( String,boolean ) で、指定するキーを配列で持っておきます。 149 // キーは、SystemManager.getRunningUserSummary 処理内で大文字化されるため、この配列は、表示用と兼用します。 150 private static final String[] USER_KEYS = { "ID","Jname","Roles","IPAddress","LoginTime","LastAccess","LastGamenNm" }; 151 152 // 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 153 private static final String TABLE_WAKU = "<table style=\"margin: 0px 0px 0px 20px;\" frame=\"box\" border=\"1px\" cellspacing=\"0px\" cellpadding=\"0px\" " ; 154 private static final String TABLE_END = "</table>" + CR ; 155 156 // 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 157 // 6.4.9.4 (2016/09/02) アドレスが、/gf/jsp/admin だったので、他のシステムで動かなかった。 158 private static final String COMMON_MESSAGE = "【共通メッセージを表示する場合は、このテキストフィールドに入力してください。】<br />" + CR + 159 "<form method=\"GET\" action=\"admin\" target=\"RESULT\" >" + CR + 160 " <input name=\"message\" size=\"50\" /> " + CR + 161 " <button type=\"submit\" name=\"type\" value=\"set\" >Set</button> " + CR + 162 " <button type=\"submit\" name=\"type\" value=\"clear\" >Clear</button>" + CR + 163 " <input type=\"hidden\" name=\"COMMAND\" value=\"commonMessage\" />" + CR + 164 "</form><br /><br />" + CR ; 165 166 /** 167 * GET メソッドが呼ばれたときに実行します。 168 * 169 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 170 * @og.rev 3.5.4.1 (2003/12/01) getAdminLink() メソッドを追加 171 * @og.rev 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 172 * @og.rev 5.9.1.0 (2015/10/02) UserInfoセット機能追加 173 * @og.rev 6.3.8.3 (2015/10/03) Servlet/Filter 情報を作成。 174 * @og.rev 6.3.9.1 (2015/11/27) 3項演算子を || or && で簡素化できる(PMD)。 175 * @og.rev 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 176 * 177 * @param req HttpServletRequestオブジェクト 178 * @param res HttpServletResponseオブジェクト 179 * 180 * @throws ServletException サーブレット関係のエラーが発生した場合、throw されます。 181 * @throws IOException 入出力エラーが発生したとき 182 */ 183 @Override 184 public void doGet( final HttpServletRequest req, final HttpServletResponse res) 185 throws ServletException, IOException { 186 187 req.setCharacterEncoding( "UTF-8" ); // 6.4.4.1 (2016/03/18) 188 res.setContentType( "text/html; charset=UTF-8" ); 189 final PrintWriter out = res.getWriter(); 190 191 final String command = req.getParameter( "COMMAND" ); 192 193 out.println( HEADER ); 194 out.println("<body>"); 195 196 out.print("<h2>"); 197 out.print( req.getServerName() ); 198 out.print( ":" ); 199 out.print( req.getServerPort() ); 200 out.print( req.getContextPath() ); 201 out.println("</h2>"); 202 203 if( "infomation".equalsIgnoreCase( command ) ) { 204 out.print( getInfomation() ); 205 } 206 else if( "close".equalsIgnoreCase( command ) ) { 207 out.print( getCloseMessage( req.getSession() ) ); 208 } 209 else if( "loginUser".equalsIgnoreCase( command ) ) { 210 final String sort = req.getParameter( "sort" ); 211 final String direc = req.getParameter( "direc" ); 212 // 6.3.9.1 (2015/11/27) 3項演算子を || or && で簡素化できる(PMD)。 213 final boolean dir = direc == null || Boolean.parseBoolean( direc ); // 6.3.9.1 (2015/11/27) 214 215 out.print( COMMON_MESSAGE ); // 6.4.4.1 (2016/03/18) 216 out.print( getLoginUser(sort,dir) ); 217 } 218 // 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 219 else if( "commonMessage".equalsIgnoreCase( command ) ) { 220 final String type = req.getParameter( "type" ); 221 final String message = req.getParameter( "message" ); 222 out.print( setCommonMessage( type , message , req.getSession() ) ); 223 } 224 else if( "plugin".equalsIgnoreCase( command ) ) { 225 out.print( getPlugInInfo() ); 226 } 227 else if( "taglib".equalsIgnoreCase( command ) ) { 228 out.print( getTaglibInfo() ); 229 } 230 else if( "systemResource".equalsIgnoreCase( command ) ) { 231 out.print( getSystemResource() ); 232 } 233 // 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 234 else if( "AccessStop".equalsIgnoreCase( command ) ) { 235 out.print( getAccessStop( req.getParameter( "stop" ) ) ); // 6.3.8.0 (2015/09/11) 236 } 237 // 5.9.1.0 (2015/10/02) UserInfoセット機能追加 238 else if( "UserInfo".equalsIgnoreCase( command ) ){ // 5.9.1.0 (2015/10/02) 239 out.print( setUserinfo( req ) ); 240 } 241 // 6.3.8.3 (2015/10/03) Servlet/Filter 情報を作成。 242 else if( "registrationInfo".equalsIgnoreCase( command ) ) { 243 out.print( getRegistrationMessage( req.getSession() ) ); 244 } 245 else { 246 out.print( getAdminLink() ); // 3.5.4.1 (2003/12/01) 追加 247 } 248 249 out.println("</body></html>"); 250 } 251 252 /** 253 * infomation 情報を作成します。 254 * 255 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 256 * @og.rev 5.6.7.3 (2013/08/23) TOMCAT_WORKは、TOMCAT_HOME に置き換えます。 257 * @og.rev 6.2.4.1 (2015/05/22) ディスク容量を求めます。 258 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 259 * @og.rev 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 260 * @og.rev 6.5.0.1 (2016/10/21) ENGINE_INFO は、直接、BuildNumber から取得する。 261 * 262 * @return infomation情報 263 * @og.rtnNotNull 264 */ 265 private String getInfomation() { 266 // 4.0.0 (2005/01/31) ログイン数の取得方法の変更。 267 final int loginCount = SystemManager.getRunningCount() ; 268 269 final long freeMemory = Runtime.getRuntime().freeMemory()/MB ; // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 270 final long totalMemory = Runtime.getRuntime().totalMemory()/MB; // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 271 final long useMemoryRatio = (totalMemory-freeMemory)*100/totalMemory ; // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 272 final String bgCls = useMemoryRatio <= 50 ? "OK" : ( useMemoryRatio <= 80 ? "CAUT" : "NG" ) ; 273 274 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ); 275 276 rtn.append( "<table border = \"0px\" >" ); 277 tableTr1( rtn,"サーバー情報" ); 278 tableTr( rtn,"OS情報" , BuildNumber.OS_INFO ); // 6.5.0.1 (2016/10/21) 279 tableTr( rtn,"サーバー名" , SERVER_INFO ); 280 tableTr( rtn,"サーブレット" , SERVLET_INFO ); 281 tableTr( rtn,"TOMCAT_HOME" , TOMCAT_HOME ); // 5.6.7.3 (2013/08/23) 282 tableTr( rtn,"JDKバージョン" , BuildNumber.JDK_INFO ); // 6.5.0.1 (2016/10/21) 283 tableTr( rtn,"JAVA_HOME" , JAVA_HOME ); 284 285 tableTr1( rtn,"実行環境" ); 286 tableTr( rtn,"REAL_PATH" , REAL_PATH ); 287 tableTr( rtn,"バージョンNo" , BuildNumber.ENGINE_INFO ); // 6.5.0.1 (2016/10/21) 288 tableTr( rtn,"作成日時" , BuildNumber.TIMESTAMP ); 289 290 tableTr1( rtn,"ログイン情報" ); 291 tableTr( rtn,"ログイン人数" , String.valueOf( loginCount )," 名 ","( <a href=\"admin?COMMAND=loginUser\">明細情報</a> )" ); 292 293 tableTr1( rtn,"メモリ情報" ); 294 tableTr( rtn,"空きメモリ" , String.valueOf( freeMemory ) , " [MByte]" ); // 6.2.4.1 (2015/05/22) 単位を MB に変更 295 tableTr( rtn,"合計メモリ" , String.valueOf( totalMemory ) , " [MByte]" ); // 6.2.4.1 (2015/05/22) 単位を MB に変更 296 tableTr( rtn,"使用率" , String.valueOf( useMemoryRatio ) , " [%]" ); 297 rtn.append( TABLE_END ) 298 // 6.2.4.1 (2015/05/22) default.css で、memory、disc、discTD を定義 299 .append( TABLE_WAKU ).append( "width=\"300px\" >" ).append( CR ) 300 .append( "\t<tr><td class=\"memory " ).append( bgCls ).append( "\" style=\"width:" ) 301 .append( useMemoryRatio ).append( "%;\" >" ).append( useMemoryRatio ).append( "%</td>" ) 302 .append( "<td class=\"BIT\">" ).append( 100-useMemoryRatio ).append( "%</td></tr>" ).append( CR ) 303 .append( TABLE_END ) 304 305 // 6.2.4.1 (2015/05/22) ディスク容量を求めます。 306 .append( "<table border=\"0px\" >" ).append( CR ); 307 tableTr1( rtn,"ディスク情報" ); 308 rtn.append( TABLE_END ) 309 310 .append( TABLE_WAKU ).append( "width=\"500px\" >" ).append( CR ) 311 .append( "<th>名前</th><th>合計サイズ</th><th>空き領域</th><th>使用率</th></tr>" ).append( CR ); 312 313 final File[] driv = File.listRoots(); 314 for( final File file : driv ) { 315 // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 316 final long total = file.getTotalSpace()/GB ; // パーティションのサイズ 317 final long usable = file.getUsableSpace()/GB ; // 仮想マシンが利用できるバイト数 318 tableTr2( rtn, file.getPath() , total , usable ); // ディスク容量専用3 319 } 320 rtn.append( TABLE_END ) 321 322 // information 323 .append( "<hr />" ).append( CR ) 324 .append( "<pre>" ).append( CR ) 325 .append( ConnectionFactory.information() ).append( CR ) 326 .append( "</pre>" ).append( CR ); 327 328 return rtn.toString(); 329 } 330 331 /** 332 * infomation 情報を作成します。 333 * 334 * @og.rev 5.6.6.0 (2013/07/05) </td></tr>漏れ追加 335 * @og.rev 5.6.7.3 (2013/08/23) 前後に、【】を付けます。 336 * 337 * @param buf 情報登録用のStringBuilder 338 * @param key キー 339 * 340 * @return infomation情報(入力bufと同じオブジェクト) 341 * @og.rtnNotNull 342 */ 343 private StringBuilder tableTr1( final StringBuilder buf, final String key ) { 344// buf.append( "\t<tr><td colspan=\"4\"><b>【" ).append( key ).append( "】</b></td></tr>" ).append( CR ); // 【】追加 345// return buf ; 346 return buf.append( "\t<tr><td colspan=\"4\"><b>【" ).append( key ).append( "】</b></td></tr>" ).append( CR ); // 【】追加 347 } 348 349 /** 350 * infomation 情報を作成します。 351 * 352 * @og.rev 5.6.6.0 (2013/07/05) 最初の td に、全角スペース2個 追加 353 * 354 * @param buf 情報登録用のStringBuilder 355 * @param key キー 356 * @param val 値の可変長引数 357 * 358 * @return infomation情報(入力bufと同じオブジェクト) 359 * @og.rtnNotNull 360 */ 361 private StringBuilder tableTr( final StringBuilder buf, final String key, final String... val ) { 362 buf.append( "\t<tr><td width=\"20px\"> </td><td>" ).append( key ).append( "</td><td> = </td><td>" ); // 段を作成する為に、width指定 追加 363 for( int i=0; i<val.length; i++ ) { 364 buf.append( val[i] ); 365 } 366// buf.append( "</td></tr>" ).append( CR ); 367// return buf ; 368 return buf.append( "</td></tr>" ).append( CR ); 369 } 370 371 /** 372 * infomation 情報を作成します。 373 * 374 * @og.rev 6.2.4.1 (2015/05/22) ディスク容量専用 375 * @og.rev 6.2.4.2 (2015/05/29) total が 0 の場合の対応 376 * 377 * @param buf 情報登録用のStringBuilder 378 * @param name ドライブ名 379 * @param total パーティションのサイズ(GB) 380 * @param usable 仮想マシンが利用できるサイズ(GB) 381 * 382 * @return infomation情報(入力bufと同じオブジェクト) 383 * @og.rtnNotNull 384 */ 385 private StringBuilder tableTr2( final StringBuilder buf, final String name, final long total, final long usable ) { 386 final long useRatio = total == 0L ? 0L : (total-usable)*100/total ; // 6.3.9.0 (2015/11/06) findBugs 387 388 final String bgCls = useRatio <= 50 ? "OK" : ( useRatio <= 80 ? "CAUT" : ( useRatio <= 95 ? "WARN" : "NG" ) ) ; 389 390// buf.append( "\t<tr><td class=\"BIT\">" ).append( name ).append( "</td>" ) 391 return buf.append( "\t<tr><td class=\"BIT\">" ).append( name ).append( "</td>" ) 392 .append( "<td class=\"S9\" >" ).append( total ).append( " GB</td>" ) 393 .append( "<td class=\"S9\" >" ).append( usable ).append( " GB</td>" ).append( CR ) 394 .append( "\t\t<td class=\"discTD\" ><span class=\"disc " ).append( bgCls ) 395 .append( "\" style=\"width:" ).append( useRatio ).append( "%;\" >" ) 396 .append( useRatio ).append( "%</span> </td></tr>" ).append( CR ); 397// return buf ; 398 } 399 400 /** 401 * close 情報を作成します。 402 * 403 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 404 * @og.rev 3.6.0.0 (2004/09/17) CalendarFactory.clear() を追加します。 405 * @og.rev 4.0.0.0 (2005/01/31) Cleanable インターフェースによる初期化処理 406 * @og.rev 4.1.0.2 (2008/01/29) UserInfoをsessionから消去する(超暫定対応) 407 * @og.rev 5.6.6.0 (2013/07/05) UserSummary の削除処理は、SystemManager から行う。 408 * @og.rev 6.3.7.0 (2015/09/04) ファイナライズを呼び出します。 409 * 410 * @param session HttpSessionオブジェクト 411 * 412 * @return close情報 413 * @og.rtnNotNull 414 */ 415 private String getCloseMessage( final HttpSession session ) { 416 417 // 4.0.0 (2005/01/31) Cleanable インターフェースによる初期化処理 418 SystemManager.allClear( false ) ; 419 420 final ServletContext context = session.getServletContext(); 421 final Map<String,String> param = SystemParameter.makeSystemParameter( context ); 422 HybsSystem.setInitialData( param ); // 4.0.0 (2005/01/31) 423 424 // 5.6.6.0 (2013/07/05) UserSummary の削除処理は、SystemManager から行う。 425 SystemManager.removeSession( session ) ; 426 427 // 6.3.7.0 (2015/09/04) ファイナライズを呼び出します。 428 System.runFinalization(); 429 // System.gc(); // 取りあえず、GCは呼びません。 430 431// final String rtn = "<pre>" 432 return "<pre>" 433 + "キャッシュ情報をクリアしました。" + CR 434 + "ユーザー情報の初期化に関しては、ブラウザを閉じて、再ログインが必要です。" + CR 435 + ConnectionFactory.information() 436 + "</pre>" ; 437// return rtn ; 438 } 439 440 /** 441 * loginUser 情報を作成します。 442 * 443 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 444 * @og.rev 3.8.5.3 (2006/08/07) ユーザー情報をソートするためのキー情報を追加 445 * @og.rev 3.8.7.0 (2006/12/15) USER.LASTACCESS情報を追加します。 446 * @og.rev 4.0.0.0 (2005/01/31) DBColumn の 属性(CLS_NM)から、DBTYPEに変更 447 * @og.rev 4.4.0.1 (2009/08/08) 最終ログイン画面名称を追加 448 * @og.rev 5.6.6.0 (2013/07/05) table作成処理を、変更します。 449 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 450 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 451 * 452 * @param sort ソートするキー項目を指定 453 * @param direc ソートする方向 [true:昇順/false:降順] 454 * 455 * @return loginUser情報 456 * @og.rtnNotNull 457 */ 458 private String getLoginUser( final String sort,final boolean direc ) { 459 // 4.0.0 (2005/01/31) ログイン数の取得方法の変更。 460 final int loginCount = SystemManager.getRunningCount() ; 461 462 // 4.0.0 (2005/01/31) 463 final UserSummary[] userInfos = SystemManager.getRunningUserSummary( sort,direc ); 464 465 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 466 .append( "現在 " ).append( loginCount ).append( " 名の方がログイン中です。" ).append( CR ) 467 .append( "<table " ).append( TABLE_HEADER ).append( " >" ) 468 .append( "<thead><tr><th>No</th>" ); 469 470 // 5.6.6.0 (2013/07/05) table作成処理を、変更します。 471 for( final String sortKey : USER_KEYS ) { 472 rtn.append( "<th><a href=\"?COMMAND=loginUser&sort=" ).append( sortKey ) 473 .append( "&direc=" ).append( !direc ) 474 .append( "\">" ).append( sortKey ).append( "</a></th>" ); 475 } 476 477 rtn.append( "</tr></thead>" ).append( CR ) 478 // 5.9.1.2 (2015/10/23) 自己終了警告対応 479 .append( "<colgroup class=\"S9\" ><!-- --></colgroup>" ) 480 .append( "<colgroup class=\"X\" span=\"6\" ><!-- --></colgroup>" ) 481 .append( CR ); 482 483 for( int i=0; i<userInfos.length; i++ ) { 484 final UserSummary userInfo = userInfos[i] ; 485 rtn.append( " <tr class=\"row_" ).append( i%2 ).append( "\" >" ) 486 .append( "<td>" ).append( String.valueOf( i+1 ) ).append( "</td>" ) 487 .append( "<td>" ).append( userInfo.getUserID() ).append( "</td>" ) 488 .append( "<td>" ).append( userInfo.getJname() ).append( "</td>" ) 489 .append( "<td>" ).append( userInfo.getRoles() ).append( "</td>" ) 490 .append( "<td>" ).append( userInfo.getIPAddress() ).append( "</td>" ) 491 .append( "<td>" ).append( HybsSystem.getDate( userInfo.getLoginTime() ) ).append( "</td>" ) 492 .append( "<td>" ).append( userInfo.getAttribute( "LASTACCESS") ).append( "</td>" ) 493 .append( "<td>" ).append( StringUtil.nval( userInfo.getAttribute( "LASTGAMENNM"), "" ) ).append( "</td>" ) // 4.4.0.1 (2009/08/08) 494 .append( " </tr>" ).append( CR ); 495 } 496// rtn.append( TABLE_END ); 497 return rtn.append( TABLE_END ).toString(); 498 499// return rtn.toString() ; 500 } 501 502 /** 503 * PlugIn 情報を作成します。 504 * 505 * @og.rev 4.0.0.0 (2005/08/31) 新規作成 506 * @og.rev 5.6.6.0 (2013/07/05) "DBConstValue","Daemon","JspCreate" を、追加します。 507 * 508 * @return PlugIn情報 509 * @og.rtnNotNull 510 */ 511 private String getPlugInInfo() { 512 513 final String[] pluginType = new String[] { 514 "Query","Renderer","Editor","DBType","ViewForm", 515 "TableReader","TableWriter","TableFilter","ChartWriter","CalendarQuery", 516 "DBConstValue","Daemon","JspCreate" // 5.6.6.0 (2013/07/05) 追加 517 } ; 518 519 final ClassInfo info = new ClassInfo(); 520 521 for( int j=0; j<pluginType.length; j++ ) { 522 final String type = pluginType[j] ; 523 final HybsEntry[] names = HybsSystem.sysEntry( type + "_" ); 524 for( int i=0; i<names.length; i++ ) { 525 final String key = names[i].getKey().substring( type.length()+1 ); 526 final String clsName = names[i].getValue(); 527 info.addLine( type,key,clsName ); 528 } 529 } 530 return info.getClassInfoData() ; 531 } 532 533 /** 534 * Taglib 情報を作成します。 535 * 536 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 537 * @og.rev 5.3.6.0 (2011/06/01) Taglib クラス名の求め方を変更します。(jar版のみ) 538 * @og.rev 5.5.2.6 (2012/05/25) JarFile を、Closer#zipClose( ZipFile ) メソッドを利用して、close します。 539 * @og.rev 6.8.5.1 (2018/01/15) ファイル名は、##バージョン番号を変換しておく必要がある。 540 * 541 * @return Taglib情報 542 * @og.rtnNotNull 543 */ 544 private String getTaglibInfo() { 545 final ClassInfo info = new ClassInfo(); 546 547 // 5.5.2.6 (2012/05/25) findbugs対応 548 JarFile jarFile = null; 549 try { 550 final ClassLoader loader = Thread.currentThread().getContextClassLoader(); 551 final Enumeration<URL> enume = loader.getResources( "org/opengion/hayabusa/taglib/" ); // 4.3.3.6 (2008/11/15) Generics警告対応 552 while( enume.hasMoreElements() ) { 553 final URL url = enume.nextElement(); // 4.3.3.6 (2008/11/15) Generics警告対応 554 // jar:file:/実ディレクトリ または、file:/実ディレクトリ 555// final String dir = url.getFile(); 556 final String dir = url.getFile().replaceAll( "%23%23","##" ); // 6.8.5.1 (2018/01/15) 557 if( "jar".equals( url.getProtocol() ) ) { 558 // dir = file:/G:/webapps/gf/WEB-INF/lib/hayabusa4.0.0.jar!/org/opengion/hayabusa/taglib 形式です。 559 final String jar = dir.substring(dir.indexOf( ':' )+1,dir.lastIndexOf( '!' )); 560 // jar = /G:/webapps/gf/WEB-INF/lib/hayabusa4.0.0.jar 形式に切り出します。 561 jarFile = new JarFile( jar ); 562 final Enumeration<JarEntry> en = jarFile.entries() ; // 4.3.3.6 (2008/11/15) Generics警告対応 563 while( en.hasMoreElements() ) { 564 final JarEntry ent = en.nextElement(); // 4.3.3.6 (2008/11/15) Generics警告対応 565 final String file = ent.getName(); 566 if( ! ent.isDirectory() && file.endsWith( "Tag.class" ) ) { 567 final String type = "Taglib_jar"; 568 // 5.3.6.0 (2011/06/01) Taglib クラス名の求め方を変更します。(jar版のみ) 569 final String key = file.substring( file.lastIndexOf( '/' )+1,file.length()-6 ); // -6 は、.class 分 570 final String clsName = file.replace( '/','.' ).substring( 0,file.length()-6 ); 571 info.addLine( type,key,clsName ); 572 } 573 } 574 Closer.zipClose( jarFile ); // 5.5.2.6 (2012/05/25) findbugs対応 575 jarFile = null; // 正常終了時に、close() が2回呼ばれるのを防ぐため。 576 } 577 else { 578 // dir = /G:/webapps/gf/WEB-INF/classes/org/opengion/hayabusa/taglib/ 形式です。 579 final File[] list = new File( dir ).listFiles(); 580 // 6.3.9.0 (2015/11/06) null になっている可能性がある(findbugs) 581 if( list != null ) { 582 for( final File file : list ) { 583 final String name = file.getName() ; 584 if( file.isFile() && name.endsWith( "Tag.class" ) ) { 585 final String type = "Taglib_file"; 586 final String key = name.substring( 0,name.length()-6 ); 587 final String clsName = "org.opengion.hayabusa.taglib." + key ; 588 info.addLine( type,key,clsName ); 589 } 590 } 591 } 592 } 593 } 594 } 595 catch( final IOException ex ) { 596 final String errMsg = "taglibファイル読み取りストリームを失敗しました。" 597 + CR + ex.getMessage(); 598 throw new OgRuntimeException( errMsg,ex ); 599 } 600 finally { 601 Closer.zipClose( jarFile ); // 5.5.2.6 (2012/05/25) findbugs対応 602 } 603 604 return info.getClassInfoData() ; 605 } 606 607 /** 608 * クラス情報を表示するためのデータを管理します。 609 * ここでは、引数に渡された、分類(Classify)、名称(Key Name)、クラス名(Class Name)、 610 * バージョン(Version)情報をテーブル形式で表示します。 611 * バージョン情報は、クラス名から、インスタンスを作成して、private static final String VERSION 612 * フィールドの値を読み取ります。 613 * 614 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 615 */ 616 private static final class ClassInfo { 617 private final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ); 618 private int cnt; 619 620 /** 621 * コンストラクター 622 * 623 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 624 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 625 */ 626 public ClassInfo() { 627 628 // 5.9.1.2 (2015/10/23) 自己終了警告対応。ついでに、append連結しておきます。 629 rtn.append( "<table " ).append( TABLE_HEADER ).append( " >" ).append( CR ) 630 .append( " <thead><tr><th>No</th><th>Classify</th><th>Key Name</th><th>Class Name</th><th>Version</th></tr></thead>" ).append( CR ) 631 .append( " <colgroup class=\"S9\" ><!-- --></colgroup>") 632 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 633 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 634 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 635 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 636 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 637 .append( CR ); 638 } 639 640 /** 641 * テーブル表示用のデータを追加します。 642 * 643 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 644 * 645 * @param type タイプ属性 646 * @param key キー属性 647 * @param clsName クラス名(このクラス名からインスタンス化します。) 648 */ 649 public void addLine( final String type, final String key, final String clsName ) { 650 final String version = getFieldValue( clsName ); 651 652 final boolean isCustom = version.compareTo( BuildNumber.VERSION_NO ) > 0 653 || version.indexOf( "Pache" ) >= 0 654 || version.indexOf( "Nightly" ) >= 0 ; 655 656 final String trType = isCustom ? "warning" : String.valueOf( cnt%2 ); 657 658 rtn.append( "<tr class=\"row_" ).append( trType ).append( "\" >" ) 659 .append( "<td>" ).append( cnt++ ).append( "</td>" ) 660 .append( "<td>" ).append( type ).append( "</td>" ) 661 .append( "<td>" ).append( key ).append( "</td>" ) 662 .append( "<td>" ).append( clsName ).append( "</td>" ) 663 .append( "<td>" ).append( version ).append( "</td>" ) 664 .append( "</tr>" ).append( CR ); 665 } 666 667 /** 668 * すべての内部のデータを文字列化して返します。 669 * 670 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 671 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 672 * 673 * @return 作成されたテーブルデータ 674 * @og.rtnNotNull 675 */ 676 public String getClassInfoData() { 677// rtn.append( TABLE_END ); 678// return rtn.toString() ; 679 return rtn.append( TABLE_END ).toString(); 680 } 681 682 /** 683 * 指定のオブジェクトの VERSION staticフィールドの値を取得します。 684 * 685 * @og.rev 4.0.0.0 (2005/08/31) 新規作成 686 * @og.rev 6.4.3.3 (2016/03/04) HybsSystem#newInstance(String) ではなく、直接Class#forName(String)から、求めます。 687 * 688 * @param clsName 指定のクラスを表す名称 689 * @return VERSIONフィールドの値(エラー時は、そのメッセージ) 690 */ 691 private String getFieldValue( final String clsName ) { 692 String rtn ; 693 try { 694 final Field fld = Class.forName( clsName ).getDeclaredField( "VERSION" ) ; 695 696 // privateフィールドの取得には、accessibleフラグを trueにする必要があります。 697 fld.setAccessible( true ); 698 699 rtn = (String)fld.get( null ); 700 } 701 catch( final Throwable ex ) { 702 rtn = ex.getMessage(); 703 } 704 return rtn ; 705 } 706 } 707 708 /** 709 * systemResource 情報を作成します。 710 * 711 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 712 * @og.rev 4.0.0.0 (2005/01/31) DBColumn の 属性(CLS_NM)から、DBTYPEに変更 713 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 714 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 715 * @og.rev 6.4.3.3 (2016/03/04) 配列返しではなく、Map を返します。 716 * 717 * @return systemResource情報 718 * @og.rtnNotNull 719 */ 720 private String getSystemResource() { 721 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 722 .append( "<table " ).append( TABLE_HEADER ).append( " >" ).append( CR ) 723 .append( "<thead><tr><th>No</th><th>Key</th><th>Value</th></tr></thead>" ).append( CR ) 724 // 5.9.1.2 (2015/10/23) 自己終了警告対応 725 .append( "<colgroup class=\"S9\" ><!-- --></colgroup>" ) 726 .append( "<colgroup class=\"X\" span=\"2\" ><!-- --></colgroup>" ) 727 .append( CR ); 728 729 // 6.4.3.3 (2016/03/04) 配列返しではなく、Map を返します。 730 final ConcurrentMap<String,String> rscMap = HybsSystem.getSystemResourceMap(); 731 int i=0; 732 for( final Map.Entry<String,String> entry : rscMap.entrySet() ) { 733 rtn.append( "<tr class=\"row_" ).append( i%2 ).append( "\" >" ).append( CR ) 734 .append( "<td>" ).append( ++i ).append( "</td>" ) 735 .append( "<td>" ).append( entry.getKey() ).append( "</td>" ) 736 .append( "<td>" ).append( entry.getValue() ).append( "</td>" ) 737 .append( "</tr>" ).append( CR ); 738 } 739 return rtn.append( TABLE_END ).toString(); 740 741 } 742 743 /** 744 * AccessStop 情報を作成します。 745 * 746 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 747 * @og.rev 4.0.0.0 (2007/11/29) AccessStopFilter#getStopFilter() ⇒ isStopFilter() に変更 748 * @og.rev 6.1.1.0 (2015/01/17) パッケージを import するのと、ロジック見直し。 749 * @og.rev 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 750 * 751 * @param isStop true:停止/false:実行 752 * @return AccessStop情報 753 * @og.rtnNotNull 754 */ 755 private String getAccessStop( final String isStop ) { 756 757 final boolean flag = Boolean.parseBoolean( isStop ); // 6.3.8.0 (2015/09/11) 758 // AccessStopFilter.setStopFilter( flag ); 759 760 return flag ? "Webアプリケーションのサービスを停止します。" 761 : "Webアプリケーションのサービスを開始します。"; 762 } 763 764 /** 765 * application オブジェクトに関連付ける 共通メッセージを設定します。 766 * 767 * 取り出しは、errorMessageタグで行います。これは、個々のrequest.jsp に組み込まれている 768 * メッセージなので、ここで登録したメッセージは、同時に、すべてのアクセスしているユーザーが 769 * 見ることになります。 770 * 771 * @og.rev 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 772 * @og.rev 6.8.5.0 (2018/01/09) 共通メッセージで、strongタグのバグ修正と、class="common_msg" 追加。 773 * 774 * @param type [set/clear] を指定します。 775 * @param message 共通メッセージを指定します。 776 * @param session HttpSessionオブジェクト 777 * 778 * @return Servlet/Filter情報 779 * @og.rtnNotNull 780 */ 781 private String setCommonMessage( final String type , final String message , final HttpSession session ) { 782 final ServletContext context = session.getServletContext(); 783 784 String rtMsg = ""; 785 if( "set".equalsIgnoreCase( type ) && message != null && message.length() > 0 ) { 786 rtMsg = "<strong class=\"common_msg\">" + message + "</strong><br />"; // 6.8.5.0 (2018/01/09) 787 context.setAttribute( HybsSystem.COMMON_MSG_KEY,rtMsg ); 788 } 789 else if( "get".equalsIgnoreCase( type ) ) { 790 rtMsg = (String)context.getAttribute( HybsSystem.COMMON_MSG_KEY ); 791 } 792 else if( "clear".equalsIgnoreCase( type ) ) { 793 context.removeAttribute( HybsSystem.COMMON_MSG_KEY ); 794 } 795 796 return rtMsg; 797 } 798 799 /** 800 * Servlet/Filter 情報を作成します。 801 * 802 * @og.rev 6.3.8.3 (2015/10/03) Servlet/Filter 情報を作成。 803 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 804 * 805 * @param session HttpSessionオブジェクト 806 * 807 * @return Servlet/Filter情報 808 * @og.rtnNotNull 809 */ 810 private String getRegistrationMessage( final HttpSession session ) { 811 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 812 .append( "<table " ).append( TABLE_HEADER ).append( " >" ) 813 .append( "<thead><tr><th>No</th><th>Type</th><th>Key</th><th>Class</th><th>Mappings</th></tr></thead>" ) 814 // 5.9.1.2 (2015/10/23) 自己終了警告対応 815 .append( "<colgroup class=\"S9\" ><!-- --></colgroup>" ) 816 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 817 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 818 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 819 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 820 .append( CR ); 821 822 int no = 0; 823 final ServletContext context = session.getServletContext(); 824 for( final ServletRegistration reg : context.getServletRegistrations().values() ) { 825 rtn.append( "<tr class=\"row_" ).append( no%2 ).append( "\" >" ) 826 .append( "<td>" ).append( String.valueOf( ++no ) ).append( "</td>" ) 827 .append( "<td>Servlet</td>" ) 828 .append( "<td>" ).append( reg.getName() ).append( "</td>" ) 829 .append( "<td>" ).append( reg.getClassName() ).append( "</td>" ) 830 .append( "<td>" ).append( reg.getMappings() ).append( "</td>" ) 831 .append( "</tr>" ).append( CR ); 832 } 833 834 for( final FilterRegistration reg : context.getFilterRegistrations().values() ) { 835 rtn.append( "<tr class=\"row_" ).append( no%2 ).append( "\" >" ) 836 .append( "<td>" ).append( String.valueOf( ++no ) ).append( "</td>" ) 837 .append( "<td>Filter</td>" ) 838 .append( "<td>" ).append( reg.getName() ).append( "</td>" ) 839 .append( "<td>" ).append( reg.getClassName() ).append( "</td>" ) 840 .append( "<td>" ).append( reg.getUrlPatternMappings() ).append( "</td>" ) 841 .append( "</tr>" ).append( CR ); 842 } 843 844 rtn.append( TABLE_END ); 845 846 return rtn.toString(); 847 } 848 849 /** 850 * admin リンク情報を作成します。 851 * 簡易メソッドなので、国際化対応していません。 852 * 853 * @og.rev 3.5.4.1 (2003/12/01) 新規作成 854 * @og.rev 5.1.1.2 (2009/12/10) 画面IDを変更 855 * @og.rev 5.6.3.4 (2013/04/26) クイックリファレンス 画面を追加 856 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 857 * @og.rev 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 858 * @og.rev 6.9.2.1 (2018/03/12) リンクが横に長くなってきたので、2段に折り返します。 859 * 860 * @return アドミンリンク情報 861 * @og.rtnNotNull 862 */ 863 private String getAdminLink() { 864// final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 865 return new StringBuilder( BUFFER_MIDDLE ) 866 .append( "<table><tr>" ) 867 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=infomation\" target=\"RESULT\" >状況表示</a>]</td>" ) 868 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=close\" target=\"RESULT\" >プール削除</a>]</td>" ) 869 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=loginUser\" target=\"RESULT\" >ログインユーザー</a>]</td>" ) 870 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=plugin\" target=\"RESULT\" >プラグイン情報</a>]</td>" ) 871 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=taglib\" target=\"RESULT\" >タグリブ情報</a>]</td>" ) 872 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=registrationInfo\" target=\"RESULT\" >Servlet/Filter情報</a>]</td>" ) 873 // .append( "</tr><tr>" ) 874 .append( "<td width=\"10px\"/><td>[<a href=\"common/quickReference.html\" target=\"RESULT\" >クイックリファレンス</a>]</td>" ) // 5.6.3.4 (2013/04/26) 875 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=systemResource\" target=\"RESULT\" >システムリソース</a>]</td>" ) // 6.3.8.0 (2015/09/11) 876 .append( "<td width=\"10px\"/><td>アクセス制限[<a href=\"admin?COMMAND=AccessStop&stop=true\" target=\"RESULT\" >停止</a>]/" ) 877 .append( "[<a href=\"admin?COMMAND=AccessStop&stop=false\" target=\"RESULT\" >開始</a>]</td>" ) 878 .append( "<td width=\"10px\"/><td>[<a href=\"common/gamen/01_ADMIN/parameter.jsp?GAMENID=01_ADMIN\" target=\"RESULT\" >パラメータ</a>]</td>" ) 879 .append( "<td width=\"10px\"/><td>[<a href=\"common/gamen/01_ADMIN/systemInfo.jsp?GAMENID=01_ADMIN\" target=\"RESULT\" >システム状況</a>]</td>" ) 880 .append( "</tr>" ).append( TABLE_END ) 881 .toString(); 882 883// return rtn.toString(); 884 } 885 886 /** 887 * DBTableModel から テーブルのタグ文字列を作成して返します。 888 * 889 * @og.rev 3.5.3.1 (2003/10/31) User情報のテーブルの設定を、システムリソース より行う。 890 * @og.rev 5.2.2.0 (2010/11/01) SystemData 見直し漏れの対応。 891 * 892 * @return テーブルのタグ文字列 893 * @og.rtnNotNull 894 */ 895 private static String getTableHeaderTag() { 896 // 6.1.1.0 (2015/01/17) Attributesの連結記述 897 return new Attributes() 898 .set( "id" ,"viewTable" ) // 3.6.0.5 (2004/10/18) 899 .set( "summary" ,"layout" ) // サマリー 900 .getAttribute(); 901 } 902 903 /** 904 * userInfo 情報をセットします。 905 * 現状、このメソッドではLANGのみ設定可能です。 906 * (予約語以外のセットはuserInfoタグで行う) 907 * 908 * LANGではuserInfoを切り替えた後にユーザのGUIInfoを再ロードします。 909 * 910 * @og.rev 5.9.1.0 (2015/10/02) 新規作成 911 * 912 * @param req HttpServletRequestオブジェクト 913 * @return 結果情報 914 */ 915 private String setUserinfo( final HttpServletRequest req ) { 916 final HttpSession session = req.getSession(); 917 final UserInfo userInfo = (UserInfo)(session.getAttribute( HybsSystem.USERINFO_KEY )); 918 919 final String infoLang = req.getParameter( "LANG" ); 920 921 String rtn = null ; 922 if( userInfo != null && infoLang != null && infoLang.length() > 0) { 923 userInfo.setLang( infoLang ); 924 ResourceFactory.newInstance( userInfo.getLang() ).makeGUIInfos( userInfo ); 925 rtn = "User language : " + infoLang; 926 } 927 928 if( rtn == null || rtn.length() == 0 ) { 929 rtn = "Error"; 930 } 931 932 return rtn ; 933 } 934}