Search in sources :

Example 1 with BasicAuthHttpListenerWrapper

use of org.apache.openejb.server.httpd.BasicAuthHttpListenerWrapper in project tomee by apache.

the class OpenEJBHttpWsRegistry method addWsContainer.

@Override
public List<String> addWsContainer(final HttpListener inputListener, final ClassLoader classLoader, final String context, final String virtualHost, final String path, final String realmName, // ignored
final String transportGuarantee, final String authMethod, final String moduleId) throws Exception {
    if (path == null)
        throw new NullPointerException("contextRoot is null");
    HttpListener httpListener = inputListener;
    if (httpListener == null)
        throw new NullPointerException("httpListener is null");
    if ("BASIC".equals(authMethod)) {
        httpListener = new BasicAuthHttpListenerWrapper(httpListener, realmName);
    }
    final StringBuilder deployedPath = new StringBuilder("");
    if (context != null) {
        if (!context.startsWith("/")) {
            deployedPath.append("/");
        }
        deployedPath.append(context);
        if (!context.endsWith("/")) {
            deployedPath.append("/");
        }
    } else {
        deployedPath.append("/");
    }
    if (path.startsWith("/") && path.length() > 1) {
        deployedPath.append(path.substring(1));
    } else if (path.length() > 1) {
        deployedPath.append(path);
    }
    addWrappedHttpListener(httpListener, classLoader, deployedPath.toString());
    // register wsdl locations for service-ref resolution
    return getResolvedAddresses(deployedPath.toString());
}
Also used : BasicAuthHttpListenerWrapper(org.apache.openejb.server.httpd.BasicAuthHttpListenerWrapper) HttpListener(org.apache.openejb.server.httpd.HttpListener)

Example 2 with BasicAuthHttpListenerWrapper

use of org.apache.openejb.server.httpd.BasicAuthHttpListenerWrapper in project tomee by apache.

the class RsRegistryImpl method createRsHttpListener.

@Override
public AddressInfo createRsHttpListener(final String appId, final String webContext, final HttpListener listener, final ClassLoader classLoader, final String path, final String virtualHost, final String auth, final String realm) {
    final String address = HttpUtil.selectSingleAddress(getResolvedAddresses(path));
    if ("BASIC".equals(auth)) {
        // important to wrap with basic wrapper before classloader wrapping
        addWrappedHttpListener(new BasicAuthHttpListenerWrapper(listener, realm), classLoader, path);
    } else {
        addWrappedHttpListener(listener, classLoader, path);
    }
    addresses.put(address, path);
    return new AddressInfo(address, address);
}
Also used : BasicAuthHttpListenerWrapper(org.apache.openejb.server.httpd.BasicAuthHttpListenerWrapper)

Aggregations

BasicAuthHttpListenerWrapper (org.apache.openejb.server.httpd.BasicAuthHttpListenerWrapper)2 HttpListener (org.apache.openejb.server.httpd.HttpListener)1