Java Code Examples for javax.xml.ws.ResponseWrapper#className()

The following examples show how to use javax.xml.ws.ResponseWrapper#className() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JaxWsServiceConfiguration.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public String getResponseWrapperClassName(Method selected) {
    Method m = getDeclaredMethod(selected);

    ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
    String clsName = "";
    if (rw != null) {
        clsName = rw.className();
    }
    if (clsName.length() > 0) {
        return clsName;
    }
    return null;
}
 
Example 2
Source File: JaxWsServiceConfiguration.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Override
public Class<?> getResponseWrapper(Method selected) {
    if (this.responseMethodClassNotFoundCache.contains(selected)) {
        return null;
    }
    Class<?> cachedClass = responseMethodClassCache.get(selected);
    if (cachedClass != null) {
        return cachedClass;
    }

    Method m = getDeclaredMethod(selected);

    ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
    String clsName = "";
    if (rw == null) {
        clsName = getPackageName(selected) + ".jaxws." + StringUtils.capitalize(selected.getName())
                  + "Response";
    } else {
        clsName = rw.className();
    }

    if (clsName.length() > 0) {
        cachedClass = responseMethodClassCache.get(clsName);
        if (cachedClass != null) {
            responseMethodClassCache.put(selected, cachedClass);
            return cachedClass;
        }
        try {
            Class<?> r = ClassLoaderUtils.loadClass(clsName, implInfo.getEndpointClass());
            responseMethodClassCache.put(clsName, r);
            responseMethodClassCache.put(selected, r);

            if (r.equals(m.getReturnType())) {
                LOG.log(Level.WARNING, "INVALID_RESPONSE_WRAPPER", new Object[] {clsName,
                        m.getReturnType().getName()});
            }

            return r;
        } catch (ClassNotFoundException e) {
            //do nothing, we will mock a schema for wrapper bean later on
        }
    }
    responseMethodClassNotFoundCache.add(selected);
    return null;
}