Search in sources :

Example 1 with GreeterImpl

use of org.apache.cxf.systest.http.GreeterImpl in project cxf by apache.

the class Server method run.

protected void run() {
    // We use a null binding id in the call to EndpointImpl
    // constructor. Why?
    final String nullBindingID = null;
    // We need to specify to use defaults on constructing the
    // bus, because our configuration file doesn't have
    // everything needed.
    final boolean useDefaults = true;
    // We configure a new bus for this server.
    setBus(new SpringBusFactory().createBus(configFileURL, useDefaults));
    // This impl class must have the appropriate annotations
    // to match the WSDL file that we are using.
    Object implementor = new GreeterImpl(name);
    // I don't know why this works.
    ep = new EndpointImpl(getBus(), implementor, nullBindingID, this.getClass().getResource("greeting.wsdl").toString());
    // How the hell do I know what the name of the
    // http-destination is from using this call?
    ep.setEndpointName(new QName("http://apache.org/hello_world", name));
    ep.publish(address);
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) GreeterImpl(org.apache.cxf.systest.http.GreeterImpl)

Example 2 with GreeterImpl

use of org.apache.cxf.systest.http.GreeterImpl in project cxf by apache.

the class TrustServerNoSpring method run.

protected void run() {
    Bus busLocal = BusFactory.getDefaultBus(true);
    setBus(busLocal);
    String address = "https://localhost:" + TrustManagerTest.PORT3 + "/SoapContext/HttpsPort";
    try {
        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
        keyStore.load(ClassLoaderUtils.getResourceAsStream("keys/Bethal.jks", this.getClass()), "password".toCharArray());
        KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
        kmf.init(keyStore, "password".toCharArray());
        TLSServerParameters tlsParams = new TLSServerParameters();
        tlsParams.setKeyManagers(kmf.getKeyManagers());
        ClientAuthentication clientAuthentication = new ClientAuthentication();
        clientAuthentication.setRequired(false);
        clientAuthentication.setWant(true);
        tlsParams.setClientAuthentication(clientAuthentication);
        Map<String, TLSServerParameters> map = new HashMap<>();
        map.put("tlsId", tlsParams);
        JettyHTTPServerEngineFactory factory = busLocal.getExtension(JettyHTTPServerEngineFactory.class);
        factory.setTlsServerParametersMap(map);
        factory.createJettyHTTPServerEngine("localhost", Integer.parseInt(TrustManagerTest.PORT3), "https", "tlsId");
        factory.initComplete();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    Endpoint.publish(address, new GreeterImpl());
}
Also used : Bus(org.apache.cxf.Bus) HashMap(java.util.HashMap) GreeterImpl(org.apache.cxf.systest.http.GreeterImpl) JettyHTTPServerEngineFactory(org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory) KeyStore(java.security.KeyStore) ClientAuthentication(org.apache.cxf.configuration.security.ClientAuthentication) TLSServerParameters(org.apache.cxf.configuration.jsse.TLSServerParameters) KeyManagerFactory(javax.net.ssl.KeyManagerFactory)

Aggregations

GreeterImpl (org.apache.cxf.systest.http.GreeterImpl)2 KeyStore (java.security.KeyStore)1 HashMap (java.util.HashMap)1 KeyManagerFactory (javax.net.ssl.KeyManagerFactory)1 QName (javax.xml.namespace.QName)1 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 TLSServerParameters (org.apache.cxf.configuration.jsse.TLSServerParameters)1 ClientAuthentication (org.apache.cxf.configuration.security.ClientAuthentication)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1 JettyHTTPServerEngineFactory (org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory)1