listServices.jsp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <%--
  2. ~ Licensed to the Apache Software Foundation (ASF) under one
  3. ~ or more contributor license agreements. See the NOTICE file
  4. ~ distributed with this work for additional information
  5. ~ regarding copyright ownership. The ASF licenses this file
  6. ~ to you under the Apache License, Version 2.0 (the
  7. ~ "License"); you may not use this file except in compliance
  8. ~ with the License. You may obtain a copy of the License at
  9. ~
  10. ~ http://www.apache.org/licenses/LICENSE-2.0
  11. ~
  12. ~ Unless required by applicable law or agreed to in writing,
  13. ~ software distributed under the License is distributed on an
  14. ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. ~ KIND, either express or implied. See the License for the
  16. ~ specific language governing permissions and limitations
  17. ~ under the License.
  18. --%>
  19. <%@ page import="org.apache.axis2.Constants,
  20. org.apache.axis2.description.AxisOperation" %>
  21. <%@ page import="org.apache.axis2.description.AxisService" %>
  22. <%@ page import="org.apache.axis2.description.Parameter" %>
  23. <%@ page import="org.apache.axis2.engine.AxisConfiguration" %>
  24. <%@ page import="org.apache.axis2.util.JavaUtils" %>
  25. <%@ page import="java.util.Collection" %>
  26. <%@ page import="java.util.Enumeration" %>
  27. <%@ page import="java.util.HashMap" %>
  28. <%@ page import="java.util.Hashtable" %>
  29. <%@ page import="java.util.Iterator" %>
  30. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  31. <html>
  32. <jsp:include page="include/httpbase.jsp"/>
  33. <head><title>List Services</title>
  34. <link href="axis2-web/css/axis-style.css" rel="stylesheet" type="text/css"/>
  35. </head>
  36. <body>
  37. <h1>Available services</h1>
  38. <% String prefix = request.getAttribute("frontendHostUrl") + (String)request.getSession().getAttribute(Constants.SERVICE_PATH) + "/";
  39. %>
  40. <%
  41. HashMap serviceMap = (HashMap) request.getSession().getAttribute(Constants.SERVICE_MAP);
  42. request.getSession().setAttribute(Constants.SERVICE_MAP, null);
  43. Hashtable errornessservice = (Hashtable) request.getSession().getAttribute(Constants.ERROR_SERVICE_MAP);
  44. boolean status = false;
  45. if (serviceMap != null && !serviceMap.isEmpty()) {
  46. Iterator opItr;
  47. //HashMap operations;
  48. String serviceName;
  49. Collection servicecol = serviceMap.values();
  50. // Collection operationsList;
  51. for (Iterator iterator = servicecol.iterator(); iterator.hasNext();) {
  52. AxisService axisService = (AxisService) iterator.next();
  53. opItr = axisService.getOperations();
  54. //operationsList = operations.values();
  55. serviceName = axisService.getName();
  56. %><h2><font color="blue"><a href="<%=prefix + axisService.getName()%>?wsdl"><%=serviceName%></a></font></h2>
  57. <%
  58. boolean disableREST = false;
  59. AxisConfiguration axisConfiguration = axisService.getAxisConfiguration();
  60. Parameter parameter ;
  61. // do we need to completely disable REST support
  62. parameter = axisConfiguration.getParameter(Constants.Configuration.DISABLE_REST);
  63. if (parameter != null) {
  64. disableREST = !JavaUtils.isFalseExplicitly(parameter.getValue());
  65. }
  66. if (!disableREST ) {
  67. %>
  68. <%
  69. }
  70. String serviceDescription = axisService.getServiceDescription();
  71. if (serviceDescription == null || "".equals(serviceDescription)) {
  72. serviceDescription = "No description available for this service";
  73. }
  74. %>
  75. <h5>Service Description : <font color="black"><%=serviceDescription%></font></h5>
  76. <h5>Service EPR : <%=prefix + axisService.getName()%></h5>
  77. <h5>Service Status : <%=axisService.isActive() ? "Active" : "InActive"%></h5><br>
  78. <%
  79. if (opItr.hasNext()) {
  80. %><i>Available Operations</i><%
  81. } else {
  82. %><i> There are no Operations specified</i><%
  83. }
  84. opItr = axisService.getOperations();
  85. %><ul><%
  86. while (opItr.hasNext()) {
  87. AxisOperation axisOperation = (AxisOperation) opItr.next();
  88. %><li><%=axisOperation.getName().getLocalPart()%></li>
  89. <%-- <br>Operation EPR : <%=prifix + axisService.getName().getLocalPart() + "/"+ axisOperation.getName().getLocalPart()%>--%>
  90. <%
  91. }
  92. %></ul>
  93. <%
  94. status = true;
  95. }
  96. }
  97. if (errornessservice != null) {
  98. if (errornessservice.size() > 0) {
  99. request.getSession().setAttribute(Constants.IS_FAULTY, Constants.IS_FAULTY);
  100. %>
  101. <hr>
  102. <h3><font color="blue">Faulty Services</font></h3>
  103. <%
  104. Enumeration faultyservices = errornessservice.keys();
  105. while (faultyservices.hasMoreElements()) {
  106. String faultyserviceName = (String) faultyservices.nextElement();
  107. %><h3><font color="blue"><a href="services/ListFaultyServices?serviceName=<%=faultyserviceName%>">
  108. <%=faultyserviceName%></a></font></h3>
  109. <%
  110. }
  111. }
  112. status = true;
  113. }
  114. if (!status) {
  115. %> No services listed! Try hitting refresh. <%
  116. }
  117. %>
  118. </body>
  119. </html>