7.5.4 バックエンドシステム

バックエンドシステムで作成するファイルと記述例を次に示します。

<この項の構成>
(1) ログインページ(login.jsp)
(2) ログアウトページ(logout.jsp)
(3) サマリページ(portlet.jsp)

(1) ログインページ(login.jsp)

<%@  page session="true" contentType="text/html; charset=Shift_JIS"
         pageEncoding="Shift_JIS" %>
<%
 String uid = request.getParameter("uid");
 // サイトのエンコーディングがShift_JISの場合,次の処理を行う。
 uid = new String(uid.getBytes("iso-8859-1"),"Windows-31J");
 String passwd = request.getParameter("passwd");
 // サイトのエンコーディングがShift_JISの場合,次の処理を行う。
 passwd = new String(passwd.getBytes("iso-8859-1"),"Windows-31J");

 if (ユーザ認証(uid, passwd)) { // ユーザ認証
   // 認証OK
   session.setAttribute("uid", uid);
 }
%>

(2) ログアウトページ(logout.jsp)

<%@  page session="true" contentType="text/html; charset=Shift_JIS"
         pageEncoding="Shift_JIS" %>
<%
 // バックエンドはURL-Rewritingによって連携
 String url = response.encodeURL(バックエンドのコンテンツの絶対形式URL);
%>

<h2>ポートレット用画面</h2>
<a target="_blank" href="<%= url %>">バックエンドSSOアクセス</a>

(3) サマリページ(portlet.jsp)

<%@  page session="true" contentType="text/html; charset=Shift_JIS"
         pageEncoding="Shift_JIS" %>
<%
 session.removeAttribute("uid");
%>