1212import javax .servlet .http .HttpServletRequest ;
1313import javax .servlet .http .HttpServletResponse ;
1414
15- import net .arnx .jsonic .JSON ;
16- import net .arnx .jsonic .JSONException ;
17-
1815import org .support .project .common .bean .ValidateError ;
1916import org .support .project .common .config .CommonBaseParameter ;
2017import org .support .project .common .config .Resources ;
4340import org .support .project .web .config .MessageStatus ;
4441import org .support .project .web .control .service .Get ;
4542import org .support .project .web .exception .InvalidParamException ;
43+ import org .support .project .web .logic .impl .DefaultAuthenticationLogicImpl ;
44+
45+ import net .arnx .jsonic .JSON ;
46+ import net .arnx .jsonic .JSONException ;
4647
4748/**
4849 * Controlの基底クラス
@@ -69,9 +70,9 @@ public abstract class Control {
6970
7071 /** リソース */
7172 protected Resources resources = Resources .getInstance (CommonBaseParameter .APP_RESOURCE );
72-
73+ /** Viewのベースパス */
7374 public static final String BASE_PATH = "/WEB-INF/views" ;
74-
75+ /** HTMLエスケープして送信するかのフラグ */
7576 private boolean sendEscapeHtml = true ;
7677
7778 /**
@@ -158,7 +159,7 @@ protected String getForwardDir() {
158159 if (StringUtils .isNotEmpty (subPackageName )) {
159160 if (subPackageName .indexOf ("\\ ." ) != -1 ) {
160161 String [] packages = StringUtils .split (subPackageName , "." );
161- for (int i = packages .length -1 ; i <= 0 ; i --) {
162+ for (int i = packages .length - 1 ; i <= 0 ; i --) {
162163 String string = packages [i ];
163164 builder .append (string ).append ("/" );
164165 }
@@ -443,6 +444,17 @@ protected String[] getPathInfos() {
443444 public LoginedUser getLoginedUser () {
444445 return (LoginedUser ) request .getSession ().getAttribute (CommonWebParameter .LOGIN_USER_INFO_SESSION_KEY );
445446 }
447+ /**
448+ * ログインユーザ情報を最新の情報で更新
449+ */
450+ public void updateLoginInfo () {
451+ DefaultAuthenticationLogicImpl authenticationLogic = Container .getComp (DefaultAuthenticationLogicImpl .class );
452+ LoginedUser loginedUser = getLoginedUser ();
453+ if (loginedUser != null ) {
454+ authenticationLogic .clearSession (request );
455+ authenticationLogic .setSession (loginedUser .getLoginUser ().getUserKey (), request );
456+ }
457+ }
446458
447459 /**
448460 * ログインユーザのIDを取得
@@ -456,35 +468,73 @@ public Integer getLoginUserId() {
456468 return loginedUser .getLoginUser ().getUserId ();
457469 }
458470
459-
471+ /**
472+ * request を取得
473+ * @return
474+ */
460475 public HttpServletRequest getRequest () {
461476 return request ;
462477 }
478+ /**
479+ * request をセット
480+ * @return
481+ */
463482 public void setRequest (HttpServletRequest request ) {
464483 this .request = request ;
465484 }
485+ /**
486+ * response を取得
487+ * @return
488+ */
466489 public HttpServletResponse getResponse () {
467490 return response ;
468491 }
492+ /**
493+ * response をセット
494+ * @return
495+ */
469496 public void setResponse (HttpServletResponse response ) {
470497 this .response = response ;
471498 }
499+ /**
500+ * invokeTarget を取得
501+ * @return
502+ */
472503 public InvokeTarget getInvokeTarget () {
473504 return invokeTarget ;
474505 }
475-
506+ /**
507+ * invokeTarget をセット
508+ * @return
509+ */
476510 public void setInvokeTarget (InvokeTarget invokeTarget ) {
477511 this .invokeTarget = invokeTarget ;
478512 }
513+ /**
514+ * path を取得
515+ * @return
516+ */
479517 public String getPath () {
480518 return path ;
481519 }
520+ /**
521+ * path をセット
522+ * @return
523+ */
482524 public void setPath (String path ) {
483525 this .path = path ;
484526 }
527+ /**
528+ * pathInfo を取得
529+ * @return
530+ */
485531 public String getPathInfo () {
486532 return pathInfo ;
487533 }
534+ /**
535+ * pathInfo をセット
536+ * @return
537+ */
488538 public void setPathInfo (String pathInfo ) {
489539 this .pathInfo = pathInfo ;
490540 }
@@ -611,23 +661,35 @@ protected String getParamWithDefault(String paramName, String defaultval) {
611661 }
612662 }
613663
614-
664+ /**
665+ * パラメータを取得
666+ * @param paramName
667+ * @param type
668+ * @return
669+ */
615670 protected <T > T getParam (String paramName , Class <? extends T > type ) {
616671 try {
617672 return HttpUtil .getParameter (request , paramName , type );
618673 } catch (InvalidParamException e ) {
619674 throw new SystemException (e );
620675 }
621676 }
622-
677+ /**
678+ * パラメータを取得
679+ * @param type
680+ * @return
681+ */
623682 protected <T > T getParams (Class <? extends T > type ) {
624683 try {
625684 return HttpUtil .parseRequest (request , type );
626685 } catch (InstantiationException | IllegalAccessException | JSONException | IOException | InvalidParamException e ) {
627686 throw new SystemException (e );
628687 }
629688 }
630-
689+ /**
690+ * パラメータをマップで取得
691+ * @return
692+ */
631693 protected Map <String , String > getParams () {
632694 Map <String , String > map = new HashMap <>();
633695 Enumeration <String > enumeration = request .getParameterNames ();
@@ -653,6 +715,16 @@ public void setSendEscapeHtml(boolean sendEscapeHtml) {
653715 this .sendEscapeHtml = sendEscapeHtml ;
654716 }
655717
718+ /**
719+ * パラメータをオブジェクトにセットして取得
720+ * @param type
721+ * @return
722+ * @throws InstantiationException
723+ * @throws IllegalAccessException
724+ * @throws JSONException
725+ * @throws IOException
726+ * @throws InvalidParamException
727+ */
656728 public <T > T getParamOnProperty (final Class <? extends T > type )
657729 throws InstantiationException , IllegalAccessException , JSONException , IOException , InvalidParamException {
658730 return HttpUtil .parseRequest (request , type );
0 commit comments