本文整理汇总了Java中com.sun.xml.internal.ws.api.model.ExceptionType类的典型用法代码示例。如果您正苦于以下问题:Java ExceptionType类的具体用法?Java ExceptionType怎么用?Java ExceptionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionType类属于com.sun.xml.internal.ws.api.model包,在下文中一共展示了ExceptionType类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createException
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* This should be called from the client side to throw an {@link Exception} for a given soap mesage
*/
public Throwable createException(Map<QName, CheckedExceptionImpl> exceptions) throws JAXBException {
DetailType dt = getDetail();
Node detail = null;
if(dt != null) detail = dt.getDetail(0);
//return ProtocolException if the detail is not present or there is no checked exception
if(detail == null || exceptions == null){
// No soap detail, doesnt look like its a checked exception
// throw a protocol exception
return attachServerException(getProtocolException());
}
//check if the detail is a checked exception, if not throw a ProtocolException
QName detailName = new QName(detail.getNamespaceURI(), detail.getLocalName());
CheckedExceptionImpl ce = exceptions.get(detailName);
if (ce == null) {
//No Checked exception for the received detail QName, throw a SOAPFault exception
return attachServerException(getProtocolException());
}
if (ce.getExceptionType().equals(ExceptionType.UserDefined)) {
return attachServerException(createUserDefinedException(ce));
}
Class exceptionClass = ce.getExceptionClass();
try {
Constructor constructor = exceptionClass.getConstructor(String.class, (Class) ce.getDetailType().type);
Exception exception = (Exception) constructor.newInstance(getFaultString(), getJAXBObject(detail, ce));
return attachServerException(exception);
} catch (Exception e) {
throw new WebServiceException(e);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:SOAPFaultBuilder.java
示例2: getFaultDetail
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
private static Object getFaultDetail(CheckedExceptionImpl ce, Throwable exception) {
if (ce == null)
return null;
if (ce.getExceptionType().equals(ExceptionType.UserDefined)) {
return createDetailFromUserDefinedException(ce, exception);
}
try {
Method m = exception.getClass().getMethod("getFaultInfo");
return m.invoke(exception);
} catch (Exception e) {
throw new SerializationException(e);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:SOAPFaultBuilder.java
示例3: getFaultDetail
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
private static Object getFaultDetail(CheckedExceptionImpl ce, Throwable exception) {
if (ce == null)
return null;
if (ce.getExceptionType().equals(ExceptionType.UserDefined)) {
return createDetailFromUserDefinedException(ce, exception);
}
try {
return ce.getFaultInfoGetter().invoke(exception);
} catch (Exception e) {
throw new SerializationException(e);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:SOAPFaultBuilder.java
示例4: processExceptions
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* models the exceptions thrown by <code>method</code> and adds them to the <code>javaMethod</code>
* runtime model object
* @param javaMethod the runtime model object to add the exception model objects to
* @param method the <code>method</code> from which to find the exceptions to model
*/
protected void processExceptions(JavaMethodImpl javaMethod, Method method) {
Action actionAnn = getAnnotation(method, Action.class);
FaultAction[] faultActions = {};
if(actionAnn != null)
faultActions = actionAnn.fault();
for (Class<?> exception : method.getExceptionTypes()) {
//Exclude RuntimeException, RemoteException and Error etc
if (!EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
if (RUNTIME_EXCEPTION_CLASS.isAssignableFrom(exception) || REMOTE_EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
Class exceptionBean;
Annotation[] anns;
WebFault webFault = getAnnotation(exception, WebFault.class);
Method faultInfoMethod = getWSDLExceptionFaultInfo(exception);
ExceptionType exceptionType = ExceptionType.WSDLException;
String namespace = targetNamespace;
String name = exception.getSimpleName();
String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
if (packageName.length() == 0)
beanPackage = JAXWS_PACKAGE_PD;
String className = beanPackage+ name + BEAN;
String messageName = exception.getSimpleName();
if (webFault != null) {
if (webFault.faultBean().length()>0)
className = webFault.faultBean();
if (webFault.name().length()>0)
name = webFault.name();
if (webFault.targetNamespace().length()>0)
namespace = webFault.targetNamespace();
if (webFault.messageName().length()>0)
messageName = webFault.messageName();
}
if (faultInfoMethod == null) {
exceptionBean = getExceptionBeanClass(className, exception, name, namespace);
exceptionType = ExceptionType.UserDefined;
anns = getAnnotations(exceptionBean);
} else {
exceptionBean = faultInfoMethod.getReturnType();
anns = getAnnotations(faultInfoMethod);
}
QName faultName = new QName(namespace, name);
TypeInfo typeRef = new TypeInfo(faultName, exceptionBean, anns);
CheckedExceptionImpl checkedException =
new CheckedExceptionImpl(javaMethod, exception, typeRef, exceptionType);
checkedException.setMessageName(messageName);
for(FaultAction fa: faultActions) {
if(fa.className().equals(exception) && !fa.value().equals("")) {
checkedException.setFaultAction(fa.value());
break;
}
}
javaMethod.addException(checkedException);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:64,代码来源:RuntimeModeler.java
示例5: getExceptionType
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
public ExceptionType getExceptionType() {
return exceptionType;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:CheckedExceptionImpl.java
示例6: processExceptions
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* models the exceptions thrown by <code>method</code> and adds them to the <code>javaMethod</code>
* runtime model object
* @param javaMethod the runtime model object to add the exception model objects to
* @param method the <code>method</code> from which to find the exceptions to model
*/
protected void processExceptions(JavaMethodImpl javaMethod, Method method) {
Action actionAnn = getAnnotation(method, Action.class);
FaultAction[] faultActions = {};
if(actionAnn != null)
faultActions = actionAnn.fault();
for (Class<?> exception : method.getExceptionTypes()) {
//Exclude RuntimeException, RemoteException and Error etc
if (!EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
if (RUNTIME_EXCEPTION_CLASS.isAssignableFrom(exception) || isRemoteException(exception))
continue;
if (getAnnotation(exception, javax.xml.bind.annotation.XmlTransient.class) != null)
continue;
Class exceptionBean;
Annotation[] anns;
WebFault webFault = getAnnotation(exception, WebFault.class);
Method faultInfoMethod = getWSDLExceptionFaultInfo(exception);
ExceptionType exceptionType = ExceptionType.WSDLException;
String namespace = targetNamespace;
String name = exception.getSimpleName();
String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
if (packageName.length() == 0)
beanPackage = JAXWS_PACKAGE_PD;
String className = beanPackage+ name + BEAN;
String messageName = exception.getSimpleName();
if (webFault != null) {
if (webFault.faultBean().length()>0)
className = webFault.faultBean();
if (webFault.name().length()>0)
name = webFault.name();
if (webFault.targetNamespace().length()>0)
namespace = webFault.targetNamespace();
if (webFault.messageName().length()>0)
messageName = webFault.messageName();
}
if (faultInfoMethod == null) {
exceptionBean = getExceptionBeanClass(className, exception, name, namespace);
exceptionType = ExceptionType.UserDefined;
anns = getAnnotations(exceptionBean);
} else {
exceptionBean = faultInfoMethod.getReturnType();
anns = getAnnotations(faultInfoMethod);
}
QName faultName = new QName(namespace, name);
TypeInfo typeRef = new TypeInfo(faultName, exceptionBean, anns);
CheckedExceptionImpl checkedException =
new CheckedExceptionImpl(javaMethod, exception, typeRef, exceptionType);
checkedException.setMessageName(messageName);
checkedException.setFaultInfoGetter(faultInfoMethod);
for(FaultAction fa: faultActions) {
if(fa.className().equals(exception) && !fa.value().equals("")) {
checkedException.setFaultAction(fa.value());
break;
}
}
javaMethod.addException(checkedException);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:66,代码来源:RuntimeModeler.java
示例7: processExceptions
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* models the exceptions thrown by <code>method</code> and adds them to the <code>javaMethod</code>
* runtime model object
* @param javaMethod the runtime model object to add the exception model objects to
* @param method the <code>method</code> from which to find the exceptions to model
*/
protected void processExceptions(JavaMethodImpl javaMethod, Method method) {
Action actionAnn = getAnnotation(method, Action.class);
FaultAction[] faultActions = {};
if(actionAnn != null)
faultActions = actionAnn.fault();
for (Class<?> exception : method.getExceptionTypes()) {
//Exclude RuntimeException, RemoteException and Error etc
if (!EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
if (RUNTIME_EXCEPTION_CLASS.isAssignableFrom(exception) || REMOTE_EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
if (getAnnotation(exception, javax.xml.bind.annotation.XmlTransient.class) != null)
continue;
Class exceptionBean;
Annotation[] anns;
WebFault webFault = getAnnotation(exception, WebFault.class);
Method faultInfoMethod = getWSDLExceptionFaultInfo(exception);
ExceptionType exceptionType = ExceptionType.WSDLException;
String namespace = targetNamespace;
String name = exception.getSimpleName();
String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
if (packageName.length() == 0)
beanPackage = JAXWS_PACKAGE_PD;
String className = beanPackage+ name + BEAN;
String messageName = exception.getSimpleName();
if (webFault != null) {
if (webFault.faultBean().length()>0)
className = webFault.faultBean();
if (webFault.name().length()>0)
name = webFault.name();
if (webFault.targetNamespace().length()>0)
namespace = webFault.targetNamespace();
if (webFault.messageName().length()>0)
messageName = webFault.messageName();
}
if (faultInfoMethod == null) {
exceptionBean = getExceptionBeanClass(className, exception, name, namespace);
exceptionType = ExceptionType.UserDefined;
anns = getAnnotations(exceptionBean);
} else {
exceptionBean = faultInfoMethod.getReturnType();
anns = getAnnotations(faultInfoMethod);
}
QName faultName = new QName(namespace, name);
TypeInfo typeRef = new TypeInfo(faultName, exceptionBean, anns);
CheckedExceptionImpl checkedException =
new CheckedExceptionImpl(javaMethod, exception, typeRef, exceptionType);
checkedException.setMessageName(messageName);
checkedException.setFaultInfoGetter(faultInfoMethod);
for(FaultAction fa: faultActions) {
if(fa.className().equals(exception) && !fa.value().equals("")) {
checkedException.setFaultAction(fa.value());
break;
}
}
javaMethod.addException(checkedException);
}
}
开发者ID:campolake,项目名称:openjdk9,代码行数:66,代码来源:RuntimeModeler.java
示例8: processExceptions
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* models the exceptions thrown by <code>method</code> and adds them to the <code>javaMethod</code>
* runtime model object
* @param javaMethod the runtime model object to add the exception model objects to
* @param method the <code>method</code> from which to find the exceptions to model
*/
protected void processExceptions(JavaMethodImpl javaMethod, Method method) {
Action actionAnn = method.getAnnotation(Action.class);
FaultAction[] faultActions = {};
if(actionAnn != null)
faultActions = actionAnn.fault();
for (Class<?> exception : method.getExceptionTypes()) {
//Exclude RuntimeException, RemoteException and Error etc
if (!EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
if (RUNTIME_EXCEPTION_CLASS.isAssignableFrom(exception) || REMOTE_EXCEPTION_CLASS.isAssignableFrom(exception))
continue;
Class exceptionBean;
Annotation[] anns;
WebFault webFault = getPrivClassAnnotation(exception, WebFault.class);
Method faultInfoMethod = getWSDLExceptionFaultInfo(exception);
ExceptionType exceptionType = ExceptionType.WSDLException;
String namespace = targetNamespace;
String name = exception.getSimpleName();
String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
if (packageName.length() == 0)
beanPackage = JAXWS_PACKAGE_PD;
String className = beanPackage+ name + BEAN;
String messageName = exception.getSimpleName();
if (webFault != null) {
if (webFault.faultBean().length()>0)
className = webFault.faultBean();
if (webFault.name().length()>0)
name = webFault.name();
if (webFault.targetNamespace().length()>0)
namespace = webFault.targetNamespace();
if (webFault.messageName().length()>0)
messageName = webFault.messageName();
}
if (faultInfoMethod == null) {
exceptionBean = getExceptionBeanClass(className, exception, name, namespace);
exceptionType = ExceptionType.UserDefined;
anns = exceptionBean.getAnnotations();
} else {
exceptionBean = faultInfoMethod.getReturnType();
anns = faultInfoMethod.getAnnotations();
}
QName faultName = new QName(namespace, name);
TypeReference typeRef = new TypeReference(faultName, exceptionBean, anns);
CheckedExceptionImpl checkedException =
new CheckedExceptionImpl(javaMethod, exception, typeRef, exceptionType);
checkedException.setMessageName(messageName);
for(FaultAction fa: faultActions) {
if(fa.className().equals(exception) && !fa.value().equals("")) {
checkedException.setFaultAction(fa.value());
break;
}
}
javaMethod.addException(checkedException);
}
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:64,代码来源:RuntimeModeler.java
示例9: CheckedExceptionImpl
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* @param jm {@link JavaMethodImpl} that throws this exception
* @param exceptionClass
* Userdefined or WSDL exception class that extends
* java.lang.Exception.
* @param detail
* detail or exception bean's TypeReference
* @param exceptionType
* either ExceptionType.UserDefined or
*/
public CheckedExceptionImpl(JavaMethodImpl jm, Class exceptionClass, TypeInfo detail, ExceptionType exceptionType) {
this.detail = detail;
this.exceptionType = exceptionType;
this.exceptionClass = exceptionClass;
this.javaMethod = jm;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CheckedExceptionImpl.java
示例10: CheckedExceptionImpl
import com.sun.xml.internal.ws.api.model.ExceptionType; //导入依赖的package包/类
/**
* @param jm {@link JavaMethodImpl} that throws this exception
* @param exceptionClass
* Userdefined or WSDL exception class that extends
* java.lang.Exception.
* @param detail
* detail or exception bean's TypeReference
* @param exceptionType
* either ExceptionType.UserDefined or
*/
public CheckedExceptionImpl(JavaMethodImpl jm, Class exceptionClass, TypeReference detail, ExceptionType exceptionType) {
this.detail = detail;
this.exceptionType = exceptionType;
this.exceptionClass = exceptionClass;
this.javaMethod = jm;
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:17,代码来源:CheckedExceptionImpl.java
注:本文中的com.sun.xml.internal.ws.api.model.ExceptionType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论