wire frameの作製
| @@ -0,0 +1,10 @@ | ||
| 1 | + | |
| 2 | +<tomcat-users> | |
| 3 | +<role rolename="staff"/> | |
| 4 | +<role rolename="customer"/> | |
| 5 | +<role rolename="admin"/> | |
| 6 | +<user username="aaa" password="aaa123!" roles="staff,customer"/> | |
| 7 | +<user username="bbb" password="bbb123!" roles="customer"/> | |
| 8 | +<user username="ccc" password="ccc123!" roles="staff"/> | |
| 9 | +<user username="admin1" password="secret123!" roles="admin,staff,customer"/> | |
| 10 | +</tomcat-users> |
| @@ -0,0 +1,93 @@ | ||
| 1 | +package sweep.web; | |
| 2 | + | |
| 3 | +/** 紙芝居用に利用するサーブレット。 | |
| 4 | + * 初期パラメータの forward:xxx に対応して画面を変更することができる。 | |
| 5 | + * <p>リクエストの page で表示に利用するサーブレットを切り替えることができる。 | |
| 6 | + */ | |
| 7 | +public class DemoServlet extends javax.servlet.http.HttpServlet { | |
| 8 | +javax.servlet.ServletConfig conf; | |
| 9 | +boolean empty(String tt) { return tt == null || tt.trim().length() == 0; } | |
| 10 | + | |
| 11 | +public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException { | |
| 12 | + conf = config; | |
| 13 | + super.init(config); | |
| 14 | + paramsEncoding = getInitParameter(JSPbase.PARAMS_ENCODING_NAME, JSPbase.DEFAULT_ENCODING); | |
| 15 | + javax.servlet.ServletContext sc = conf.getServletContext(); | |
| 16 | + sc.log(conf.getServletName() + ": #init " + JSPbase.PARAMS_ENCODING_NAME+ ": " + paramsEncoding); | |
| 17 | +} | |
| 18 | + | |
| 19 | +protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) | |
| 20 | + throws javax.servlet.ServletException, java.io.IOException { | |
| 21 | + String page = "forward:" + getParameter("page", "index", req); | |
| 22 | + forward(page, req, res); | |
| 23 | +} | |
| 24 | + | |
| 25 | +protected void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) | |
| 26 | + throws javax.servlet.ServletException, java.io.IOException { | |
| 27 | + String enc = req.getCharacterEncoding(); if (empty(enc)) req.setCharacterEncoding(paramsEncoding); | |
| 28 | + String page = "forward:" + getParameter("page", "index", req); | |
| 29 | + forward(page, req, res); | |
| 30 | +} | |
| 31 | + | |
| 32 | +static String DEFAULT_PARAM_ENCODING = "ISO8859_1"; | |
| 33 | + | |
| 34 | +/** 初期パラメータを入手する。 | |
| 35 | + * 見つからなければ コンテキストのパラメータを探す。それでも見つからなければ def を返却する | |
| 36 | + */ | |
| 37 | +String getInitParameter(String name, String def) { | |
| 38 | + String tt = conf.getInitParameter(name); | |
| 39 | + if (!empty(tt)) return tt; | |
| 40 | + tt = conf.getServletContext().getInitParameter(name); | |
| 41 | + if (!empty(tt)) return tt; | |
| 42 | + return def; | |
| 43 | +} | |
| 44 | + | |
| 45 | +protected static String [] EMPTY_VALUES = {}; | |
| 46 | +protected String paramsEncoding; | |
| 47 | + | |
| 48 | +String str(String tt) throws java.io.IOException { | |
| 49 | + if (empty(paramsEncoding)) return tt; | |
| 50 | + return empty(tt) ? "" : new String(tt.getBytes(DEFAULT_PARAM_ENCODING), paramsEncoding); | |
| 51 | +} | |
| 52 | + | |
| 53 | +/** ブラウザから渡ってくるパラメータを入手する。渡ってきていない場合のデフォルト値付き */ | |
| 54 | +String getParameter(String name, String def, javax.servlet.ServletRequest req) throws java.io.IOException { | |
| 55 | + String tt = req.getParameter(name); | |
| 56 | + return empty(tt) ? def : str(tt); | |
| 57 | +} | |
| 58 | + | |
| 59 | +String [] getParameterValues(String name, javax.servlet.ServletRequest req) throws java.io.IOException { | |
| 60 | + String [] ta = req.getParameterValues(name); | |
| 61 | + if (ta == null || ta.length == 0) return EMPTY_VALUES; | |
| 62 | + for (int i = 0; i < ta.length; i++) ta[i] = str(ta[i]); | |
| 63 | + return ta; | |
| 64 | +} | |
| 65 | + | |
| 66 | +/** パラメータに値があるか診断する */ | |
| 67 | +boolean hasParameter(String name, javax.servlet.http.HttpServletRequest req) { | |
| 68 | + return !empty(req.getParameter(name)); | |
| 69 | +} | |
| 70 | + | |
| 71 | +/** ページ切り替え。 | |
| 72 | + * @param path 切り替え先のURI。forward: で始まっている、 | |
| 73 | + * あるいはコロン(:)を含んでいなければ forward: を付与して初期パラメータから遷移先を入手する。 | |
| 74 | + * 遷移先のURLに // が含まれていれば ブラウザにリダイレクト要求するが、 | |
| 75 | + * そうでない場合は サーバ内で forward する。 | |
| 76 | + */ | |
| 77 | +void forward(String path, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) | |
| 78 | + throws javax.servlet.ServletException, java.io.IOException { | |
| 79 | + String rpath = path != null && path.startsWith("forward:") ? conf.getInitParameter(path) : | |
| 80 | + path != null && path.indexOf(':') < 0 ? conf.getInitParameter("forward:" + path) : path; | |
| 81 | + if (!empty(rpath)) { | |
| 82 | + if (rpath.indexOf("//") > 0) { res.sendRedirect(rpath); return; } | |
| 83 | + req.setAttribute(JSPbase.CONFIG_ATTR, conf); | |
| 84 | + // このサーブレットの初期パラメータに定義されているフォワード情報を利用してもらう。 | |
| 85 | + req.getRequestDispatcher(rpath).forward(req, res); | |
| 86 | + } | |
| 87 | + else { | |
| 88 | + res.sendError(res.SC_NOT_FOUND, "path: " + path + " not found in init-param for " + | |
| 89 | + conf.getServletName() + " of " + req.getServletPath()); | |
| 90 | + javax.servlet.ServletContext sc = conf.getServletContext(); | |
| 91 | + sc.log("WARNING: " + conf.getServletName() + ": paht: " + path + " not found."); | |
| 92 | + } | |
| 93 | +}} |
| @@ -0,0 +1,13 @@ | ||
| 1 | +package sweep.web; | |
| 2 | + | |
| 3 | +/** ファイルの基本情報のVO */ | |
| 4 | +public class FileInfo { | |
| 5 | +public String fileName, fileSize, description, folderName, fns[]; | |
| 6 | +public long size, modifiedOn; | |
| 7 | +public void setFileName(String tt) { fileName = tt; } | |
| 8 | +public void setFolderName(String tt) { folderName = tt; } | |
| 9 | +public void setFileSize(String tt) { fileSize = tt; } | |
| 10 | +public void setSize(int tt) { size = tt; } | |
| 11 | +public void setDescription(String tt) { description = tt; } | |
| 12 | +public void setFn(String [] tt) { fns = tt; } | |
| 13 | +} |
| @@ -0,0 +1,301 @@ | ||
| 1 | +package sweep.web; | |
| 2 | + | |
| 3 | +/** このパッケージが提供する一連の機能を利用するJSPの継承元になるクラス。 | |
| 4 | + * このクラスを継承するJSPの共通機能を定義することができる。 | |
| 5 | + */ | |
| 6 | +public abstract class JSPbase extends WebShared implements javax.servlet.jsp.HttpJspPage { | |
| 7 | +public static String DEFAULT_ENCODING = "utf-8", PARAMS_ENCODING_NAME = "prams-encoding"; | |
| 8 | +public static String CONFIG_ATTR = "waf.config"; | |
| 9 | + | |
| 10 | +protected String u(Object ref, javax.servlet.http.HttpServletResponse resp) { | |
| 11 | + return resp.encodeURL(u(ref)); | |
| 12 | +} | |
| 13 | + | |
| 14 | +/** 初期パラメータを入手する。サーブレット・パラメータに定義されていなければ、コンテキスト・パラメータから探す。 | |
| 15 | + * @param defString パラメータが定義されていないときに採用するデフォルト値。 | |
| 16 | + */ | |
| 17 | +protected String initParameter(String name, String defString, javax.servlet.ServletConfig config) { | |
| 18 | + String tt = config.getInitParameter(name); | |
| 19 | + if (!empty(tt)) tt = config.getServletContext().getInitParameter(name); | |
| 20 | + return empty(tt) ? defString : tt.trim(); | |
| 21 | +} | |
| 22 | + | |
| 23 | +public void jspInit() { } | |
| 24 | +public void jspDestroy() { } | |
| 25 | +public void destroy() { jspDestroy(); } | |
| 26 | + | |
| 27 | +private javax.servlet.ServletConfig config; | |
| 28 | +public javax.servlet.ServletConfig getServletConfig() { return config; } | |
| 29 | +public String getServletInfo() { return getClass().getName(); } | |
| 30 | + | |
| 31 | +protected String paramsEncoding; | |
| 32 | +public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException { | |
| 33 | + this.config = config; | |
| 34 | + paramsEncoding = initParameter(PARAMS_ENCODING_NAME, DEFAULT_ENCODING, config); | |
| 35 | + jspInit(); | |
| 36 | +} | |
| 37 | + | |
| 38 | + | |
| 39 | +protected static String [] EMPTY_VALUES = {}; | |
| 40 | + | |
| 41 | +protected String valueOf(int index, String aa[]) { | |
| 42 | + return aa == null || index < aa.length ? aa[index] :""; | |
| 43 | +} | |
| 44 | + | |
| 45 | +protected String str(String tt) throws java.io.IOException { | |
| 46 | + return empty(tt) ? "" : new String(tt.getBytes("ISO8859_1"), paramsEncoding); | |
| 47 | +} | |
| 48 | + | |
| 49 | +protected boolean hasParameter(String name, javax.servlet.ServletRequest req) throws java.io.IOException { | |
| 50 | + return!empty(req.getParameter(name)); | |
| 51 | +} | |
| 52 | + | |
| 53 | +protected String getParameter(String name, javax.servlet.ServletRequest req) throws java.io.IOException { | |
| 54 | + String tt = req.getParameter(name); return str(tt); | |
| 55 | +} | |
| 56 | + | |
| 57 | +protected String [] getParameterValues(String name, javax.servlet.ServletRequest req) throws java.io.IOException { | |
| 58 | + String [] ta = req.getParameterValues(name); | |
| 59 | + if (ta == null || ta.length == 0) return EMPTY_VALUES; | |
| 60 | + for (int i = 0; i < ta.length; i++) ta[i] = str(ta[i]); | |
| 61 | + return ta; | |
| 62 | +} | |
| 63 | + | |
| 64 | +/** パラメータに値があるか診断する */ | |
| 65 | +protected boolean hasParameter(String name, javax.servlet.http.HttpServletRequest req) { | |
| 66 | + return !empty(req.getParameter(name)); | |
| 67 | +} | |
| 68 | + | |
| 69 | +protected String basename(String url) { | |
| 70 | + int pos = url.lastIndexOf("/"); | |
| 71 | + return url.substring(pos + 1); | |
| 72 | +} | |
| 73 | + | |
| 74 | +/** ページ切り替え。Pathが forward: で始まっていれば初期パラメータから遷移先を入手する */ | |
| 75 | +protected void forward(String path, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) | |
| 76 | + throws javax.servlet.ServletException, java.io.IOException { | |
| 77 | + javax.servlet.ServletConfig conf = (javax.servlet.ServletConfig)req.getAttribute(CONFIG_ATTR); | |
| 78 | + if (conf == null) conf = config; | |
| 79 | + // 制御元の config を入手する。できなければ自分のを利用する。 | |
| 80 | + javax.servlet.ServletContext sc = conf.getServletContext(); | |
| 81 | + String rpath = path != null && path.startsWith("forward:") ? conf.getInitParameter(path) : | |
| 82 | + path != null && path.indexOf(':') < 0 ? conf.getInitParameter("forward:" + path) : path; | |
| 83 | + if (!empty(rpath)) { | |
| 84 | + sc.log("#forward: " + path + " to " + rpath); | |
| 85 | + if (rpath.indexOf("//") > 0) | |
| 86 | + res.sendRedirect(rpath); | |
| 87 | + else | |
| 88 | + req.getRequestDispatcher(rpath).forward(req, res); | |
| 89 | + } | |
| 90 | + else { | |
| 91 | + res.sendError(res.SC_NOT_FOUND, "path: " + path + " not found in init-param for " + | |
| 92 | + conf.getServletName() + " of " + req.getServletPath()); | |
| 93 | + sc.log("WARNING: " + conf.getServletName() + ": paht: " + path + " not found."); | |
| 94 | + } | |
| 95 | +} | |
| 96 | + | |
| 97 | +/* POST時にパラメータのエンコーディングを設定する */ | |
| 98 | +public void service(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws javax.servlet.ServletException, java.io.IOException { | |
| 99 | + javax.servlet.http.HttpServletRequest req = (javax.servlet.http.HttpServletRequest)request; | |
| 100 | + if ("POST".equalsIgnoreCase(req.getMethod())) { | |
| 101 | + if (!empty(paramsEncoding) && empty(req.getCharacterEncoding())) | |
| 102 | + req.setCharacterEncoding(paramsEncoding); | |
| 103 | + } | |
| 104 | + _jspService(req, (javax.servlet.http.HttpServletResponse)response); | |
| 105 | +}} | |
| 106 | + | |
| 107 | + | |
| 108 | +/** パッケージの共通機能が定義されています。 */ | |
| 109 | +class WebShared { | |
| 110 | +static final boolean empty1(String tt) { return tt == null || tt.trim().length() == 0; } | |
| 111 | +protected boolean empty(String tt) { return tt == null || tt.trim().length() == 0; } | |
| 112 | +protected boolean empty(Object [] aa) { return aa == null || aa.length == 0; } | |
| 113 | +protected boolean empty(java.util.Collection coll) { return coll == null || coll.isEmpty(); } | |
| 114 | + | |
| 115 | +static java.io.File file(String name) { return new java.io.File(name); } | |
| 116 | +static java.io.File file(String name, String dir) { return !empty1(dir) ? new java.io.File(dir,name) : file(name); } | |
| 117 | + | |
| 118 | +static String nvl(Object t,String r) { return t == null ? r : t.toString(); } | |
| 119 | + | |
| 120 | +/** 現在のunix時刻の入手 */ | |
| 121 | +long timeMillis() { return System.currentTimeMillis(); } | |
| 122 | + | |
| 123 | +public static java.io.PrintStream syserr = System.err; | |
| 124 | +static final char WIDE_SPACE_CHAR = '\u3000'; | |
| 125 | +protected static String [] EMPTY_VALUES = {}; | |
| 126 | + | |
| 127 | +/** テキストの前後の空白を除く。いわゆる全角スペースにも対応する。*/ | |
| 128 | +protected static String trim(String tt) { | |
| 129 | + if (tt == null) return ""; | |
| 130 | + int st = 0, len = tt.length(); | |
| 131 | + char cc; | |
| 132 | + while (st < len && (Character.isWhitespace(cc = tt.charAt(st)) || cc == WIDE_SPACE_CHAR)) st++; | |
| 133 | + while (st < len && (Character.isWhitespace(cc = tt.charAt(len - 1)) || cc == WIDE_SPACE_CHAR)) len--; | |
| 134 | + return st > 0 || len < tt.length() ? tt.substring(st,len) : tt; | |
| 135 | +} | |
| 136 | + | |
| 137 | +/** 先頭の空白文字を除去したテキストを返す */ | |
| 138 | +static String ltrim(String t) { | |
| 139 | + if (t == null) return t; | |
| 140 | + int p = 0, len = t.length(); | |
| 141 | + char cc; | |
| 142 | + while (p < len && (Character.isWhitespace(cc = t.charAt(p)) || cc == WIDE_SPACE_CHAR)) p++; | |
| 143 | + return t.substring(p); | |
| 144 | +} | |
| 145 | + | |
| 146 | +/** 末尾の空白文字を除去したテキストを返す */ | |
| 147 | +static String rtrim(String t) { | |
| 148 | + int p = t.length() - 1; | |
| 149 | + char cc; | |
| 150 | + while (p > 0 && (Character.isWhitespace(cc = t.charAt(p)) || cc == WIDE_SPACE_CHAR)) p--; | |
| 151 | + return t.substring(0, p + 1); | |
| 152 | +} | |
| 153 | + | |
| 154 | +/** 真偽値の判定。*/ | |
| 155 | +static boolean testFlag(String t, boolean def) { | |
| 156 | + if (t == null || t.length() < 1) return def; | |
| 157 | + switch(t.charAt(0)) { | |
| 158 | + case 't': case 'T': case 'y': case 'Y': case '1': return true; | |
| 159 | + case 'f': case 'F': case 'n': case 'N': return false; | |
| 160 | + } | |
| 161 | + return "on".equalsIgnoreCase(t); | |
| 162 | +} | |
| 163 | + | |
| 164 | + | |
| 165 | +/** HTML特殊文字の置き換え。*/ | |
| 166 | +static StringBuilder q(StringBuilder buf, Object a) { | |
| 167 | + if (buf == null || a == null) return buf; | |
| 168 | + String s = a.toString(), t; | |
| 169 | + int len = s.length(); | |
| 170 | + for (int i = 0; i < len; i++) { | |
| 171 | + char c = s.charAt(i); | |
| 172 | + switch (c) { | |
| 173 | + case '<': t = "<"; break; | |
| 174 | + case '>': t = ">"; break; | |
| 175 | + case '&': t = "&"; break; | |
| 176 | + case '"': t = """; break; | |
| 177 | + default: buf.append(c); continue; | |
| 178 | + } | |
| 179 | + buf.append(t); | |
| 180 | + } | |
| 181 | + return buf; | |
| 182 | +} | |
| 183 | + | |
| 184 | +protected String q(Object a) { | |
| 185 | + return q(new StringBuilder(80), a).toString(); | |
| 186 | +} | |
| 187 | + | |
| 188 | +protected String q(String a) { | |
| 189 | + return q(new StringBuilder(80), a).toString(); | |
| 190 | +} | |
| 191 | + | |
| 192 | +protected String qq(Object a) { | |
| 193 | + if (a == null) return " "; | |
| 194 | + return q(new StringBuilder(80), a).toString(); | |
| 195 | +} | |
| 196 | + | |
| 197 | +static String Hex = "0123456789ABCDEF"; | |
| 198 | + | |
| 199 | +/** urlencode変換したテキストを得る。想定するエンコーディングは "utf-8"。 | |
| 200 | + * 別のエンコードを指定する場合は {@link #u(Object, String)} を利用すること。 | |
| 201 | + * @param tt こちらのオブジェクトの #toString を呼び出し、それをurlencode変換する。 | |
| 202 | +*/ | |
| 203 | +protected String u(Object tt) { | |
| 204 | + if (tt == null) return ""; | |
| 205 | + try { | |
| 206 | + return u(tt, "UTF-8"); | |
| 207 | + } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } | |
| 208 | +} | |
| 209 | + | |
| 210 | +protected String u(Object t, String encoding) throws java.io.UnsupportedEncodingException { | |
| 211 | + if (t == null) return ""; | |
| 212 | + byte [] tb = t.toString().getBytes(encoding); | |
| 213 | + | |
| 214 | + StringBuilder sb = new StringBuilder(); | |
| 215 | + for (int i = 0; i < tb.length; i++) { | |
| 216 | + char ch = (char)tb[i]; | |
| 217 | + switch(tb[i]) { | |
| 218 | + case 0x20: | |
| 219 | + sb.append('+'); | |
| 220 | + continue; | |
| 221 | + case '.': case '-': case '_': | |
| 222 | + sb.append(ch); | |
| 223 | + continue; | |
| 224 | + default: | |
| 225 | + if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) { | |
| 226 | + sb.append(ch); | |
| 227 | + continue; | |
| 228 | + } | |
| 229 | + sb.append('%').append(Hex.charAt((ch >> 4) & 0xf)).append(Hex.charAt((ch & 0xf))); | |
| 230 | + } | |
| 231 | + } | |
| 232 | + return sb.toString(); | |
| 233 | +} | |
| 234 | + | |
| 235 | +static int _copyBufferSize = 1024; | |
| 236 | + | |
| 237 | +/** ストリームの内容をコピーします。 | |
| 238 | + * <p>srcは自動的に閉じられます。 | |
| 239 | + * @param dst 出力先ストリーム | |
| 240 | + * @param src 入力元ストリーム | |
| 241 | + */ | |
| 242 | +long copyStream(java.io.OutputStream dst, java.io.InputStream src) throws java.io.IOException{ | |
| 243 | + long ct = 0; | |
| 244 | + if (src == null) return ct; | |
| 245 | + if (dst == null) { syserr.println("#copyStream: dst is null"); return ct; } | |
| 246 | + | |
| 247 | + Thread th = Thread.currentThread(); | |
| 248 | + | |
| 249 | + byte buf[] = new byte[_copyBufferSize]; int n; | |
| 250 | + try { | |
| 251 | + while ((n = src.read(buf)) > 0) { | |
| 252 | + if (th.isInterrupted()) throw new java.io.IOException("Thread interrupted"); | |
| 253 | + /* | |
| 254 | + * スレッドに割り込みがかかっている場合は中断します。 | |
| 255 | + */ | |
| 256 | + ct += n; dst.write(buf, 0, n); } | |
| 257 | + return ct; | |
| 258 | + } finally { src.close(); } | |
| 259 | +}} | |
| 260 | + | |
| 261 | + | |
| 262 | +/** このパッケージの実装クラスが投げるIO例外 */ | |
| 263 | +class WebIOException extends java.io.IOException { | |
| 264 | +Throwable detail; | |
| 265 | + | |
| 266 | +WebIOException(String msg) { super(msg); } | |
| 267 | +WebIOException(Throwable cause) { this(cause.getMessage(), cause); } | |
| 268 | +WebIOException(String msg, Throwable cause) { super(msg); detail = cause; } | |
| 269 | + | |
| 270 | +public String getMessage() { | |
| 271 | + if(detail == null) return super.getMessage(); | |
| 272 | + String msg = super.getMessage(), nest = detail.toString(); | |
| 273 | + if (msg.equals(nest)) return msg; | |
| 274 | + return new StringBuffer(msg.length() + nest.length() + 100). | |
| 275 | + append(msg).append("; nested exception is: \n\t").append(nest).toString(); | |
| 276 | +} | |
| 277 | + | |
| 278 | +public void printStackTrace() { printStackTrace(System.err); } | |
| 279 | +public void printStackTrace(java.io.PrintStream out) { | |
| 280 | + if(detail == null) { | |
| 281 | + super.printStackTrace(out); | |
| 282 | + return; | |
| 283 | + } | |
| 284 | + synchronized(out) { | |
| 285 | + super.printStackTrace(out); | |
| 286 | + out.println("\tnested exception is: "); | |
| 287 | + detail.printStackTrace(out); | |
| 288 | + } | |
| 289 | +} | |
| 290 | + | |
| 291 | +public void printStackTrace(java.io.PrintWriter out) { | |
| 292 | + if(detail == null) { | |
| 293 | + super.printStackTrace(out); | |
| 294 | + return; | |
| 295 | + } | |
| 296 | + synchronized(out) { | |
| 297 | + super.printStackTrace(out); | |
| 298 | + out.println("\tnested exception is: "); | |
| 299 | + detail.printStackTrace(out); | |
| 300 | + } | |
| 301 | +}} |
| @@ -0,0 +1,24 @@ | ||
| 1 | +package sweep.web; | |
| 2 | + | |
| 3 | +/** ユーザ・プロフィール情報を保持するVO */ | |
| 4 | +public class ProfileInfo extends UserBasicInfo { | |
| 5 | +public String yomi, roman, zip, address1, address2, roomNo, phone, fax, gender; | |
| 6 | +public String pcode, gcode, person, subject, reason, description; | |
| 7 | +public long modifiedOn, createdOn; | |
| 8 | +public void setYomi(String tt) { yomi = tt; } | |
| 9 | +public void setRoman(String tt) { roman = tt; } | |
| 10 | +public void setZip(String tt) { zip = tt; } | |
| 11 | +public void setAddress1(String tt) { address1 = tt; } | |
| 12 | +public void setAddress2(String tt) { address2 = tt; } | |
| 13 | +public void setRoomNo(String tt) { roomNo = tt; } | |
| 14 | +public void setPhone(String tt) { phone = tt; } | |
| 15 | +public void setFax(String tt) { fax = tt; } | |
| 16 | +public static String MAILE = "M", FEMAIL = "F", UNKOWN = "U", JURIDICAL_PERSON = "J"; | |
| 17 | +public void setGender(String tt) { gender = tt; } | |
| 18 | +public void setPersonCode(String tt) { pcode = tt; } | |
| 19 | +public void setGroupCode(String tt) { gcode = tt; } | |
| 20 | +public void setPerson(String tt) { person = tt; } | |
| 21 | +public void setReason(String tt) { reason = tt; } | |
| 22 | +public void setSubject(String tt) { subject = tt; } | |
| 23 | +public void setDescription(String tt) { description = tt; } | |
| 24 | +} |
| @@ -0,0 +1,12 @@ | ||
| 1 | +package sweep.web; | |
| 2 | + | |
| 3 | +/** サインアップ等で利用するユーザ基本情報を保持するVO */ | |
| 4 | +public class UserBasicInfo { | |
| 5 | +public String name, email, passwd, oldPasswd, account, hash; | |
| 6 | +public void setName(String tt) { name = tt; } | |
| 7 | +public void setEmail(String tt) { email = tt; } | |
| 8 | +public void setPassword(String tt) { passwd = tt; } | |
| 9 | +public void setOldPassword(String tt) { oldPasswd = tt; } | |
| 10 | +public void setAccount(String tt) { account = tt; } | |
| 11 | +public void setHash(String tt) { hash = tt; } | |
| 12 | +} |
| @@ -0,0 +1,46 @@ | ||
| 1 | +<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 2 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> | |
| 3 | + | |
| 4 | +<display-name>fire-frame-JavaEE5</display-name> | |
| 5 | +<description> | |
| 6 | +画面遷移を遷移を確認するための紙芝居Webアプリケーション。 | |
| 7 | +JavaEE6/Servlet API 2.5向け | |
| 8 | +</description> | |
| 9 | + | |
| 10 | +<context-param> | |
| 11 | + <param-name>param-encoding</param-name> | |
| 12 | + <param-value>utf-8</param-value> | |
| 13 | + <description>エンコーディング指定</description> | |
| 14 | +</context-param> | |
| 15 | + | |
| 16 | +<servlet> | |
| 17 | + <servlet-name>demo</servlet-name> | |
| 18 | + <description>ワイヤーフレーム用のJSPに遷移する</description> | |
| 19 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 20 | + <init-param> | |
| 21 | + <description>初期画面</description> | |
| 22 | + <param-name>forward:index</param-name> | |
| 23 | + <param-value>/index.html</param-value> | |
| 24 | + </init-param> | |
| 25 | + <init-param> | |
| 26 | + <description>HTML4のテンプレート画面</description> | |
| 27 | + <param-name>forward:html4</param-name> | |
| 28 | + <param-value>/demodoc/temp4.jsp</param-value> | |
| 29 | + </init-param> | |
| 30 | + <init-param> | |
| 31 | + <description>HTML5のテンプレート画面</description> | |
| 32 | + <param-name>forward:html5</param-name> | |
| 33 | + <param-value>/demodoc/temp5.jsp</param-value> | |
| 34 | + </init-param> | |
| 35 | +</servlet> | |
| 36 | + | |
| 37 | +<servlet-mapping> | |
| 38 | + <servlet-name>demo</servlet-name> | |
| 39 | + <url-pattern>/aa/*</url-pattern> | |
| 40 | +</servlet-mapping> | |
| 41 | + | |
| 42 | +<welcome-file-list> | |
| 43 | + <welcome-file>index.html</welcome-file> | |
| 44 | +</welcome-file-list> | |
| 45 | + | |
| 46 | +</web-app> |
| @@ -0,0 +1,242 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" | |
| 3 | +xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" | |
| 4 | +xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" > | |
| 5 | + | |
| 6 | +<display-name>fire-frame-JavaEE6</display-name> | |
| 7 | +<description> | |
| 8 | +画面遷移を遷移を確認するための紙芝居Webアプリケーション。 | |
| 9 | +JavaEE6/Servlet API 3.0向け | |
| 10 | +</description> | |
| 11 | + | |
| 12 | +<context-param> | |
| 13 | + <param-name>param-encoding</param-name> | |
| 14 | + <param-value>utf-8</param-value> | |
| 15 | + <description>エンコーディング指定</description> | |
| 16 | +</context-param> | |
| 17 | + | |
| 18 | +<servlet> | |
| 19 | + <servlet-name>demo</servlet-name> | |
| 20 | + <description>ワイヤーフレーム用のJSPに遷移する</description> | |
| 21 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 22 | + <init-param> | |
| 23 | + <description>初期画面</description> | |
| 24 | + <param-name>forward:index</param-name> | |
| 25 | + <param-value>/index.html</param-value> | |
| 26 | + </init-param> | |
| 27 | + <init-param> | |
| 28 | + <description>HTML4のテンプレート画面</description> | |
| 29 | + <param-name>forward:html4</param-name> | |
| 30 | + <param-value>/sitedoc/temp4.jsp</param-value> | |
| 31 | + </init-param> | |
| 32 | + <init-param> | |
| 33 | + <description>HTML5のテンプレート画面</description> | |
| 34 | + <param-name>forward:html5</param-name> | |
| 35 | + <param-value>/sitedoc/temp5.jsp</param-value> | |
| 36 | + </init-param> | |
| 37 | +</servlet> | |
| 38 | + | |
| 39 | +<servlet> | |
| 40 | + <servlet-name>sign-up</servlet-name> | |
| 41 | + <description>アカウント登録(顧客向け)</description> | |
| 42 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 43 | + <init-param> | |
| 44 | + <description>初期画面</description> | |
| 45 | + <param-name>forward:index</param-name> | |
| 46 | + <param-value>/authdoc/sign-up.jsp</param-value> | |
| 47 | + </init-param> | |
| 48 | + <init-param> | |
| 49 | + <description>入力確認画面</description> | |
| 50 | + <param-name>forward:confirm</param-name> | |
| 51 | + <param-value>/authdoc/sign-up-confirm.jsp</param-value> | |
| 52 | + </init-param> | |
| 53 | + <init-param> | |
| 54 | + <description>メール送付連絡画面</description> | |
| 55 | + <param-name>forward:mailsent</param-name> | |
| 56 | + <param-value>/authdoc/sign-up-mailsent.jsp</param-value> | |
| 57 | + </init-param> | |
| 58 | + <init-param> | |
| 59 | + <description>送付メール文確認画面(テスト用)</description> | |
| 60 | + <param-name>forward:message</param-name> | |
| 61 | + <param-value>/authdoc/sign-up-mailtext.jsp</param-value> | |
| 62 | + </init-param> | |
| 63 | +</servlet> | |
| 64 | + | |
| 65 | +<servlet> | |
| 66 | + <servlet-name>confirm</servlet-name> | |
| 67 | + <description>ユーザ登録最終手続き用</description> | |
| 68 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 69 | + <init-param> | |
| 70 | + <description>初期画面</description> | |
| 71 | + <param-name>forward:index</param-name> | |
| 72 | + <param-value>/authdoc/confirm-hash.jsp</param-value> | |
| 73 | + </init-param> | |
| 74 | + <init-param> | |
| 75 | + <description>確認完了</description> | |
| 76 | + <param-name>forward:done</param-name> | |
| 77 | + <param-value>/authdoc/confirm-done.jsp</param-value> | |
| 78 | + </init-param> | |
| 79 | + <init-param> | |
| 80 | + <description>法人登録画面</description> | |
| 81 | + <param-name>forward:account</param-name> | |
| 82 | + <param-value>/authdoc/confirm-account.jsp</param-value> | |
| 83 | + </init-param> | |
| 84 | +</servlet> | |
| 85 | + | |
| 86 | +<servlet> | |
| 87 | + <servlet-name>reset-passwd</servlet-name> | |
| 88 | + <description>パスワードリセット(顧客向け)</description> | |
| 89 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 90 | + <init-param> | |
| 91 | + <description>初期画面</description> | |
| 92 | + <param-name>forward:index</param-name> | |
| 93 | + <param-value>/authdoc/reset-passwd.jsp</param-value> | |
| 94 | + </init-param> | |
| 95 | + <init-param> | |
| 96 | + <description>確認画面</description> | |
| 97 | + <param-name>forward:confirm</param-name> | |
| 98 | + <param-value>/authdoc/reset-confirm.jsp</param-value> | |
| 99 | + </init-param> | |
| 100 | +</servlet> | |
| 101 | + | |
| 102 | +<servlet> | |
| 103 | + <servlet-name>change-passwd</servlet-name> | |
| 104 | + <description>パスワード変更(顧客向け)</description> | |
| 105 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 106 | + <init-param> | |
| 107 | + <description>初期画面</description> | |
| 108 | + <param-name>forward:index</param-name> | |
| 109 | + <param-value>/authdoc/passwd-change.jsp</param-value> | |
| 110 | + </init-param> | |
| 111 | + <init-param> | |
| 112 | + <description>パスワード変更の確認画面</description> | |
| 113 | + <param-name>forward:confirm</param-name> | |
| 114 | + <param-value>/authdoc/passwd-confirm.jsp</param-value> | |
| 115 | + </init-param> | |
| 116 | +</servlet> | |
| 117 | + | |
| 118 | +<servlet> | |
| 119 | + <servlet-name>files</servlet-name> | |
| 120 | + <description>パスワード変更(顧客向け)</description> | |
| 121 | + <servlet-class>webdemo.DemoServlet</servlet-class> | |
| 122 | + <init-param> | |
| 123 | + <description>初期画面</description> | |
| 124 | + <param-name>forward:index</param-name> | |
| 125 | + <param-value>/testdoc/files.jsp</param-value> | |
| 126 | + </init-param> | |
| 127 | +</servlet> | |
| 128 | + | |
| 129 | +<servlet-mapping> | |
| 130 | + <servlet-name>files</servlet-name> | |
| 131 | + <url-pattern>/bb/*</url-pattern> | |
| 132 | +</servlet-mapping> | |
| 133 | + | |
| 134 | +<servlet-mapping> | |
| 135 | + <servlet-name>demo</servlet-name> | |
| 136 | + <url-pattern>/aa/*</url-pattern> | |
| 137 | + <url-pattern>/home/*</url-pattern> | |
| 138 | + <url-pattern>/staff/*</url-pattern> | |
| 139 | +</servlet-mapping> | |
| 140 | + | |
| 141 | +<servlet-mapping> | |
| 142 | + <servlet-name>sign-up</servlet-name> | |
| 143 | + <url-pattern>/signup/*</url-pattern> | |
| 144 | +</servlet-mapping> | |
| 145 | + | |
| 146 | +<servlet-mapping> | |
| 147 | + <servlet-name>confirm</servlet-name> | |
| 148 | + <url-pattern>/confirm/*</url-pattern> | |
| 149 | +</servlet-mapping> | |
| 150 | + | |
| 151 | +<servlet-mapping> | |
| 152 | + <servlet-name>reset-passwd</servlet-name> | |
| 153 | + <url-pattern>/reset/*</url-pattern> | |
| 154 | +</servlet-mapping> | |
| 155 | + | |
| 156 | +<servlet-mapping> | |
| 157 | + <servlet-name>change-passwd</servlet-name> | |
| 158 | + <url-pattern>/chpass/*</url-pattern> | |
| 159 | +</servlet-mapping> | |
| 160 | + | |
| 161 | +<security-constraint> | |
| 162 | + <web-resource-collection> | |
| 163 | + <web-resource-name>管理者向け画面</web-resource-name> | |
| 164 | + <url-pattern>/admin/*</url-pattern> | |
| 165 | + <http-method>HEAD</http-method> | |
| 166 | + <http-method>GET</http-method> | |
| 167 | + <http-method>POST</http-method> | |
| 168 | + </web-resource-collection> | |
| 169 | + <auth-constraint> | |
| 170 | + <role-name>admin</role-name> | |
| 171 | + </auth-constraint> | |
| 172 | +</security-constraint> | |
| 173 | + | |
| 174 | +<security-constraint> | |
| 175 | + <web-resource-collection> | |
| 176 | + <web-resource-name>一般社員画面</web-resource-name> | |
| 177 | + <url-pattern>/staff/*</url-pattern> | |
| 178 | + <http-method>HEAD</http-method> | |
| 179 | + <http-method>GET</http-method> | |
| 180 | + <http-method>POST</http-method> | |
| 181 | + </web-resource-collection> | |
| 182 | + <auth-constraint> | |
| 183 | + <role-name>admin</role-name> | |
| 184 | + <role-name>staff</role-name> | |
| 185 | + </auth-constraint> | |
| 186 | +</security-constraint> | |
| 187 | + | |
| 188 | +<security-constraint> | |
| 189 | + <web-resource-collection> | |
| 190 | + <web-resource-name>一般ユーザ画面</web-resource-name> | |
| 191 | + <url-pattern>/home/*</url-pattern> | |
| 192 | + <http-method>HEAD</http-method> | |
| 193 | + <http-method>GET</http-method> | |
| 194 | + <http-method>POST</http-method> | |
| 195 | + </web-resource-collection> | |
| 196 | + <auth-constraint> | |
| 197 | + <role-name>staff</role-name> | |
| 198 | + </auth-constraint> | |
| 199 | +</security-constraint> | |
| 200 | + | |
| 201 | +<!-- Basic認証を利用する場合 | |
| 202 | +開発時はこちらが便利 | |
| 203 | +--> | |
| 204 | +<login-config> | |
| 205 | + <auth-method>BASIC</auth-method> | |
| 206 | + <realm-name>demo realm</realm-name> | |
| 207 | +</login-config> | |
| 208 | + | |
| 209 | +<!-- Form認証を利用する場合 | |
| 210 | +サインアウトの機能を実装する場合はこちら | |
| 211 | + | |
| 212 | +<login-config> | |
| 213 | + <auth-method>FORM</auth-method> | |
| 214 | + <realm-name>demodoc-form-realm</realm-name> | |
| 215 | + <form-login-config> | |
| 216 | + <form-login-page>/demodoc/signin.html</form-login-page> | |
| 217 | + <form-error-page>/demodoc/signin-error.html</form-error-page> | |
| 218 | + </form-login-config> | |
| 219 | +</login-config> | |
| 220 | +--> | |
| 221 | + | |
| 222 | +<security-role> | |
| 223 | + <description>サイト職員向けのロール</description> | |
| 224 | + <role-name>staff</role-name> | |
| 225 | +</security-role> | |
| 226 | + | |
| 227 | +<security-role> | |
| 228 | + <description>サイト一般利用者向けのロール</description> | |
| 229 | + <role-name>customer</role-name> | |
| 230 | +</security-role> | |
| 231 | + | |
| 232 | +<security-role> | |
| 233 | + <description>職員管理者向けのロール</description> | |
| 234 | + <role-name>admin</role-name> | |
| 235 | +</security-role> | |
| 236 | + | |
| 237 | +<welcome-file-list> | |
| 238 | + <welcome-file>index.html</welcome-file> | |
| 239 | + <welcome-file>index.htm</welcome-file> | |
| 240 | +</welcome-file-list> | |
| 241 | + | |
| 242 | +</web-app> |
| @@ -0,0 +1,47 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 3 | + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" | |
| 4 | + version="2.4"> | |
| 5 | +<display-name>fire-frame-J2EE1.4</display-name> | |
| 6 | +<description> | |
| 7 | +画面遷移を遷移を確認するための紙芝居Webアプリケーション。 | |
| 8 | +J2EE1.4/Servlet API 2.4向け | |
| 9 | +</description> | |
| 10 | + | |
| 11 | +<context-param> | |
| 12 | + <param-name>param-encoding</param-name> | |
| 13 | + <param-value>utf-8</param-value> | |
| 14 | + <description>エンコーディング指定</description> | |
| 15 | +</context-param> | |
| 16 | + | |
| 17 | +<servlet> | |
| 18 | + <servlet-name>demo</servlet-name> | |
| 19 | + <description>ワイヤーフレーム用のJSPに遷移する</description> | |
| 20 | + <servlet-class>sweep.web.DemoServlet</servlet-class> | |
| 21 | + <init-param> | |
| 22 | + <description>初期画面</description> | |
| 23 | + <param-name>forward:index</param-name> | |
| 24 | + <param-value>/index.html</param-value> | |
| 25 | + </init-param> | |
| 26 | + <init-param> | |
| 27 | + <description>HTML4のテンプレート画面</description> | |
| 28 | + <param-name>forward:html4</param-name> | |
| 29 | + <param-value>/sitedoc/temp4.jsp</param-value> | |
| 30 | + </init-param> | |
| 31 | + <init-param> | |
| 32 | + <description>HTML5のテンプレート画面</description> | |
| 33 | + <param-name>forward:html5</param-name> | |
| 34 | + <param-value>/sitedoc/temp5.jsp</param-value> | |
| 35 | + </init-param> | |
| 36 | +</servlet> | |
| 37 | + | |
| 38 | +<servlet-mapping> | |
| 39 | + <servlet-name>demo</servlet-name> | |
| 40 | + <url-pattern>/aa/*</url-pattern> | |
| 41 | +</servlet-mapping> | |
| 42 | + | |
| 43 | +<welcome-file-list> | |
| 44 | + <welcome-file>index.html</welcome-file> | |
| 45 | +</welcome-file-list> | |
| 46 | + | |
| 47 | +</web-app> |
| @@ -0,0 +1,21 @@ | ||
| 1 | +<!DOCTYPE html> | |
| 2 | +<html> | |
| 3 | +<head><title>sample web app</title> | |
| 4 | +<meta http-equiv="content-type" charset="UTF-8"> | |
| 5 | +</head> | |
| 6 | +<body> | |
| 7 | +<h2>wire frame</h2> | |
| 8 | +<p>アプリの画面遷移を確認するための紙芝居Webアプリケーション</p> | |
| 9 | + | |
| 10 | +<h3>テンプレートの確認</h3> | |
| 11 | +<ul> | |
| 12 | +<li><a href='sitedoc/temp4.jsp'>HTML4 テンプレート (JSP直接参照)</a></li> | |
| 13 | +<li><a href='sitedoc/temp5.jsp'>HTML5 テンプレート(JSP直接参照)</a></li> | |
| 14 | + | |
| 15 | +<li><a href='aa?page=html4'>HTML4 テンプレート</a></li> | |
| 16 | +<li><a href='aa?page=html5'>HTML5 テンプレート</a></li> | |
| 17 | + | |
| 18 | +</ul> | |
| 19 | + | |
| 20 | + | |
| 21 | +</body></html> | |
| \ No newline at end of file |
| @@ -0,0 +1,13 @@ | ||
| 1 | +## sitedoc | |
| 2 | + | |
| 3 | +このフォルダにはサイトの共通画面で利用されるJSPと関連ファイルが含まれています。 | |
| 4 | + | |
| 5 | + | |
| 6 | +| JSPファイル | 説明 | | |
| 7 | +| --- | --- | | |
| 8 | +| body-footer.inc.jsp | ページ下部に出力するHTMLを生成する | | |
| 9 | +| body-header.inc.jsp | ページ上部に出力するHTMLを生成する | | |
| 10 | +| error-check.jsp | エラー画面の検査用HTML | | |
| 11 | +| header.inc.jsp | HTMLのヘッダー部に出力するHTMLを生成する | | |
| 12 | +| temp4.jsp | HTML4ドキュメントの雛型 | | |
| 13 | +| temp5.jsp | HTML5ドキュメントの雛型 | | |
| \ No newline at end of file |