operationdescriptionimpl.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 1,476 行 · 第 1/5 页
JAVA
1,476 行
if (log.isDebugEnabled()) {
log.debug("Unable to get WebResult annotation");
}
}
}
return webResultAnnotation;
}
public boolean isWebResultAnnotationSpecified() {
return getAnnoWebResult() != null;
}
public boolean isOperationReturningResult() {
boolean isResult = false;
if (!isAnnoOneWay()) {
if (!isDBC() && seiMethod != null) {
if (seiMethod.getReturnType() != Void.TYPE) {
isResult = true;
}
} else if (methodComposite != null) {
if (!DescriptionUtils.isEmpty(methodComposite.getReturnType()) &&
!methodComposite.getReturnType().equals("void"))
isResult = true;
} else {
if (log.isDebugEnabled()) {
log.debug("No class to determine if result is returned");
}
}
}
return isResult;
}
public String getResultName() {
// REVIEW: WSDL/Anno merge
return getAnnoWebResultName();
}
public String getAnnoWebResultName() {
if (!isOperationReturningResult()) {
return null;
}
if (webResultName == null) {
if (getAnnoWebResult() != null && !DescriptionUtils.isEmpty(getAnnoWebResult().name()))
{
webResultName = getAnnoWebResult().name();
} else if (getAnnoSoapBindingStyle() == SOAPBinding.Style.DOCUMENT
&& getAnnoSoapBindingParameterStyle() == SOAPBinding.ParameterStyle.BARE) {
// Default for operation style DOCUMENT and paramater style BARE per JSR 181 MR Sec 4.5.1, pg 23
webResultName = getAnnoWebMethodOperationName() + "Response";
} else {
// Defeault value is "return" per JSR-181 MR Sec. 4.5.1, p. 22
webResultName = "return";
}
}
return webResultName;
}
public String getResultPartName() {
// REVIEW: WSDL/Anno merge
return getAnnoWebResultPartName();
}
public String getAnnoWebResultPartName() {
if (!isOperationReturningResult()) {
return null;
}
if (webResultPartName == null) {
if (getAnnoWebResult() != null &&
!DescriptionUtils.isEmpty(getAnnoWebResult().partName())) {
webResultPartName = getAnnoWebResult().partName();
} else {
// Default is the WebResult.name per JSR-181 MR Sec 4.5.1, pg 23
webResultPartName = getAnnoWebResultName();
}
}
return webResultPartName;
}
public String getResultTargetNamespace() {
// REVIEW: WSDL/Anno merge
return getAnnoWebResultTargetNamespace();
}
public String getAnnoWebResultTargetNamespace() {
if (!isOperationReturningResult()) {
return null;
}
if (webResultTargetNamespace == null) {
if (getAnnoWebResult() != null &&
!DescriptionUtils.isEmpty(getAnnoWebResult().targetNamespace())) {
webResultTargetNamespace = getAnnoWebResult().targetNamespace();
} else if (getAnnoSoapBindingStyle() == SOAPBinding.Style.DOCUMENT
&& getAnnoSoapBindingParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED
&& !getAnnoWebResultHeader()) {
// Default for operation style DOCUMENT and paramater style WRAPPED and the return value
// does not map to a header per JSR-181 MR Sec 4.5.1, pg 23-24
webResultTargetNamespace = WebResult_TargetNamespace_DEFAULT;
} else {
// Default is the namespace from the WebService per JSR-181 MR Sec 4.5.1, pg 23-24
webResultTargetNamespace =
((EndpointDescriptionJava)getEndpointInterfaceDescription()
.getEndpointDescription()).getAnnoWebServiceTargetNamespace();
}
}
return webResultTargetNamespace;
}
public boolean isResultHeader() {
// REVIEW: WSDL/Anno merge
return getAnnoWebResultHeader();
}
public boolean getAnnoWebResultHeader() {
if (!isOperationReturningResult()) {
return false;
}
if (webResultHeader == null) {
if (getAnnoWebResult() != null) {
// Unlike the elements with a String value, if the annotation is present, exclude will always
// return a usable value since it will default to FALSE if the element is not present.
webResultHeader = new Boolean(getAnnoWebResult().header());
} else {
webResultHeader = WebResult_Header_DEFAULT;
}
}
return webResultHeader.booleanValue();
}
// ===========================================
// ANNOTATION: SOAPBinding
// ===========================================
public SOAPBinding getAnnoSoapBinding() {
// TODO: VALIDATION: Only style of DOCUMENT allowed on Method annotation; remember to check the Type's style setting also
// JSR-181 Sec 4.7 p. 28
if (soapBindingAnnotation == null) {
if (!isDBC() && seiMethod != null) {
soapBindingAnnotation = seiMethod.getAnnotation(SOAPBinding.class);
} else if (isDBC() && methodComposite != null) {
soapBindingAnnotation = methodComposite.getSoapBindingAnnot();
} else {
if (log.isDebugEnabled()) {
log.debug("Unable to get SOAP Binding annotation");
}
}
}
return soapBindingAnnotation;
}
public javax.jws.soap.SOAPBinding.Style getSoapBindingStyle() {
// REVIEW: WSDL/Anno merge
return getAnnoSoapBindingStyle();
}
public javax.jws.soap.SOAPBinding.Style getAnnoSoapBindingStyle() {
if (soapBindingStyle == null) {
if (getAnnoSoapBinding() != null && getAnnoSoapBinding().style() != null) {
soapBindingStyle = getAnnoSoapBinding().style();
} else {
// Per JSR-181 MR Sec 4.7, pg 28: if not specified, use the Type value.
soapBindingStyle = getEndpointInterfaceDescription().getSoapBindingStyle();
}
}
return soapBindingStyle;
}
public javax.jws.soap.SOAPBinding.Use getSoapBindingUse() {
// REVIEW: WSDL/Anno merge
return getAnnoSoapBindingUse();
}
public javax.jws.soap.SOAPBinding.Use getAnnoSoapBindingUse() {
if (soapBindingUse == null) {
if (getAnnoSoapBinding() != null && getAnnoSoapBinding().use() != null) {
soapBindingUse = getAnnoSoapBinding().use();
} else {
// Per JSR-181 MR Sec 4.7, pg 28: if not specified, use the Type value.
soapBindingUse = getEndpointInterfaceDescription().getSoapBindingUse();
}
}
return soapBindingUse;
}
public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle() {
// REVIEW: WSDL/Anno merge
return getAnnoSoapBindingParameterStyle();
}
public javax.jws.soap.SOAPBinding.ParameterStyle getAnnoSoapBindingParameterStyle() {
if (soapBindingParameterStyle == null) {
if (getAnnoSoapBinding() != null && getAnnoSoapBinding().parameterStyle() != null) {
soapBindingParameterStyle = getAnnoSoapBinding().parameterStyle();
} else {
// Per JSR-181 MR Sec 4.7, pg 28: if not specified, use the Type value.
soapBindingParameterStyle =
getEndpointInterfaceDescription().getSoapBindingParameterStyle();
}
}
return soapBindingParameterStyle;
}
// ===========================================
// ANNOTATION: OneWay
// ===========================================
public Oneway getAnnoOneway() {
//TODO: Shouldn't really do it this way...if there is not Oneway annotation,
// we will always be calling the methods to try to retrieve it, since
// it will always be null, should consider relying on 'isOneWay'
if (onewayAnnotation == null) {
if (isDBC() && methodComposite != null) {
if (methodComposite.isOneWay()) {
onewayAnnotation = OneWayAnnot.createOneWayAnnotImpl();
}
} else if (!isDBC() && seiMethod != null) {
onewayAnnotation = seiMethod.getAnnotation(Oneway.class);
} else {
if (log.isDebugEnabled()) {
log.debug("Unable to get OneWay annotation");
}
}
}
return onewayAnnotation;
}
public boolean isOneWay() {
// REVIEW: WSDL/Anno merge
return isAnnoOneWay();
}
public boolean isAnnoOneWay() {
if (onewayIsOneway == null) {
if (getAnnoOneway() != null) {
// The presence of the annotation indicates the method is oneway
onewayIsOneway = new Boolean(true);
} else {
// If the annotation is not present, the default is this is NOT a One Way method
onewayIsOneway = new Boolean(false);
}
}
return onewayIsOneway.booleanValue();
}
private boolean isDBC() {
if (methodComposite != null)
return true;
else
return false;
}
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.description.OperationDescription#getResultType()
*/
public Class getResultType() {
Class returnClass = null;
if (!isDBC() && getSEIMethod() != null) {
Method seiMethod = this.getSEIMethod();
returnClass = seiMethod.getReturnType();
} else if (methodComposite != null) {
returnClass = methodComposite.getReturnTypeClass();
} else {
if (log.isDebugEnabled()) {
log.debug("Unable to get result type from null class");
}
}
return returnClass;
}
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.description.OperationDescription#getResultActualType()
*/
public Class getResultActualType() {
// TODO: Fix this! it isn't doing the right thing for DBC as noted below with FIXME comments
// This is used to marshall the rsp on the service (dbc) and demarshall on the client (reflection)
// But we shouldn't get an async OpDesc on the service since getDispatchableOperation(QN) removes them.
Class returnType = getResultType();
if (returnType == null) {
return null;
}
if (isJAXWSAsyncClientMethod()) {
//pooling implementation
if (Response.class == returnType) {
if (!isDBC()) {
Type type = seiMethod.getGenericReturnType();
ParameterizedType pType = (ParameterizedType)type;
Type aType = pType.getActualTypeArguments()[0];
if (aType != null && ParameterizedType.class.isInstance(aType)) {
return (Class)((ParameterizedType)aType).getRawType();
}
return (C
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?