org.ow2.petals.binding.soap.listener.incoming.servlet.ListServicesServlet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of petals-bc-soap Show documentation
Show all versions of petals-bc-soap Show documentation
The PEtALS SOAP JBI binding component based on Axis2 and Jetty.
The newest version!
/**
* Copyright (c) 2007-2012 EBM WebSourcing, 2012-2023 Linagora
*
* This program/library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or (at your
* option) any later version.
*
* This program/library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program/library; If not, see http://www.gnu.org/licenses/
* for the GNU Lesser General Public License version 2.1.
*/
package org.ow2.petals.binding.soap.listener.incoming.servlet;
import static org.ow2.petals.binding.soap.SoapConstants.Axis2.OUTGOING_SERVICE_CLIENT_PREFIX;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
import org.ow2.petals.binding.soap.listener.incoming.SoapServerConfig;
import org.ow2.petals.binding.soap.listener.incoming.jetty.IncomingProbes;
import org.ow2.petals.probes.api.exceptions.ProbeNotStartedException;
import org.ow2.petals.probes.api.probes.CounterProbe;
import org.ow2.petals.probes.api.probes.GaugeProbe;
/**
* Servlet used to display the list of services.
*
* It replaces the Axis2 one.
*
*
* @author Christophe Hamerling - EBM WebSourcing
*/
public class ListServicesServlet extends HttpServlet {
private static final long serialVersionUID = -4951673084170985493L;
/**
* The HTML title string
*/
private static final String HTML_TOP = "petals-bc-soap : Services List Petals BC SOAP
";
private static final String HTML_BOTTOM = "";
/**
* The axis2 configuration context used to get services list
*/
private transient final ConfigurationContext configContext;
/**
* The SOAP server configuration
*/
private transient final SoapServerConfig soapServerConfig;
/**
* The probe counting unknown URLs received by the Jetty server.
*/
private transient final CounterProbe probeInformationServlet;
/**
* The probe counting active threads in the thread pool of the HTTP server.
*/
private transient final GaugeProbe probeHttpServerThreadPoolActiveThreads;
/**
* The probe counting idle threads in the thread pool of the HTTP server.
*/
private transient final GaugeProbe probeHttpServerThreadPoolIdleThreads;
/**
* The probe counting requests in the queue of the thread pool of the HTTP
* server.
*/
private transient final GaugeProbe probeHttpServerThreadPoolQueuedRequests;
/**
* The component logger
*/
private transient final Logger logger;
/**
* Creates a new instance of ListServicesServlet
*
* @param configurationContext
* @param soapConfig
* @param probes
* Technical monitoring probes
* @param logger
* The component logger
*/
public ListServicesServlet(final ConfigurationContext configurationContext,
final SoapServerConfig soapConfig, final IncomingProbes probes, final Logger logger) {
this.configContext = configurationContext;
this.soapServerConfig = soapConfig;
this.logger = logger;
this.probeHttpServerThreadPoolActiveThreads = probes.probeHttpServerThreadPoolActiveThreads;
this.probeHttpServerThreadPoolIdleThreads = probes.probeHttpServerThreadPoolIdleThreads;
this.probeHttpServerThreadPoolQueuedRequests = probes.probeHttpServerThreadPoolQueuedRequests;
this.probeInformationServlet = probes.probeInformationServlet;
}
/**
* The list has not been activated in component
*
* @param out
* @throws IOException
*/
private void listNotAvailable(final ServletOutputStream out) throws IOException {
out.write("The list of services is not available
".getBytes());
out.write("It must be activated in the SOAP component descriptor...".getBytes());
out.write("