Author: veithen
Date: Sat May 28 21:02:24 2016
New Revision: 1745941
URL: http://svn.apache.org/viewvc?rev=1745941&view=rev
Log:
Rewrite the editServiceParameters.jsp view using JSTL.
Modified:
axis/axis2/java/core/trunk/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
axis/axis2/java/core/trunk/modules/webapp/src/main/webapp/WEB-INF/views/admin/editServiceParameters.jsp
Modified:
axis/axis2/java/core/trunk/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java?rev=1745941&r1=1745940&r2=1745941&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
(original)
+++
axis/axis2/java/core/trunk/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminActions.java
Sat May 28 21:02:24 2016
@@ -25,6 +25,7 @@ import org.apache.axis2.context.Configur
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -50,6 +51,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
/**
* Provides methods to process axis2 admin requests.
@@ -208,15 +210,23 @@ final class AdminActions {
@Action(name=EDIT_SERVICE_PARAMETERS)
public View editServiceParameters(HttpServletRequest req) throws AxisFault
{
String serviceName = req.getParameter("axisService");
- AxisService serviceTemp =
+ AxisService service =
configContext.getAxisConfiguration().getServiceForActivation(serviceName);
- if (serviceTemp.isActive()) {
+ if (service.isActive()) {
if (serviceName != null) {
req.getSession().setAttribute(Constants.SERVICE,
configContext.getAxisConfiguration().getService(
serviceName));
}
+ req.setAttribute("serviceName", serviceName);
+ req.setAttribute("parameters", getParameters(service));
+ Map<String,Map<String,String>> operations = new
TreeMap<String,Map<String,String>>();
+ for (Iterator<AxisOperation> it = service.getOperations();
it.hasNext(); ) {
+ AxisOperation operation = it.next();
+ operations.put(operation.getName().getLocalPart(),
getParameters(operation));
+ }
+ req.setAttribute("operations", operations);
} else {
req.setAttribute("status", "Service " + serviceName + " is not an
active service" +
". \n Only parameters of active services can be edited.");
@@ -224,6 +234,16 @@ final class AdminActions {
return new View("editServiceParameters.jsp");
}
+ private static Map<String,String> getParameters(AxisDescription
description) {
+ Map<String,String> parameters = new TreeMap<String,String>();
+ for (Parameter parameter : description.getParameters()) {
+ if (parameter.getParameterType() != Parameter.OM_PARAMETER) {
+ parameters.put(parameter.getName(),
parameter.getValue().toString());
+ }
+ }
+ return parameters;
+ }
+
@Action(name="updateServiceParameters", post=true)
public Redirect updateServiceParameters(HttpServletRequest request) throws
AxisFault {
String serviceName = request.getParameter("axisService");
Modified:
axis/axis2/java/core/trunk/modules/webapp/src/main/webapp/WEB-INF/views/admin/editServiceParameters.jsp
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/webapp/src/main/webapp/WEB-INF/views/admin/editServiceParameters.jsp?rev=1745941&r1=1745940&r2=1745941&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/webapp/src/main/webapp/WEB-INF/views/admin/editServiceParameters.jsp
(original)
+++
axis/axis2/java/core/trunk/modules/webapp/src/main/webapp/WEB-INF/views/admin/editServiceParameters.jsp
Sat May 28 21:02:24 2016
@@ -19,103 +19,50 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
-<%@ page import="org.apache.axis2.Constants,
- org.apache.axis2.description.AxisOperation,
- org.apache.axis2.description.AxisService,
- org.apache.axis2.description.Parameter,
- java.util.ArrayList,
- java.util.Iterator"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:include page="/WEB-INF/include/adminheader.jsp"/>
<h1>Edit Service Parameters</h1>
- <form method="post" name="editServicepara" action="<c:url
value="axis2-admin/updateServiceParameters"/>">
- <t:status/>
- <%
- AxisService axisService = (AxisService)request.getSession().
- getAttribute(Constants.SERVICE);
- if(axisService != null ){
- %> <table summary="main content table" width="100%">
-
+<t:status/>
+<c:if test="${not empty requestScope.serviceName}">
+ <form method="post" action="<c:url
value="axis2-admin/updateServiceParameters"/>">
+ <input type="hidden" name="axisService" value="<c:out
value="${requestScope.serviceName}"/>">
+ <table summary="main content table" width="100%">
<tr>
- <td colspan="2" ><b>
- <%
- String servicName = axisService.getName();
- %>Service Parameters :: <%=servicName%>
- </b></td>
- </tr>
- <tr>
- <td colspan="2" ><input style="display:none" name="axisService"
value="<%=servicName%>"></td>
+ <td colspan="2" ><b>Service Parameters :: <c:out
value="${requestScope.serviceName}"/></b></td>
</tr>
- <%
- ArrayList service_para = axisService.getParameters();
- for (int i = 0; i < service_para.size(); i++) {
- Parameter parameter = (Parameter) service_para.get(i);
- if (parameter.getParameterType()==Parameter.OM_PARAMETER)
{
- continue;
- }
- %>
- <tr>
- <td><%=parameter.getName()%></td>
- <td><input type="text" value="<%=parameter.getValue()%>"
- name="<%=(servicName + "_" +
parameter.getName())%>" size="50">
- </td>
- </tr>
- <%
- }
- Iterator operations = axisService.getOperations();
- if(operations.hasNext()){
- %>
+ <c:forEach items="${requestScope.parameters}" var="parameter">
+ <tr>
+ <td><c:out value="${parameter.key}"/></td>
+ <td><input type="text" name="<c:out
value="${requestScope.serviceName}_${parameter.key}"/>" value="<c:out
value="${parameter.value}"/>" size="50"></td>
+ </tr>
+ </c:forEach>
+ <c:if test="${not empty requestScope.operations}">
+ <tr>
+ <td colspan="2"> </td>
+ </tr>
+ <tr>
+ <td colspan="2"><b>Operation Parameters ::</b></td>
+ </tr>
+ <c:forEach items="${requestScope.operations}" var="operation">
<tr>
- <td> </td>
- <td> </td>
+ <td colspan="2"> </td>
</tr>
<tr>
- <td colspan="2" > <b>Operation Paramaters :: </b>
- </td>
+ <td colspan="2"><b>Operation : <c:out
value="${operation.key}"/></b></td>
</tr>
- <%
- }
-
- ArrayList op_paras ;
- operations = axisService.getOperations();
- while (operations.hasNext()) {
- AxisOperation axisOperation = (AxisOperation)
operations.next();
- String operationName =
axisOperation.getName().getLocalPart();
- %>
- <tr>
- <td colspan="2" > </td>
- </tr>
- <tr>
- <td colspan="2" ><b>Operation :
<%=operationName%></b></td>
- </tr>
- <%
- op_paras = axisOperation.getParameters();
- for (int i = 0; i < op_paras.size(); i++) {
- Parameter parameter = (Parameter) op_paras.get(i);
- if
(parameter.getParameterType()==Parameter.OM_PARAMETER) {
- continue;
- }
- %>
- <tr>
- <td><%=parameter.getName()%></td>
- <td><input type="text" value="<%=parameter.getValue()%>"
- name="<%=(operationName + "_" +
parameter.getName())%>" size="50">
- </td>
- </tr>
- <%
- }
- }
- %>
- <tr>
- <td> </td>
- <td>
- <input name="changePara" type="submit" value=" Change " >
- </td>
- </tr>
- </table>
- <%
- }
-
- %>
- </form>
+ <c:forEach items="${operation.value}" var="parameter">
+ <tr>
+ <td><c:out value="${parameter.key}"/></td>
+ <td><input type="text" name="<c:out
value="${operation.key}_${parameter.key}"/>" value="<c:out
value="${parameter.value}"/>" size="50"></td>
+ </tr>
+ </c:forEach>
+ </c:forEach>
+ </c:if>
+ <tr>
+ <td> </td>
+ <td><input name="changePara" type="submit" value=" Change "
></td>
+ </tr>
+ </table>
+ </form>
+</c:if>
<jsp:include page="/WEB-INF/include/adminfooter.jsp"/>