首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我该如何改变由enunciate生成的REST上下文呢?

我该如何改变由enunciate生成的REST上下文呢?
EN

Stack Overflow用户
提问于 2011-08-17 10:12:48
回答 2查看 5K关注 0票数 5

我的RESTEasy代码中有以下注释:

代码语言:javascript
复制
@Path("/v1/authenticateService")

声明在文档中生成“装载点”,如下所示:

代码语言:javascript
复制
/rest/v1/authenticateService/authenticate

我尝试在我的enunciate.xml中使用以下内容来覆盖"/rest“上下文:

代码语言:javascript
复制
<services>
    <rest defaultRestSubcontext="/gateway-service-access-pox" />
</services>

我也尝试过以下方法,但也没有任何效果:

代码语言:javascript
复制
<deployment protocol="https" host="(host)" context="/gateway-service-access-pox" />

我正在使用enunciate 1.23为Maven3的多模块项目生成文档。

以下是写入控制台的内容:

代码语言:javascript
复制
[INFO] --- maven-site-plugin:3.0:site (default-cli) @ gateway-service-access-pox ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.4
[INFO] configuring report plugin org.codehaus.enunciate:maven-enunciate-plugin:1.23
[WARNING] No project URL defined - decoration links will not be relativized!
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
[INFO] Generating "About" report    --- maven-project-info-reports-plugin:2.4
[INFO] Generating "Web Service API" report    --- maven-enunciate-plugin:1.23
[INFO] initializing enunciate.
[INFO] invoking enunciate:generate step...
[INFO] invoking enunciate:compile step...
[INFO] invoking enunciate:build step...
[INFO] closing enunciate.

你知道我做错了什么吗?

更多信息...完整的enunciate.xml (以防出现影响条目的问题:

代码语言:javascript
复制
<?xml version="1.0"?>
<enunciate label="platform-gateway-api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.23.xsd">

<api-import pattern="com.intuit.platform.gateway.common.DetailedResponse" />
<api-import pattern="com.intuit.platform.gateway.service.access.domain.*" />
<api-import pattern="com.intuit.platform.gateway.service.identity.domain.Identity" />

<deployment protocol="https" host="(host)" context="/gateway-service-access-pox" />

<namespaces>
    <namespace uri="http://schema.intuit.com/platform/integration/detailedResponse/v1" id="common" />
    <namespace uri="http://schema.intuit.com/platform/identity/user/v1" id="user" />
    <namespace uri="http://schema.intuit.com/platform/access/token/v1" id="token" />
</namespaces>

<services>
    <rest defaultRestSubcontext="/gateway-service-access-pox" />
</services>

<modules>
    <!-- Docs -->
    <docs splashPackage="com.intuit.platform.gateway.service.ticket.api" title="Platform Gateway Access API"
        copyright="Intuit Inc">
        <download name="License" file="LICENSE.txt" description="The license file governing the use of this API." />
    </docs>
    <!-- Disable all the client generation tools -->
    <basic-app disabled="true" />
    <c disabled="true" />
    <csharp disabled="true" />
    <java-client disabled="true" />
    <jaxws-client disabled="true" />
    <jaxws-ri disabled="true" />
    <jaxws-support disabled="true" />
    <jersey disabled="true" />
    <obj-c disabled="true" />
    <xml disabled="true" />
</modules>
</enunciate>

顺便说一句,如果有更好的方法在这个问题上获得帮助(某种错误论坛),请让我知道。我是一个口齿不清的新手,不知道这是一个bug还是我的无知。

EN

回答 2

Stack Overflow用户

发布于 2011-12-22 00:49:29

正如瑞安所说,"defaultRestSubcontext“起作用了。例如,我这样使用它从默认生成的挂载点中删除"rest“:

代码语言:javascript
复制
  <rest defaultRestSubcontext="/" />

如果将defaultRestSubcontext设置为"/“,则生成从"/”开始,然后是端点的路径。

附言:我使用的是发音1.24

票数 2
EN

Stack Overflow用户

发布于 2012-10-04 19:41:27

好吧..。我已经在这里工作了几天了,终于它开始工作了,挂载点有了合适的默认REST子上下文:)

为了让它工作,我做了两件事。

  1. 启用XML模块

  • 将阐述-xml jar添加到运行时。

我不知道为什么,但它现在对我来说是有效的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7087273

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档