Servlet(サーブレット)リファレンス(逆引き)

Servlet(サーブレット)リファレンス
 
Web struts.wasureppoi.com
セッションの生成時刻を取得する:HttpSession#getCreationTime()
スポンサード リンク

セッションの生成時刻を取得するには、HttpSession#getCreationTime()を使用します。

構文
javax.servlet.http.HttpSession
 public long getCreationTime( )
説明
getCreationTimeメソッドは、セッションが生成された時刻を取得します。

返される時刻は、1970年1月1日グリニッジ標準時 00:00:00.000 からの経過時間をミリ秒で表した数値です。
  
例1) セッション生成時刻を取得する。

public class SampleServlet extends HttpServlet {

   public void doGet( HttpServletRequest request, HttpServletResponse response )
           throws ServletException,IOException {

    response.setCharacterEncoding("Windows-31J");

    PrintWriter out = response.getWriter();
    out.println("<html><body>");
    HttpSession session = request.getSession();
    out.println("セッション生成時刻:" + new Date( session.getCreationTime() ) );
    out.println("</body></html>");
   }
}



スポンサード リンク


HttpSessionオブジェクトを取得する:HttpServletRequest#getSession()
セッション情報を取得する:HttpSession#getAttribute()
セッション情報を全て取得する:HttpSession#getAttributeNames()
セッション情報をセットする:HttpSession#setAttribute()
セッション情報を削除する:HttpSession#removeAttribute()
セッションを破棄する:HttpSession#invalidate()
セッションタイムアウトをセットする:HttpSession#setMaxInactiveInterval()
セッションタイムアウトを取得する:HttpSession#getMaxInactiveInterval()
新規セッションか確認する:HttpSession#isNew()
セッションの生成時刻を取得する:HttpSession#getCreationTime()
セッションの最終アクセス時刻を取得する:HttpSession#getLastAccessedTime()
セッションIDを取得する1:HttpSession#getId()
セッションIDを取得する2:HttpServletRequest#getRequestedSessionId()
セッションID管理はクッキーか確認する:HttpServletRequest#isRequestedSessionIdFromCookie()
セッションID管理はURLか確認する:HttpServletRequest#isRequestedSessionIdFromURL()
クッキー使用不可ブラウザにセッションIDを返す1:HttpServletResponse#encodeURL()
クッキー使用不可ブラウザにセッションIDを返す2:HttpServletResponse#encodeRedirectURL()

Servlet2へ
忘れっぽいエンジニアのJakarta Strutsリファレンス TOPへ