本文整理匯總了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;
}