本文整理汇总了Java中javax.jws.WebResult.header方法的典型用法代码示例。如果您正苦于以下问题:Java WebResult.header方法的具体用法?Java WebResult.header怎么用?Java WebResult.header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jws.WebResult
的用法示例。
在下文中一共展示了WebResult.header方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectResponseBeanMembers
import javax.jws.WebResult; //导入方法依赖的package包/类
/**
* Computes response bean members for a method. Collects all OUT and INOUT
* parameters as response bean fields. In this process, if a parameter
* has any known JAXB annotations they are collected as well.
* Special processing for @XmlElement annotation is done.
*
* @param method SEI method for which response bean members are computed
* @return List of response bean members
*/
public List<A> collectResponseBeanMembers(M method) {
List<A> responseMembers = new ArrayList<A>();
// return that need to be part response wrapper bean
String responseElementName = RETURN;
String responseNamespace = EMTPY_NAMESPACE_ID;
boolean isResultHeader = false;
WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
if (webResult != null) {
if (webResult.name().length() > 0) {
responseElementName = webResult.name();
}
if (webResult.targetNamespace().length() > 0) {
responseNamespace = webResult.targetNamespace();
}
isResultHeader = webResult.header();
}
T returnType = getSafeType(nav.getReturnType(method));
if (!isVoidType(returnType) && !isResultHeader) {
List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
}
// Now parameters that need to be part response wrapper bean
int paramIndex = -1;
for (T param : nav.getMethodParameters(method)) {
paramIndex++;
T paramType = getHolderValueType(param);
WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
if (paramType == null || (webParam != null && webParam.header())) {
continue; // not a holder or a header - so don't add it
}
String paramName = (webParam != null && webParam.name().length() > 0)
? webParam.name() : "arg"+paramIndex;
String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
A member = factory.createWrapperBeanMember(paramType,
getPropertyName(paramName), jaxbAnnotation);
responseMembers.add(member);
}
return responseMembers;
}