com.tangosol.coherence.config.xml.processor.HttpAcceptorDependenciesProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence Show documentation
Show all versions of coherence Show documentation
Oracle Coherence Community Edition
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.coherence.config.xml.processor;
import com.tangosol.coherence.config.builder.InstanceBuilder;
import com.tangosol.coherence.config.builder.ParameterizedBuilder;
import com.tangosol.coherence.http.HttpServer;
import com.tangosol.config.ConfigurationException;
import com.tangosol.config.xml.ElementProcessor;
import com.tangosol.config.xml.ProcessingContext;
import com.tangosol.config.xml.XmlSimpleName;
import com.tangosol.internal.net.service.peer.acceptor.DefaultHttpAcceptorDependencies;
import com.tangosol.internal.net.service.peer.acceptor.HttpAcceptorDependencies;
import com.tangosol.run.xml.XmlElement;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
* An {@link ElementProcessor} to produce a {@link HttpAcceptorDependencies}
* from a <http-acceptor%gt; configuration.
*
* @author bo 2013.07.11
*/
@XmlSimpleName("http-acceptor")
public class HttpAcceptorDependenciesProcessor
implements ElementProcessor
{
/**
* {@inheritDoc}
*/
@Override
public HttpAcceptorDependencies process(ProcessingContext context, XmlElement xmlElement)
throws ConfigurationException
{
// establish the dependencies into which we'll perform some injection
DefaultHttpAcceptorDependencies dependencies = new DefaultHttpAcceptorDependencies();
// resolve the HTTP server
ParameterizedBuilder bldr = ElementProcessorHelper.processParameterizedBuilder(context, xmlElement);
if (bldr == null)
{
// no builder has been specified, so let's use a default server
dependencies.setHttpServer(HttpServer.create());
}
else
{
try
{
ParameterizedBuilder