Java Code Examples for javax.jws.WebResult#header()
The following examples show how to use
javax.jws.WebResult#header() .
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 |
@Override public String getResponseWrapperPartName(OperationInfo op, Method method) { method = getDeclaredMethod(method); WebResult webResult = getWebResult(method); ResponseWrapper rw = method.getAnnotation(ResponseWrapper.class); if (rw != null) { String pn = getWithReflection(ResponseWrapper.class, rw, "partName"); if (pn != null) { return pn; } } int countOut = 0; int countHeaders = 0; if (webResult != null && webResult.header()) { countHeaders++; } else if (method.getReturnType() != Void.TYPE) { countOut++; } for (int x = 0; x < method.getParameterTypes().length; x++) { WebParam parm = getWebParam(method, x); if (parm != null) { if (parm.header()) { countHeaders++; } if (parm.mode() != WebParam.Mode.IN) { countOut++; } } } if (countHeaders > 0 && countOut == 0) { //all outs are headers, thus it's an empty body part //thus return the default for an empty part of "result" return "result"; } return null; }
Example 2
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
@Override public Boolean isHeader(Method method, int j) { method = getDeclaredMethod(method); if (j >= 0) { WebParam webParam = getWebParam(method, j); return webParam != null && webParam.header(); } WebResult webResult = getWebResult(method); return webResult != null && webResult.header(); }
Example 3
Source File: AbstractWrapperBeanGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 4
Source File: AbstractWrapperBeanGenerator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 5
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 6
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 7
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 8
Source File: AbstractWrapperBeanGenerator.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 9
Source File: AbstractWrapperBeanGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 10
Source File: AbstractWrapperBeanGenerator.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * 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; }