- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault
类的一些代码示例,展示了WebFault
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebFault
类的具体详情如下:
包路径:org.codehaus.enunciate.contract.jaxws.WebFault
类名称:WebFault
[英]A fault that is declared potentially thrown in some web service call.
[中]声明可能在某个web服务调用中引发的错误。
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* Calculates a namespace URI for a given package. Default implementation uses the algorithm defined in
* section 3.2 of the jax-ws spec.
*
* @return The calculated namespace uri.
*/
protected String calculateNamespaceURI() {
PackageDeclaration pkg = getPackage();
if ((pkg == null) || ("".equals(pkg.getQualifiedName()))) {
throw new ValidationException(getPosition(), getQualifiedName() + ": a web fault in no package must specify a target namespace.");
}
String[] tokens = pkg.getQualifiedName().split("\\.");
String uri = "http://";
for (int i = tokens.length - 1; i >= 0; i--) {
uri += tokens[i];
if (i != 0) {
uri += ".";
}
}
uri += "/";
return uri;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* The qualified name of the implicit fault bean of this web fault, or null if this web fault
* does not define an implicit faul bean.
*
* @return The qualified name of the implicit fault bean of this web fault.
*/
public String getImplicitFaultBeanQualifiedName() {
String faultBean = null;
if (isImplicitSchemaElement()) {
faultBean = getPackage().getQualifiedName() + ".jaxws." + getSimpleName() + "Bean";
if ((annotation != null) && (annotation.faultBean() != null) && (!"".equals(annotation.faultBean()))) {
faultBean = annotation.faultBean();
}
}
return faultBean;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* Validates a web fault.
*
* @param webFault The web fault to validate.
* @param alreadyVisited The bean names that have alrady been visited.
* @return The validation result.
*/
public ValidationResult validateWebFault(WebFault webFault, Set<String> alreadyVisited) {
AnnotationProcessorEnvironment ape = Context.getCurrentEnvironment();
ValidationResult result = new ValidationResult();
if (webFault.isImplicitSchemaElement()) {
String faultBeanFQN = webFault.getImplicitFaultBeanQualifiedName();
if (!alreadyVisited.add(faultBeanFQN)) {
result.addError(webFault.getPosition(), faultBeanFQN + " conflicts with another generated bean name. Please use the @WebFault annotation " +
"to customize the fault bean name.");
}
else if (ape.getTypeDeclaration(faultBeanFQN) != null) {
result.addError(webFault.getPosition(), faultBeanFQN + " is an existing class. Either move it, or customize the fault bean name with the " +
"@WebFault annotation.");
}
}
return result;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* The qname reference to the fault info.
*
* @return The qname reference to the fault info.
*/
public QName getParticleQName() {
ElementDeclaration faultBean = findExplicitFaultBean();
if (faultBean != null) {
return new QName(faultBean.getNamespace(), faultBean.getName());
}
else {
return new QName(getTargetNamespace(), getElementName());
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* The qname reference to the fault info.
*
* @return The qname reference to the fault info.
*/
public QName getParticleQName() {
if (this.explicitFaultBean != null) {
return new QName(this.explicitFaultBean.getNamespace(), this.explicitFaultBean.getName());
}
else {
return new QName(getTargetNamespace(), getElementName());
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* Gets the target namespace of the implicit fault bean, or null if this web fault defines
* an explicit fault info bean.
*
* @return the target namespace of the implicit fault bean, or null.
*/
public String getTargetNamespace() {
String targetNamespace = null;
if (isImplicitSchemaElement()) {
if (annotation != null) {
targetNamespace = annotation.targetNamespace();
}
if ((targetNamespace == null) || ("".equals(targetNamespace))) {
targetNamespace = calculateNamespaceURI();
}
}
return targetNamespace;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-client
allFaults.put(fault.getQualifiedName(), fault);
boolean implicit = webFault.isImplicitSchemaElement();
String faultBean = implicit ? getBeanName(classnameFor, webFault.getImplicitFaultBeanQualifiedName()) : classnameFor.convert(webFault.getExplicitFaultBeanType());
ElementDeclaration explicitFaultBean = webFault.findExplicitFaultBean();
String faultElementName = explicitFaultBean == null ? webFault.getElementName() : explicitFaultBean.getName();
String faultElementNamespace = explicitFaultBean == null ? webFault.getTargetNamespace() : explicitFaultBean.getNamespace();
this.generatedAnnotations.fault2WebFault.put(faultClass, new WebFaultAnnotation(faultElementName, faultElementNamespace, faultBean, implicit));
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
model.put("superFault", allFaults.get(superFault.getQualifiedName()));
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
model.put("superFault", allFaults.get(superFault.getQualifiedName()));
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
allFaults.put(fault.getQualifiedName(), fault);
boolean implicit = webFault.isImplicitSchemaElement();
String faultBean = implicit ? getBeanName(classnameFor, webFault.getImplicitFaultBeanQualifiedName()) : classnameFor.convert(webFault.getExplicitFaultBean());
String faultElementName = webFault.isImplicitSchemaElement() ? webFault.getElementName() : webFault.getExplicitFaultBean().getName();
String faultElementNamespace = webFault.isImplicitSchemaElement() ? webFault.getTargetNamespace() : webFault.getExplicitFaultBean().getNamespace();
this.generatedAnnotations.fault2WebFault.put(faultClass, new WebFaultAnnotation(faultElementName, faultElementNamespace, faultBean, implicit));
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
model.put("superFault", allFaults.get(superFault.getQualifiedName()));
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
model.put("superFault", allFaults.get(superFault.getQualifiedName()));
代码示例来源:origin: org.codehaus.enunciate/enunciate-java-client
allFaults.put(fault.getQualifiedName(), fault);
boolean implicit = webFault.isImplicitSchemaElement();
String faultBean = implicit ? getBeanName(classnameFor, webFault.getImplicitFaultBeanQualifiedName()) : classnameFor.convert(webFault.getExplicitFaultBeanType());
seeAlsos.add(faultBean);
for (WebFault webFault : allFaults.values()) {
if (useServerSide(webFault, matcher)) {
SourcePosition position = webFault.getPosition();
if (position == null || position.file() == null) {
throw new IllegalStateException("Unable to find source file for " + webFault.getQualifiedName());
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
model.put("superFault", allFaults.get(superFault.getQualifiedName()));
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
public WebFault(ClassDeclaration delegate) {
super(delegate);
this.annotation = getAnnotation(javax.xml.ws.WebFault.class);
Collection<PropertyDeclaration> properties = getProperties();
PropertyDeclaration faultInfoProperty = null;
for (PropertyDeclaration propertyDeclaration : properties) {
Collection<ConstructorDeclaration> constructors = getConstructors();
for (ConstructorDeclaration constructor : constructors) {
if (constructor.getModifiers().contains(Modifier.PUBLIC)) {
throw new ValidationException(getPosition(), "The faultInfo bean for a web fault must be a root element. " + explicitFaultClass.getQualifiedName()
+ " must be annotated with @XmlRootElement.");
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
protected Iterator<WebFault> getLoop(TemplateModel model) throws TemplateException {
WsdlInfo wsdl = this.wsdl;
if (wsdl == null) {
throw new MissingParameterException("wsdl");
}
HashMap<String, WebFault> declaredFaults = new HashMap<String, WebFault>();
for (EndpointInterface ei : wsdl.getEndpointInterfaces()) {
Collection<WebMethod> webMethods = ei.getWebMethods();
for (WebMethod webMethod : webMethods) {
for (WebFault webFault : webMethod.getWebFaults()) {
declaredFaults.put(webFault.getQualifiedName(), webFault);
}
}
}
return declaredFaults.values().iterator();
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* Adds any type definitions referenced by a web fault.
*
* @param webFault The web fault.
*/
protected void addReferencedTypeDefinitions(WebFault webFault) {
if (webFault.isImplicitSchemaElement()) {
for (ImplicitChildElement childElement : webFault.getChildElements()) {
WebFault.FaultBeanChildElement fbce = (WebFault.FaultBeanChildElement) childElement;
REFERENCE_STACK.get().addFirst("property " + fbce.getProperty().getSimpleName());
addReferencedTypeDefinitions(fbce.isAdapted() ? fbce.getAdapterType() : fbce.getType());
REFERENCE_STACK.get().removeFirst();
}
}
else {
REFERENCE_STACK.get().addFirst("explicit fault bean");
ClassType faultBeanType = webFault.getExplicitFaultBeanType();
if (faultBeanType != null) {
addReferencedTypeDefinitions(faultBeanType);
}
REFERENCE_STACK.get().removeFirst();
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-jaxws
/**
* Validates a web fault.
*
* @param webFault The web fault to validate.
* @param alreadyVisited The bean names that have alrady been visited.
* @return The validation result.
*/
public ValidationResult validateWebFault(WebFault webFault, Set<String> alreadyVisited) {
AnnotationProcessorEnvironment ape = Context.getCurrentEnvironment();
ValidationResult result = new ValidationResult();
if (webFault.isImplicitSchemaElement()) {
String faultBeanFQN = webFault.getImplicitFaultBeanQualifiedName();
if (!alreadyVisited.add(faultBeanFQN)) {
result.addError(webFault, faultBeanFQN + " conflicts with another generated bean name. Please use the @WebFault annotation " +
"to customize the fault bean name.");
}
else if (ape.getTypeDeclaration(faultBeanFQN) != null) {
result.addError(webFault, faultBeanFQN + " is an existing class. Either move it, or customize the fault bean name with the " +
"@WebFault annotation.");
}
}
return result;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* The element name of the implicit web fault bean, or null if this isn't an implicit web fault.
*
* @return The element name of the implicit web fault, or null.
*/
public String getElementName() {
String name = null;
if (isImplicitSchemaElement()) {
name = getSimpleName();
if ((annotation != null) && (annotation.name() != null) && (!"".equals(annotation.name()))) {
name = annotation.name();
}
}
return name;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* Calculates a namespace URI for a given package. Default implementation uses the algorithm defined in
* section 3.2 of the jax-ws spec.
*
* @return The calculated namespace uri.
*/
protected String calculateNamespaceURI() {
PackageDeclaration pkg = getPackage();
if ((pkg == null) || ("".equals(pkg.getQualifiedName()))) {
throw new ValidationException(getPosition(), "A web service in no package must specify a target namespace.");
}
String[] tokens = pkg.getQualifiedName().split("\\.");
String uri = "http://";
for (int i = tokens.length - 1; i >= 0; i--) {
uri += tokens[i];
if (i != 0) {
uri += ".";
}
}
uri += "/";
return uri;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-gwt
String pckg = webFault.getPackage().getQualifiedName();
if (!pckg.startsWith(this.rpcModuleNamespace) && !conversions.containsKey(pckg) && (getKnownGwtModule(webFault) == null)) {
conversions.put(pckg, clientNamespace + "." + pckg);
debug("Skipping generating fault for %s because it's in a known GWT module.", webFault.getQualifiedName());
model.put("fault", webFault);
processTemplate(faultMapperTemplate, model);
gwt2jaxbMappings.setProperty(classnameFor.convert(webFault), webFault.getQualifiedName());
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
if (!isImplicitSchemaElement()) {
return Collections.emptyList();
for (PropertyDeclaration property : getAllFaultProperties(this)) {
String propertyName = property.getPropertyName();
if (("cause".equals(propertyName)) || ("localizedMessage".equals(propertyName)) || ("stackTrace".equals(propertyName)) || "suppressed".equals(propertyName)) {
final WebFaultPropertyOrder propOrder = getAnnotation(WebFaultPropertyOrder.class);
if (propOrder != null) {
Set<ImplicitChildElement> resorted = new TreeSet<ImplicitChildElement>(new Comparator<ImplicitChildElement>() {
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
public int compare(ImplicitChildElement o1, ImplicitChildElement o2) {
int index1 = -1;
int index2 = -1;
for (int i = 0; i < propOrder.value().length; i++) {
String prop = propOrder.value()[i];
if (o1.getElementName().equals(prop)) {
index1 = i;
}
if (o2.getElementName().equals(prop)) {
index2 = i;
}
}
if (index1 < 0) {
throw new ValidationException(WebFault.this.getPosition(), WebFault.this.getQualifiedName() + ": @WebFaultPropertyOrder doesn't specify a property '" + o1.getElementName() + "'.");
}
else if (index2 < 0) {
throw new ValidationException(WebFault.this.getPosition(), WebFault.this.getQualifiedName() + ": @WebFaultPropertyOrder doesn't specify a property '" + o2.getElementName() + "'.");
}
else {
return index1 - index2;
}
}
});
代码示例来源:origin: org.codehaus.enunciate/enunciate-jaxws
processTemplate(responseBeanTemplate, model);
else if ((webMessage instanceof WebFault) && ((WebFault) webMessage).isImplicitSchemaElement() && visitedFaults.add((WebFault) webMessage)) {
model.put("message", webMessage);
processTemplate(faultBeanTemplate, model);
WebFault fault = new WebFault((ClassDeclaration) declaration);
if (fault.isImplicitSchemaElement() && visitedFaults.add(fault)) {
model.put("message", fault);
processTemplate(faultBeanTemplate, model);
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* If this is an implicit fault bean, return the child elements.
*
* @return The child elements of the bean, or null if none.
*/
public Collection<ImplicitChildElement> getChildElements() {
if (!isImplicitSchemaElement()) {
return Collections.emptyList();
}
Collection<ImplicitChildElement> childElements = new ArrayList<ImplicitChildElement>();
for (PropertyDeclaration property : getAllProperties(this)) {
String propertyName = property.getPropertyName();
if (("cause".equals(propertyName)) || ("localizedMessage".equals(propertyName)) || ("stackTrace".equals(propertyName))) {
continue;
}
childElements.add(new FaultBeanChildElement(property));
}
return childElements;
}
我目前正在阅读以了解有关按契约(Contract)设计/代码契约(Contract)的更多信息。 据我所知,就是写契约(Invariants,Pre and Post conditions)来确保代码
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
我正在处理 spring cloud contract 并且有一个用例,我希望在缺少一些查询参数时响应为 BAD_REQUEST,而在所有必需查询参数都存在时响应为 OK。为了实现这一点,我有不同的契
按契约(Contract)设计的最佳实践是什么? 在大学里,我通过契约(Contract)范式学习了设计 (在OO环境中) 我们已经学习了三种解决问题的方法: 1)全面编程:涵盖其所有可能的异常(ex
从理论上讲,这似乎是避免错误的一个很好的解决方案,但为什么在实践中我们听到的很少呢? 例如,为什么我们不能在 Java 或 .net 上看到对它的更多支持? 最佳答案 我也一直在寻找这个答案。但它似乎
我读到编译器可以在编译时强制执行 dbc。它是怎么做到的? 最佳答案 据我所知,迄今为止最强大的静态DbC语言是Spec# by Microsoft Research .它使用名为 Boogie 的强
我试图让 VS2010 Ultimate with Code Contracts 生成错误而不是警告。 我有这个简单的测试程序: using System.Diagnostics.Contracts;
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
如何关闭对 Linq2Sql 代码的静态检查? 最佳答案 您可以通过使用 [ContractVerification(false)] 标记有问题的类来抑制对静态代码的检查。 如果您生成的类是部分,您可
我正在使用 WCF 制作一个应用程序的原型(prototype),我正在尝试定义一个回调与派生自另一个接口(interface)的接口(interface)签订契约(Contract)。这样做,生成的
我最近在 .Net Rocks 节目 570 ( http://devjourney.com/community/dotnet-rocks-show-570-with-kevin-hazzard/ )
我注意到微软在 .NET 4 中以一种奇怪的方式命名了他们的代码契约(Contract)相关函数。 他们在“require”和“ensure”的末尾添加“s”,所以有Contract.Requires
我对 WCF 比较陌生。但是,我需要创建一个向 Silverlight 和 AJAX 客户端应用程序公开数据的服务。为了实现这一目标,我创建了以下服务作为概念证明: [ServiceContract(
我一直在兜圈子,试图弄清楚这个问题。 我正在尝试选择已结束最近契约(Contract)但仍保留上一份有效契约(Contract)的员工。 例如,一名员工拥有多份契约(Contract)(有些可能是临时
使用合同密钥,有两个函数fetchByKey和lookupByKey,后者允许我处理否定查找。我没有看到针对合同编号执行相同操作的lookup : (Template t) => ContractId
我有一个用于特定 Assets (A、B、...)的合约的 pandas 数据框。每个契约(Contract)都有开始日期、结束日期(包括两者)和日费率(契约(Contract)不能重叠)。我想生成一
我有这个代码: using System; using System.Diagnostics.Contracts; namespace TestCodeContracts { class Pr
我在使用 Flow 时遇到问题,其中给定的已实现 type 通过要求我仅使用在 type 上声明的属性而不是来限制我的对象 API要求我声明所有 type 的属性。 我是 Flow 的新手,所以我可能
我有一个使用 WCF 与后端数据库通信的 Web 应用程序。我已经一切正常,但我想知道将我相当大的服务契约(Contract)分成几个契约(Contract)是否会更好。 就目前而言,服务契约(Con
我想编写单元测试来验证我的方法不接受无效参数。使用 Code Contract 的 Contract.Requires 调用检查参数的有效性。我为什么要测试合约?我认为我的测试是一种方法规范(实际上是
我是一名优秀的程序员,十分优秀!