OSDN Git Service

Initial commit
[ultramonkey-l7/l7gui.git] / src / WebContent / vs_modify.jsp
1 <%@ page import="org.ultramonkey.l7.model.*,
2                                  org.ultramonkey.l7.controller.*,
3                                  org.ultramonkey.l7.view.*, java.util.*"
4         language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
5 <%
6
7         /*
8          * check session
9          */
10         L7guiServletBase base = new L7guiServletBase();
11         if (session.isNew() || base.checkSession(session) == false) {
12                 MessageView error = new MessageView(41445, LogCategorySet.GUI_USER_AUTHENTICATION,
13                                 Message.INVALID_SESSSION);
14                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
15                 response.sendRedirect(RedirectPages.LOGIN);
16                 return;
17         }
18
19         /*
20          * get result message
21          */
22         MessageView message = (MessageView) session.getAttribute(SessionKeys.RESULT_MESSAGE);
23         String errorMessage = "";
24         int errorNumber = 0;
25         String category = "";
26         if (message != null) {
27                 errorMessage = message.getMessage();
28                 errorNumber = message.getErrno();
29                 category = message.getCategory();
30                 session.setAttribute(SessionKeys.RESULT_MESSAGE, null);
31         }
32
33         /*
34          * get validation error message
35          */
36         HashMap<String,String> errMessage = (HashMap<String,String>) session.getAttribute(SessionKeys.INVALID_MESSAGE);
37         session.setAttribute(SessionKeys.INVALID_MESSAGE,null);
38
39
40         L7guiFramework framework = new L7guiFramework();
41
42         /*
43          * get cluster status
44          */
45         ClusterData cd = framework.getClusterData();
46         if (cd == null) {
47                 MessageView error = new MessageView(41446, LogCategorySet.GUI_IO_COMMAND,
48                                 Message.CLUSTER_DATA_ERROR);
49                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
50                 response.sendRedirect(RedirectPages.LOGIN);
51                 return;
52         }
53
54         if ( (cd.self_status != ClusterStatus.ACTIVE) && (cd.self_status != ClusterStatus.SINGLE) ){
55                 response.sendRedirect(RedirectPages.TOPMENU);
56                 return;
57         }
58         
59         /*
60          * get l7directrod.cf data
61          */
62         DirectorData dd = framework.getDirectorData();
63         if (dd == null) {
64                 MessageView error = new MessageView(41447, LogCategorySet.GUI_IO_FILE,
65                                 Message.DIRECTOR_DATA_ERROR);
66                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
67                 response.sendRedirect(RedirectPages.LOGIN);
68                 return;
69         }
70         
71         /*
72          * get previous input value
73          */
74         VirtualSetting vs = (VirtualSetting) session.getAttribute(SessionKeys.INPUT_VS);
75         if (vs != null) {
76                 session.setAttribute(SessionKeys.INPUT_VS, null);
77         }
78         else {
79                 /*
80                  * get post data
81                  */
82                 String post = request.getParameter("vs"); // ex. "10.10.10.10:80:cinsert:--cookie-name monkey"
83                 if (post == null) {
84                         MessageView error = new MessageView(21101, LogCategorySet.GUI_VIRTUALSERVICE,
85                                         Message.VS_SELECT_ERROR);
86                         session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
87                         response.sendRedirect(RedirectPages.STATE_INFO);
88                         return;
89                 }
90
91                 String params[] = post.split(":", 4);
92                 if (params == null || params.length != 4) {
93                         MessageView error = new MessageView(41448, LogCategorySet.GUI_VIRTUALSERVICE,
94                                         Message.UNEXPECTED_ERROR);
95                         session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
96                         response.sendRedirect(RedirectPages.LOGIN);
97                         return;
98                 }
99
100                 /*
101                  * get l7vsadm data from L7guiFramework
102                  */
103                 L7vsAdmData admDataList = framework.getAdmData();
104                 if (admDataList == null) {
105                         MessageView error = new MessageView(41449, LogCategorySet.GUI_VIRTUALSERVICE,
106                                         Message.UNEXPECTED_ERROR);
107                         session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
108                         response.sendRedirect(RedirectPages.LOGIN);
109                         return;
110                 }
111                 /*
112                  * compare add l7vsadm data with post data
113                  */
114                 for (int i = 0; i < admDataList.virtualSettings.size(); i++) {
115                         VirtualSetting v = (VirtualSetting) admDataList.virtualSettings.elementAt(i);
116                         if (v.virtual.host.equals(params[0]) && v.virtual.port.equals(params[1]) &&
117                                         v.protomod.equals(params[2]) && v.option.equals(params[3])) {
118                                 vs = v;
119                                 break;
120                         }
121                 }
122                 
123                 for (VirtualSetting directordVs : dd.virtualSettings) {
124                         if (directordVs.isSameService(vs)) {
125                                 vs = directordVs;
126                         }
127                 }
128
129                 /*
130                  * error. no such VirtualService
131                  */
132                 if (vs == null) {
133                         MessageView error = new MessageView(41450, LogCategorySet.GUI_VIRTUALSERVICE,
134                                         Message.UNEXPECTED_ERROR);
135                         session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
136                         response.sendRedirect(RedirectPages.LOGIN);
137                         return;
138                 }
139         }
140         
141         /*
142          * backup input data
143          */
144         VirtualSetting oldVs = new VirtualSetting(vs);
145         session.setAttribute(SessionKeys.OLD_VS, oldVs);
146         
147         /*
148          * fix style seat
149          */
150         String cssSeat = "l7gui_single_style.css";
151         if ( cd.self_status == ClusterStatus.ACTIVE ){
152                 cssSeat = "l7gui_act_style.css";
153         }
154         else if ( cd.self_status == ClusterStatus.STANDBY ){
155                 cssSeat = "l7gui_sby_style.css";
156         }
157
158 %>
159
160 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
161 <html>
162         <head>
163                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
164                 <meta http-equiv="Pragma" content="no-cache">
165                 <meta http-equiv="Cache-Control" content="no-cache">
166                 <meta http-equiv="Expires" content="0">                 
167                 <meta http-equiv="Content-Script-Type" content="text/javascript" />
168                 <meta http-equiv="Content-Style-Type" content="text/css" />
169                 <script src="l7gui.js" type="text/javascript"></script>
170                 <noscript> 
171                         <meta http-equiv="refresh" content="<%= RedirectPages.NOSCRIPT_TIME %>; url=<%= RedirectPages.LOGIN %>"/>
172                 </noscript> 
173                 <link rel="stylesheet" type="text/css" href="<%=cssSeat %>" />
174                 <link rel="shortcut icon" href="images/favicon.ico" />
175         
176                 <title>Modify VirtualService</title>
177         </head>
178
179 <body class="normal">
180
181 <jsp:include page="menu.jsp" flush="false"/>
182
183
184 <div id="content">
185 <h1 class="title">Modify VirtualService (<%= vs.virtual.host %>:<%= vs.virtual.port %> <%= vs.protomod %> <%= vs.option %>)</h1>
186
187 <%
188         if ( (message != null) && (errorMessage != null)) {
189 %>
190                 <p class="error">[ <%=category %> - <%=errorNumber %>]</p>
191                 <p class="error"> <%=errorMessage %></p>
192 <%
193         }
194 %>
195
196 <form method="post" action="VSModServlet">
197         <h2 class="title">VirtualService Info</h2>
198
199         <fieldset class="">
200         <legend>Basic Settings</legend>
201
202         <table class="status">
203         <tr>
204                 <th>
205                         <label for="ip">Virtual IP address</label>
206                 </th>
207                 <td>
208                         <input type="text" id="ip" name="vip" value="<%= vs.virtual.host %>" maxlength="15" />
209                         <% 
210                                 if ( null != errMessage ){
211                                         String invalidMessage = errMessage.get("vip");
212                                         if( null != invalidMessage ){
213                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
214                                         }
215                                 }
216                         %>
217                 </td>
218                 <td>
219                         <p class="item">Required Field</p>
220                         <p class="required">[0-255].[0-255].[0-255].[0-255]</p>
221                 </td>
222         </tr>
223         <tr>
224                 <th>
225                         <label for="port">Port Number</label>
226                 </th>
227                 <td>
228                         <%
229                         {
230                                 String invalidMessage = null;
231                                 if ( null != errMessage ) {
232                                         invalidMessage = errMessage.get("port");
233                                 }
234                                 if ( null == vs.virtual.port ){
235                                         out.print("<input type=\"text\" id=\"port\" value=\"\" name=\"port\" />");
236                                 }
237                                 else {
238                                         out.print("<input type=\"text\" id=\"port\" value=\"" + vs.virtual.port + "\"name=\"port\" />");
239                                 }
240                                 if( null != invalidMessage ){
241                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
242                                 }
243                         }
244                         %>
245                 </td>
246                 <td>
247                         <p class="item">Required Field</p>
248                         <p class="required">1-65535</p>
249                 </td>
250         </tr>
251         <tr>
252                 <th>
253                         <label for="protomod">Persistence Type</label>
254                 </th>
255                 <td>
256                         <select id="protomod" name="protomod">
257                                 <option value="cinsert"<%
258                                 if (vs.protomod.equals("cinsert"))
259                                         out.print(" selected");
260                                 %>>Cookie Insert</option>
261                                 <option value="url"<%
262                                 if (vs.protomod.equals("url"))
263                                         out.print(" selected");
264                                 %>>URL Pattern</option>
265                                 <option value="sslid"<%
266                                 if (vs.protomod.equals("sslid"))
267                                         out.print(" selected");
268                                 %>>SSL Session ID</option>
269                                 <option value="sessionless"<%
270                                 if (vs.protomod.equals("sessionless"))
271                                         out.print(" selected");
272                                 %>>Sessionless</option>
273                         </select>
274                         <% 
275                                 if ( null != errMessage ){
276                                         String invalidMessage = errMessage.get("protomod");
277                                         if( null != invalidMessage ){
278                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
279                                         }
280                                 }
281                         %>
282                 </td>
283                 <td>
284                         <p class="item">Required Field</p>
285                 </td>
286         </tr>
287         <tr>
288                 <th>
289                         <label for="option">Persistence option</label>
290                 </th>
291                 <td>
292                         <input type="text" id="option" name="option" value="<%= vs.option %>" maxlength="127" />
293                         <% 
294                                 if ( null != errMessage ){
295                                         String invalidMessage = errMessage.get("option");
296                                         if( null != invalidMessage ){
297                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
298                                         }
299                                 }
300                         %>
301                 </td>
302                 <td>
303                         <p class="required">Up to 127 one-byte characters in English</p>
304                 </td>
305         </tr>
306         <tr>
307                 <th>
308                         <label for="sched">Scheduler Type</label>
309                 </th>
310                 <td>
311                         <select id="sched" name="sched">
312                                 <option value="rr"<%
313                                 if (vs.sched.equals("rr"))
314                                         out.print(" selected");
315                                 %>>Round Robin</option>
316                                 <option value="wrr"<%
317                                 if (vs.sched.equals("wrr"))
318                                         out.print(" selected");
319                                 %>>Weighted Round Robin</option>
320                                 <option value="lc"<%
321                                 if (vs.sched.equals("lc"))
322                                         out.print(" selected");
323                                 %>>Least Connection</option>
324                         </select>
325                         <% 
326                                 if ( null != errMessage ){
327                                         String invalidMessage = errMessage.get("sched");
328                                         if( null != invalidMessage ){
329                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
330                                         }
331                                 }
332                         %>
333                 </td>
334                 <td>
335                         <p class="required"></p>
336                 </td>
337         </tr>
338         </table>
339         </fieldset>
340         <fieldset class="">
341         <legend>Advanced Settings</legend>
342         <table class="status">
343         <tr>
344                 <th>
345                         <label for="qos_srv">QoS (per Virtual Service)</label>
346                 </th>
347                 <td>
348                         <%              
349                         {
350                                 String invalidMessage = null;
351                                 int unit_s = 0;
352                                 if ( null != errMessage ) {
353                                         invalidMessage = errMessage.get("qos_service");
354                                 }
355                                 if ( ( null != invalidMessage ) && ( 0 == vs.qosservice ) ){
356                                         out.print("<input type=\"text\" id=\"qos_srv\" value=\"\" name=\"qos_service\" size=\"3\" maxlength=\"3\" />");
357                                 }
358                                 else {
359                                         if ( invalidMessage == null ){ 
360                                                 while (vs.qosservice >= 1000) {
361                                                         vs.qosservice /= 1000;
362                                                         unit_s++;
363                                                 }
364                                         }
365                                         out.print("<input type=\"text\" id=\"qos_srv\" value=\"" + vs.qosservice + "\"name=\"qos_service\" size=\"3\" maxlength=\"3\" />");
366                                 }
367                         %>
368                         <select id="qos_srv" name="qos_service_unit">
369                                 <option value="bps"<%
370                                         if (unit_s == 0)
371                                                 out.print(" selected");
372                                 %>>bps</option>
373                                 <option value="Kbps"<%
374                                         if (unit_s == 1)
375                                                 out.print(" selected");
376                                 %>>Kbps</option>
377                                 <option value="Mbps"<%
378                                         if (unit_s == 2)
379                                                 out.print(" selected");
380                                 %>>Mbps</option>
381                                 <option value="Gbps"<%
382                                         if (unit_s == 3)
383                                                 out.print(" selected");
384                                 %>>Gbps</option>
385                         </select>
386                         <% 
387                                         if( null != invalidMessage ){
388                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
389                                         }
390                                 }
391                         %>                              
392                 </td>
393                 <td>
394                         <p class="required">0-999(bps/Kbps/Mbps/Gbps)</p>
395                 </td>
396         </tr>
397         <tr>
398                 <th>
399                         <label for="qos_conn">QoS (per Client)</label>
400                 </th>
401                 <td>
402                         <%
403                         {
404                                 String invalidMessage = null;
405                                 int unit_c = 0;
406                                 if ( null != errMessage ) {
407                                         invalidMessage = errMessage.get("qos_conn");
408                                 }
409                                 if ( ( null != invalidMessage ) && ( 0 == vs.qosclient ) ){
410                                         out.print("<input type=\"text\" id=\"qos_conn\" value=\"\" name=\"qos_conn\" size=\"3\" maxlength=\"3\" />");
411                                 }
412                                 else {
413                                         if ( null == invalidMessage ){
414                                                 while (vs.qosclient >= 1000) {
415                                                         vs.qosclient /= 1000;
416                                                         unit_c++;
417                                                 }
418                                         }
419                                         out.print("<input type=\"text\" id=\"qos_conn\" value=\"" + vs.qosclient + "\" name=\"qos_conn\" size=\"3\" maxlength=\"3\" />");
420                                 }
421                         %>
422                         <select id="qos_conn" name="qos_conn_unit">
423                                 <option value="bps"<%
424                                         if (unit_c == 0)
425                                                 out.print(" selected");
426                                 %>>bps</option>
427                                 <option value="Kbps"<%
428                                         if (unit_c == 1)
429                                                 out.print(" selected");
430                                 %>>Kbps</option>
431                                 <option value="Mbps"<%
432                                         if (unit_c == 2)
433                                                 out.print(" selected");
434                                 %>>Mbps</option>
435                                 <option value="Gbps"<%
436                                         if (unit_c == 3)
437                                                 out.print(" selected");
438                                 %>>Gbps</option>
439                         </select>
440                         <% 
441                                         if( null != invalidMessage ){
442                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
443                                         }
444                                 }
445                         %>
446                 </td>
447                 <td>
448                         <p class="required">0-999(bps/Kbps/Mbps/Gbps)</p>
449                 </td>
450         </tr>
451         <tr>
452                 <th>
453                         <label for="max_conn">Max Connections</label>
454                 </th>
455                 <td>
456                         <%
457                         {
458                                 String invalidMessage = null;
459                                 if ( null != errMessage ) {
460                                         invalidMessage = errMessage.get("max_conn");
461                                 }
462                                 if ( ( null != invalidMessage ) && ( 0 == vs.maxconn ) ){
463                                         out.print("<input type=\"text\" id=\"max_conn\" value=\"\" name=\"max_conn\" maxlength=\"6\" />");
464                                 }
465                                 else {
466                                         out.print("<input type=\"text\" id=\"max_conn\" value=\"" + vs.maxconn + "\" name=\"max_conn\" maxlength=\"6\" />");
467                                 }
468                                 if( null != invalidMessage ){
469                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
470                                 }
471                         }
472                         %>
473                 </td>
474                 <td>
475                         <p class="required">0-100000<br>Note : "0" means "Unlimited"</p>
476                 </td>
477         </tr>
478         </table>
479         </fieldset>
480         <fieldset class="">
481         <legend>Monitor Settings</legend>
482         <p class="caution">     <img src="images/exclamation3.gif" alt="Caution!!" width="16" height="14" align="middle">       
483          Disable Area when you push "apply" button.</p>
484         <table class="status">
485         <tr>
486                 <th>
487                         <label for="timeout">Check Timeout</label>
488                 </th>
489                 <td>
490                         <%
491                         {
492                                 String invalidMessage = null;
493                                 if ( null != errMessage ) {
494                                         invalidMessage = errMessage.get("timeout");
495                                 }
496                                 if ( ( vs == null ) || ( 0 == vs.timeout ) ){
497                                         if ( dd.autoreload == true )
498                                                 out.print("<input type=\"text\" id=\"timeout\" value=\"\" name=\"timeout\" maxlength=\"10\" />");
499                                         else
500                                                 out.print("<input class=\"read\" readonly type=\"text\" id=\"timeout\" value=\"\" name=\"timeout\" maxlength=\"10\" />");
501                                 }
502                                 else {
503                                         if ( dd.autoreload == true )
504                                                 out.print("<input type=\"text\" id=\"timeout\" value=\"" + vs.timeout + "\" name=\"timeout\" maxlength=\"10\" />");
505                                         else
506                                                 out.print("<input class=\"read\" readonly type=\"text\" id=\"timeout\" value=\"" + vs.timeout + "\" name=\"timeout\" maxlength=\"10\" />");
507
508                                 }
509                                 if( null != invalidMessage ){
510                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
511                                 }
512                         }
513                         %>
514                 </td>
515                 <td>
516                         <p class="required">1-2147483647(sec)</p>
517                 </td>
518         </tr>
519         <tr>
520                 <th>
521                         <label for="check_type">Check Type</label>
522                 </th>
523                 <td>
524                         <% 
525                         if ( dd.autoreload == true )
526                         {
527                         %>
528                                 <input type="text" id="check_type" value="<%= vs.checktype %>" name="check_type" maxlength="9"/>
529                         <%
530                         }
531                         else
532                         {
533                         %>
534                                 <input class="read" readonly type="text" id="check_type" value="<%= vs.checktype %>" name="check_type" maxlength="9"/>
535                         <%
536                         }
537                         if ( null != errMessage ) {
538                                 String invalidMessage = errMessage.get("check_type");
539                                 if( null != invalidMessage ){
540                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
541                                 }
542                         }
543                         %>
544                 </td>
545                 <td>
546                         <p class="required">Any Of The Following<br>negotiate, connect, ping, off, on, 0-9</p>
547                 </td>
548         </tr>
549         <tr>
550                 <th>
551                         <label for="check_service">Check Service</label>
552                 </th>
553                 <td>
554                 <% if (dd.autoreload ==true ){
555                 %>
556                         <select id="check_service" name="check_service">
557                                 <option value=""<%
558                                 if (vs.service.equals(""))
559                                         out.print(" selected");
560                                 %>></option>
561                                 <option value="ftp"<%
562                                 if (vs.service.equals("ftp"))
563                                         out.print(" selected");
564                                 %>>FTP</option>
565                                 <option value="smtp"<%
566                                 if (vs.service.equals("smtp"))
567                                         out.print(" selected");
568                                 %>>SMTP</option>
569                                 <option value="dns"<%
570                                 if (vs.service.equals("dns"))
571                                         out.print(" selected");
572                                 %>>DNS</option>
573                                 <option value="http"<%
574                                 if (vs.service.equals("http"))
575                                         out.print(" selected");
576                                 %>>HTTP</option>
577                                 <option value="pop"<%
578                                 if (vs.service.equals("pop"))
579                                         out.print(" selected");
580                                 %>>POP</option>
581                                 <option value="nntp"<%
582                                 if (vs.service.equals("nntp"))
583                                         out.print(" selected");
584                                 %>>NNTP</option>
585                                 <option value="imap"<%
586                                 if (vs.service.equals("imap"))
587                                         out.print(" selected");
588                                 %>>IMAP</option>
589                                 <option value="ldap"<%
590                                 if (vs.service.equals("ldap"))
591                                         out.print(" selected");
592                                 %>>LDAP</option>
593                                 <option value="https"<%
594                                 if (vs.service.equals("https"))
595                                         out.print(" selected");
596                                 %>>HTTPS</option>
597                                 <option value="mysql"<%
598                                 if (vs.service.equals("mysql"))
599                                         out.print(" selected");
600                                 %>>MySQL</option>
601                                 <option value="pgsql"<%
602                                 if (vs.service.equals("pgsql"))
603                                         out.print(" selected");
604                                 %>>PostgreSQL</option>
605                                 <option value="sip"<%
606                                 if (vs.service.equals("sip"))
607                                         out.print(" selected");
608                                 %>>SIP</option>
609                                 <option value="none"<%
610                                 if (vs.service.equals("none"))
611                                         out.print(" selected");
612                                 %>>None</option>
613                         </select>
614                         <%
615                         }
616                         else
617                         {
618                         %>
619                         <select class="read" disabled id="check_service" name="check_service">
620                                 <option value=""<%
621                                 if (vs.service.equals(""))
622                                         out.print(" selected");
623                                 %>></option>
624                                 <option value="ftp"<%
625                                 if (vs.service.equals("ftp"))
626                                         out.print(" selected");
627                                 %>>FTP</option>
628                                 <option value="smtp"<%
629                                 if (vs.service.equals("smtp"))
630                                         out.print(" selected");
631                                 %>>SMTP</option>
632                                 <option value="dns"<%
633                                 if (vs.service.equals("dns"))
634                                         out.print(" selected");
635                                 %>>DNS</option>
636                                 <option value="http"<%
637                                 if (vs.service.equals("http"))
638                                         out.print(" selected");
639                                 %>>HTTP</option>
640                                 <option value="pop"<%
641                                 if (vs.service.equals("pop"))
642                                         out.print(" selected");
643                                 %>>POP</option>
644                                 <option value="nntp"<%
645                                 if (vs.service.equals("nntp"))
646                                         out.print(" selected");
647                                 %>>NNTP</option>
648                                 <option value="imap"<%
649                                 if (vs.service.equals("imap"))
650                                         out.print(" selected");
651                                 %>>IMAP</option>
652                                 <option value="ldap"<%
653                                 if (vs.service.equals("ldap"))
654                                         out.print(" selected");
655                                 %>>LDAP</option>
656                                 <option value="https"<%
657                                 if (vs.service.equals("https"))
658                                         out.print(" selected");
659                                 %>>HTTPS</option>
660                                 <option value="mysql"<%
661                                 if (vs.service.equals("mysql"))
662                                         out.print(" selected");
663                                 %>>MySQL</option>
664                                 <option value="pgsql"<%
665                                 if (vs.service.equals("pgsql"))
666                                         out.print(" selected");
667                                 %>>PostgreSQL</option>
668                                 <option value="sip"<%
669                                 if (vs.service.equals("sip"))
670                                         out.print(" selected");
671                                 %>>SIP</option>
672                                 <option value="none"<%
673                                 if (vs.service.equals("none"))
674                                         out.print(" selected");
675                                 %>>None</option>
676                         </select>                       
677                         <%
678                         }
679                                 if ( null != errMessage ) {
680                                         String invalidMessage = errMessage.get("check_service");
681                                         if( null != invalidMessage ){
682                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
683                                         }
684                                 }
685                         %>
686                 </td>
687                 <td>
688                         <p class="required"></p>
689                 </td>
690         </tr>
691         <tr>
692                 <th>
693                         <label for="quiescent">Quiescent</label>
694                 </th>
695                 <td>
696                         <%if (dd.autoreload== true) {
697                         %>
698                         <select id="quiescent" name="quiescent">
699                                 <option value=""<%
700                                 if (vs.quiescent.equals("") )
701                                         out.print(" selected");
702                                 %>></option>
703                                 <option value="yes"<%
704                                 if (vs.quiescent.equals("yes") )
705                                         out.print(" selected");
706                                 %>>Yes</option>
707                                 <option value="no"<%
708                                 if (vs.quiescent.equals("no") )
709                                         out.print(" selected");
710                                 %>>No</option>
711                         </select>
712                         <%
713                         }
714                         else
715                         {
716                         %>
717                         <select class="read" disabled id="quiescent" name="quiescent">
718                                 <option value=""<%
719                                 if (vs.quiescent.equals("") )
720                                         out.print(" selected");
721                                 %>></option>
722                                 <option value="yes"<%
723                                 if (vs.quiescent.equals("yes") )
724                                         out.print(" selected");
725                                 %>>Yes</option>
726                                 <option value="no"<%
727                                 if (vs.quiescent.equals("no") )
728                                         out.print(" selected");
729                                 %>>No</option>
730                         </select>
731                         
732                         <%
733                         }
734                                 if ( null != errMessage ) {
735                                         String invalidMessage = errMessage.get("quiescent");
736                                         if( null != invalidMessage ){
737                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
738                                         }
739                                 }
740                         %>
741                 </td>
742                 <td>
743                         <p class="required">Default : No</p>
744                 </td>
745         </tr>
746         <tr>
747                 <th>
748                         <label for="down_callback">Real Server Down Callback</label>
749                 </th>
750                 <td>
751                 <% 
752                 if ( dd.autoreload == true )
753                 {
754                 %>
755                         <input type="text" id="down_callback" value="<%= vs.downcallback %>" name="down_callback" maxlength=\"127\" />
756                 <%
757                 }
758                 else
759                 {
760                 %>
761                         <input class="read" readonly type="text" id="down_callback" value="<%= vs.downcallback %>" name="down_callback" maxlength=\"127\" />    
762                 <%
763                 }
764                 if ( null != errMessage ) {
765                         String invalidMessage = errMessage.get("down_callback");
766                         if( null != invalidMessage ){
767                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
768                         }
769                 }
770                 %>
771                 </td>
772                 <td>
773                         <p class="required">Up to 127 one-byte characters in English<br>Be effctive only if CheckService : HTTP, HTTPS, LDAP, MySQL, PostgreSQL, SIP, None</p>
774                 </td>                   
775         </tr>
776         <tr>
777                 <th>
778                         <label for="up_callback">Real Server Up Callback</label>
779                 </th>
780                 <td>
781                 <% 
782                 if ( dd.autoreload == true )
783                 {
784                 %>              
785                         <input type="text" id="up_callback" value="<%= vs.upcallback %>" name="up_callback" maxlength=\"127\" />
786                 <%
787                 }
788                 else
789                 {
790                 %>
791                         <input class="read" readonly type="text" id="up_callback" value="<%= vs.upcallback %>" name="up_callback" maxlength=\"127\" />
792                 <%
793                 }
794                 if ( null != errMessage ) {
795                         String invalidMessage = errMessage.get("up_callback");
796                         if( null != invalidMessage ){
797                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
798                         }
799                 }
800                 %>
801                 </td>
802                 <td>
803                         <p class="required">Up to 127 one-byte characters in English</p>
804                 </td>
805         </tr>
806         <tr>
807                 <th>
808                         <label for="check_port">Check Port</label>
809                 </th>
810                 <td>
811                         <%
812                         {
813                                 String invalidMessage = null;
814                                 if ( null != errMessage ) {
815                                         invalidMessage = errMessage.get("check_port");
816                                 }
817                                 if ( ( vs == null ) || ( 0 == vs.checkport ) ){
818                                         if (dd.autoreload == true)
819                                                 out.print("<input type=\"text\" id=\"check_port\" value=\"\" name=\"check_port\" maxlength=\"5\" />");
820                                         else 
821                                                 out.print("<input class=\"read\" readonly type=\"text\" id=\"check_port\" value=\"\" name=\"check_port\" maxlength=\"5\" />");
822                                 }
823                                 else {
824                                         if (dd.autoreload == true)
825                                                 out.print("<input type=\"text\" id=\"check_port\" value=\"" + vs.checkport + "\" name=\"check_port\" maxlength=\"5\" />");
826                                         else
827                                                 out.print("<input class=\"read\" readonly type=\"text\" id=\"check_port\" value=\"" + vs.checkport + "\" name=\"check_port\" maxlength=\"5\" />");
828                                 }
829                                 if( null != invalidMessage ){
830                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
831                                 }
832                         }
833                         %>
834                 </td>
835                 <td>
836                         <p class="required">1-65535</p>
837                 </td>
838         </tr>
839         <tr>
840                 <th>
841                         <label for="request">Request Path</label>
842                 </th>
843                 <td>
844                 <% 
845                 if ( dd.autoreload == true )
846                 {
847                 %>                                      
848                         <input type="text" id="request" value="<%= vs.request %>" name="request" maxlength=\"127\" />
849                 <%
850                 }
851                 else
852                 {
853                 %>
854                         <input class="read" readonly type="text" id="request" value="<%= vs.request %>" name="request" maxlength=\"127\" />             
855                 <%
856                 }
857                 if ( null != errMessage ) {
858                         String invalidMessage = errMessage.get("request");
859                         if( null != invalidMessage ){
860                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
861                         }
862                 }
863                 %>
864                 </td>
865                 <td>
866                         <p class="required">Up to one-byte characters in English<br>Be effctive only if CheckService : HTTP, HTTPS, LDAP, MySQL, PostgreSQL, SIP, None</p>
867                 </td>
868         </tr>
869         <tr>
870                 <th>
871                         <label for="receive">Receive String</label>
872                 </th>
873                 <td>
874                 <% 
875                 if ( dd.autoreload == true )
876                 {
877                 %>              
878                         <input type="text" id="receive" value="<%= vs.receive %>" name="receive" maxlength=\"127\" />
879                 <%
880                 }
881                 else
882                 {
883                 %>
884                         <input class="read" readonly  type="text" id="receive" value="<%= vs.receive %>" name="receive" maxlength=\"127\" />
885                                 
886                 <%
887                 }
888                 if ( null != errMessage ) {
889                         String invalidMessage = errMessage.get("receive");
890                         if( null != invalidMessage ){
891                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
892                         }
893                 }
894                 %>
895                 </td>
896                 <td>
897                         <p class="required">Up to 127 one-byte characters in English<br>Be effctive only if CheckService : HTTP, HTTPS, LDAP, FTP, DNS</p>
898                 </td>
899         </tr>
900         <tr>
901                 <th>
902                         <label for="method">HTTP Method</label>
903                 </th>
904                 <td>
905                         <% if (dd.autoreload ==true ){
906                         %>
907                         <select id="method" name="method">
908                                 <option value=""<%
909                                 if (vs.httpmethod.equals(""))
910                                         out.print(" selected");
911                                 %>></option>
912                                 <option value="GET"<%
913                                 if (vs.httpmethod.equals("GET"))
914                                         out.print(" selected");
915                                 %>>GET</option>
916                                 <option value="HEAD"<%
917                                 if (vs.httpmethod.equals("HEAD"))
918                                         out.print(" selected");
919                                 %>>HEAD</option>
920                         </select>
921                         <%
922                         }
923                         else
924                         {
925                         %>
926                         <select class="read" disabled id="method" name="method">
927                                 <option value=""<%
928                                 if (vs.httpmethod.equals(""))
929                                         out.print(" selected");
930                                 %>></option>
931                                 <option value="GET"<%
932                                 if (vs.httpmethod.equals("GET"))
933                                         out.print(" selected");
934                                 %>>GET</option>
935                                 <option value="HEAD"<%
936                                 if (vs.httpmethod.equals("HEAD"))
937                                         out.print(" selected");
938                                 %>>HEAD</option>
939                         </select>
940                         
941                         <%
942                         }
943                                 if ( null != errMessage ) {
944                                         String invalidMessage = errMessage.get("method");
945                                         if( null != invalidMessage ){
946                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
947                                         }
948                                 }
949                         %>
950                 </td>
951                 <td>
952                         <p class="required">Be effctive only if CheckService : HTTP, HTTPS</p>
953                 </td>
954         </tr>
955         <tr>
956                 <th>
957                         <label for="virtual_host">Virtual Host</label>
958                 </th>
959                 <td>
960                 <% 
961                 if ( dd.autoreload == true )
962                 {
963                 %>              
964                         <input type="text" id="virtual_host" value="<%= vs.virtualhost %>" name="virtual_host" maxlength=\"127\" />
965                 <%
966                 }
967                 else
968                 {
969                 %>
970                         <input class="read" readonly type="text" id="virtual_host" value="<%= vs.virtualhost %>" name="virtual_host" maxlength=\"127\" />                       
971                 <%
972                 }
973                 if ( null != errMessage ) {
974                         String invalidMessage = errMessage.get("virtual_host");
975                         if( null != invalidMessage ){
976                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
977                         }
978                 }
979                 %>
980                 </td>
981                 <td>
982                         <p class="required">Up to 127 one-byte characters in English<br>Be effctive only if CheckService : HTTP, HTTPS</p>
983                 </td>
984         </tr>
985         <tr>
986                 <th>
987                         <label for="login_user">Login Username</label>
988                 </th>
989                 <td>
990                 <% 
991                 if ( dd.autoreload == true )
992                 {
993                 %>                      
994                         <input type="text" id="login_user" value="<%= vs.login %>" name="login_user" maxlength=\"32\" />
995                 <%
996                 }
997                 else
998                 {
999                 %>
1000                         <input class="read" readonly type="text" id="login_user" value="<%= vs.login %>" name="login_user" maxlength=\"32\" />
1001                 <%
1002                 }
1003                 if ( null != errMessage ) {
1004                         String invalidMessage = errMessage.get("login_user");
1005                         if( null != invalidMessage ){
1006                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1007                         }
1008                 }
1009                 %>
1010                 </td>
1011                 <td>
1012                         <p class="required">Up to 32 one-byte characters in English<br>Followings : Effctive only when CheckService is FTP, POP, IMAP, MySQL, PostgreSQL, and SIP</p>
1013                 </td>
1014         </tr>
1015         <tr>
1016                 <th>
1017                         <label for="login_pass">Login Password</label>
1018                 </th>
1019                 <td>
1020                 <% 
1021                 if ( dd.autoreload == true )
1022                 {
1023                 %>                      
1024                         <input type="text" id="login_pass" value="<%= vs.passwd %>" name="login_pass" maxlength=\"32\" />
1025                 <%
1026                 }
1027                 else
1028                 {
1029                 %>
1030                         <input class="read" readonly type="text" id="login_pass" value="<%= vs.passwd %>" name="login_pass" maxlength=\"32\" />
1031                 <%
1032                 }
1033                 if ( null != errMessage ) {
1034                         String invalidMessage = errMessage.get("login_pass");
1035                         if( null != invalidMessage ){
1036                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1037                         }
1038                 }
1039                 %>
1040                 </td>
1041                 <td>
1042                         <p class="required">Up to 32 one-byte characters in English<br>Be effctive only if CheckService : FTP, POP, IMAP, MySQL, PostgreSQL, SIP</p>
1043                 </td>
1044         </tr>
1045         <tr>
1046                 <th>
1047                         <label for="db">Database Name</label>
1048                 </th>
1049                 <td>
1050                 <% 
1051                 if ( dd.autoreload == true )
1052                 {
1053                 %>                                      
1054                         <input type="text" id="db" value="<%= vs.database %>" name="db" maxlength=\"32\" />
1055                 <%
1056                 }
1057                 else
1058                 {
1059                 %>
1060                         <input class="read" readonly type="text" id="db" value="<%= vs.database %>" name="db" maxlength=\"32\" />                       
1061                 <%
1062                 }
1063                 if ( null != errMessage ) {
1064                         String invalidMessage = errMessage.get("db");
1065                         if( null != invalidMessage ){
1066                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1067                         }
1068                 }
1069                 %>
1070                 </td>
1071                 <td>
1072                         <p class="required">Up to 32 one-byte characters in English<br>Be effctive only if CheckService : MySQL, PostgreSQL</p>
1073                 </td>
1074         </tr>
1075         </table>
1076         </fieldset>
1077         
1078         <h2> RealServer Info</h2>
1079         <%
1080                 if ( (vs.real != null) && (vs.real.size() != 0)) {
1081         %>
1082         <fieldset class="">
1083         <legend>Real Servers</legend>
1084         <%
1085                         for (int i = 0; i < vs.real.size(); i++) {
1086                                 int ripNum = i + 1;
1087                                 EndPoint rip = (EndPoint) vs.real.elementAt(i);
1088         %>
1089         <table class="status">
1090         <tr>
1091                 <td rowspan="3" class="check">
1092                         <input type="checkbox" name="rs<%= ripNum %>_remove" />
1093                 </td>
1094                 <th class="check">
1095                         <label for="rs<%= ripNum %>_ip">IP Address</label>
1096                 </th>
1097                 <td>
1098                         <input type="text" id="rs<%= ripNum %>_ip" value="<%= rip.host %>" name="rs<%= ripNum %>_ip" maxlength="15" />
1099                         <%
1100                                 if ( null != errMessage ) {
1101                                         String invalidMessage = errMessage.get("rs" + ripNum + "_ip");
1102                                         if( null != invalidMessage ){
1103                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1104                                         }
1105                                 }
1106                         %>
1107                 </td>
1108                 <td>
1109                         <p class="required">[0-255].[0-255].[0-255].[0-255]</p>
1110                 </td>
1111         </tr>
1112         <tr>
1113                 <th class="check">
1114                         <label for="rs<%= ripNum %>_port">Port Number</label>
1115                 </th>
1116                 <td>
1117                         <%
1118                         {
1119                                 String invalidMessage = null;
1120                                 if ( null != errMessage ) {
1121                                         invalidMessage = errMessage.get("rs" + ripNum + "_port");
1122                                 }
1123                                 if ( null == rip.port ){
1124                                         out.print("<input type=\"text\" id=\"rs\" + ripNum + \"_port\" value=\"\" name=\"rs" + ripNum + "_port\" />");
1125                                 }
1126                                 else {
1127                                         out.print("<input type=\"text\" id=\"rs\" + ripNum + \"_port\" value=\"" + rip.port + "\" name=\"rs" + ripNum + "_port\" />");
1128                                 }
1129                                 if( null != invalidMessage ){
1130                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1131                                 }
1132                         }
1133                         %>
1134                 </td>
1135                 <td>
1136                         <p class="required">1-65535</p>
1137                 </td>
1138         </tr>
1139         <tr>
1140                 <th class="check">
1141                         <label for="rs<%= ripNum %>_weight">Weight</label>
1142                 </th>
1143                 <td>
1144                         <%
1145                         {
1146                                 String invalidMessage = null;
1147                                 if ( null != errMessage ) {
1148                                         invalidMessage = errMessage.get("rs" + ripNum + "_weight");
1149                                 }
1150                                 if ( ( null != invalidMessage ) && ( 1 == rip.weight ) ){
1151                                         out.print("<input type=\"text\" id=\"rs" + ripNum + "_weight\" value=\"\" name=\"rs" + ripNum + "_weight\" maxlength=\"3\" />");
1152                                 }
1153                                 else {
1154                                         out.print("<input type=\"text\" id=\"rs" + ripNum + "_weight\" value=\"" + rip.weight + "\" name=\"rs" + ripNum + "_weight\" maxlength=\"3\" />");
1155                                 }
1156                                 if( null != invalidMessage ){
1157                                         out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1158                                 }
1159                         }
1160                         %>
1161                 </td>
1162                 <td>
1163                         <p class="required">0-100<br>Default:1</p>
1164                 </td>
1165         </tr>
1166         </table>
1167         <%      
1168                 }
1169         %>
1170         <input name="<%= ButtonMode.REMOVE %>" type="submit" value=" >> Remove RealServers" />
1171         </fieldset>
1172         <%
1173         }
1174          %>
1175
1176         <fieldset class="">
1177         <legend>New Real Server</legend>
1178         <table class="status">
1179         <tr>
1180                 <th>
1181                         <label for="new_ip">IP Address</label>
1182                 </th>
1183                 <td>
1184                         <input type="text" id="new_ip" value="" name="new_ip" maxlength="15" />
1185                 </td>
1186                 <td>
1187                         <p class="required">[0-255].[0-255].[0-255].[0-255]</p>
1188                 </td>
1189         </tr>
1190         <tr>
1191                 <th>
1192                         <label for="new_port">Port Number</label>
1193                 </th>
1194                 <td>
1195                         <input type="text" id="new_port" value="" name="new_port" />
1196                 </td>
1197                 <td>
1198                         <p class="required">1-65535</p>
1199                 </td>
1200         </tr>
1201         <tr>
1202                 <th>
1203                         <label for="new_weight">Weight</label>
1204                 </th>
1205                 <td>
1206                         <input type="text" id="new_weight" value="" name="new_weight" maxlength="3" />
1207                 </td>
1208                 <td>
1209                         <p class="required">0-100</p>
1210                 </td>
1211         </tr>
1212         </table>
1213         <input name="<%= ButtonMode.ADD %>" type="submit" value=" >> Add a RealServer" />
1214         </fieldset>
1215
1216         <h2> SorryServer Info</h2>
1217         <fieldset class="">
1218         <legend>Sorry Settings</legend>
1219         <table class="status">
1220         <tr>
1221                 <th>
1222                         <label for="sorry_ip">IP Address</label>
1223                 </th>
1224                 <td>
1225                         <input type="text" id="sorry_ip" value="<%= vs.sorryserver.host %>" name="sorry_ip" maxlength="15" />
1226                         <% 
1227                                 if ( null != errMessage ) {
1228                                         String invalidMessage = errMessage.get("sorry_ip");
1229                                         if( null != invalidMessage ){
1230                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1231                                         }
1232                                 }
1233                         %>
1234                 </td>
1235                 <td>
1236                         <p class="required">[0-255].[0-255].[0-255].[0-255]</p>
1237                 </td>
1238         </tr>
1239         <tr>
1240                 <th>
1241                         <label for="sorry_port">Port Number</label>
1242                 </th>
1243                 <td>
1244                 <%
1245                 {
1246                         String invalidMessage = null;
1247                         if ( null != errMessage ) {
1248                                 invalidMessage = errMessage.get("sorry_port");
1249                         }
1250                         if ( null == vs.sorryserver.port ) {
1251                                 out.print("<input type=\"text\" id=\"sorry_port\" value=\"\" name=\"sorry_port\" />");
1252                         }
1253                         else {
1254                                 out.print("<input type=\"text\" id=\"sorry_port\" value=\"" + vs.sorryserver.port + "\"name=\"sorry_port\" />");
1255                         }
1256                         if( null != invalidMessage ){
1257                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1258                         }
1259                 }
1260                 %>
1261                 </td>
1262                 <td>
1263                         <p class="required">1-65535</p>
1264                 </td>
1265         </tr>
1266         <tr>
1267                 <th>
1268                         <label for="sorry">Sorry Flag</label>
1269                 </th>
1270                 <td>
1271                         <select id="sorry" name="sorry_flag">
1272                                 <option value="on"<%
1273                                 if (vs.sorryflag)
1274                                         out.print(" selected");
1275                                 %>>On</option>
1276                                 <option value="off"<%
1277                                 if (!vs.sorryflag)
1278                                         out.print(" selected");
1279                                 %>>Off</option>
1280                         </select>
1281                         <% 
1282                                 if ( null != errMessage ) {
1283                                         String invalidMessage = errMessage.get("sorry_flag");
1284                                         if( null != invalidMessage ){
1285                                                 out.print("<p class=\"invalid\">" + invalidMessage + "</p>");
1286                                         }
1287                                 }
1288                         %>
1289                 </td>
1290                 <td>
1291                         <p class="required">Default : Off</p>
1292                 </td>
1293         </tr>
1294         </table>
1295         </fieldset>
1296         <input type="submit" name="button" value="<%= ButtonMode.APPLY %>" onClick="return confirm(modify_vs_apply)" />
1297         <%
1298                 if (dd.autoreload == true) {
1299         %>
1300         <input type="submit" name="button" value="<%=ButtonMode.SAVE %>" onClick="return confirm(modify_vs_save)" />
1301         <%
1302                         if (cd.self_status == ClusterStatus.ACTIVE || cd.self_status == ClusterStatus.STANDBY) {
1303         %>
1304         <input type="submit" name="button" value="<%=ButtonMode.SAVESYNC %>" onClick="return confirm(modify_vs_savesync)" />
1305         <%
1306                         }
1307                 }
1308         %>
1309 </form>
1310
1311 </div>
1312 </body>
1313 </html>