我对现有的Java REST(使用Jersey)项目使用'enunciate'。 我有build.xml和enunciate.xml:输出文件docs.zip已创建,但在解压缩此文件后,我有: css / dir, js / dir, robots.txt,model.html,index.html,favicon.ico,crossdomain.xml,application.wadl,apple-touch-icon.png文件。
index.html和model.html没有我的java REST代码中的任何文档。 谁能在这帮助我? 我没有'发音'经验。
谢谢,
--->这是REST代码示例之一:
@Path( “/ {spacecraftId} /登录”)
公共类UserLogHandler 实现ProcessCommunicationFacilityFailureListenerInterface, MessageCustomerInterface, IMessageAvailable {
/**
* Retrieve log file information from MySQL database:
*
*/
@GET
@Produces(MediaType.TEXT_XML)
public Response retrieveLogFromDatabase(
@PathParam("spacecraftId") String spacecraftId,
@Context HttpServletRequest servletRequest)
{
}
}
---> 'build.xml'文件:
<!--The enunciate classpath points to all the jars in the "lib" directory.-->
<path id="enunciate.classpath">
<pathelement path="${acmd-class-dir}:${mdasclasses.dir}"/>
<fileset dir="/TPS/V19.0.2">
<include name="xerces/xercesImpl.jar"/>
<include name="xerces/xml-apis.jar"/>
<include name="jdkaddons/jdom.jar"/>
<include name="jdkaddons/mail.jar"/>
<include name="jdkaddons/commons-codec.jar"/>
<include name="jdkaddons/asm-3.1.jar"/>
<include name="jdkaddons/jersey-core-1.7.jar"/>
<include name="jdkaddons/jersey-server-1.7.jar"/>
<include name="jdkaddons/jsr311-api-1.1.1.jar"/>
<include name="jdkaddons/jersey-client-1.7.jar"/>
<include name="jdkaddons/jersey-multipart-1.7.jar"/>
</fileset>
<fileset dir="${enunciate.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${enunciate.java}">
<include name="lib/tools.jar"/>
</fileset>
</path>
<!--define the task...-->
<taskdef name="enunciate" classname="org.codehaus.enunciate.main.EnunciateTask">
<classpath refid="enunciate.classpath"/>
</taskdef>
<enunciate basedir="./" verbose="true" configFile="./enunciate.xml" >
<include name="**/*.java"/>
<classpath refid="enunciate.classpath"/>
<export artifactId="docs" destination="./docs.zip"/>
<javacArgument argument="-g"/>
</enunciate>
---&GT; 'enunciate.xml'文件:
<api-classes>
<include pattern="/tps/tomcat/lib/servlet-api.jar"/>>
<exclude pattern="com.sun.jersey.multipart.FormDataParam"/>
</api-classes>
<services>
<rest defaultRestSubcontext="api">
</rest>
</services>
<webapp disabled="true">
</webapp>
<modules>
<disable-rule id="csharp.warnings"/>
<disable-rule id="c-warnings"/>
<disable-rule id="obj-c.warnings"/>
<basic-app disabled="true"/>
<c disabled="true"/>
<csharp disabled="true"/>
<jaxws-ri disabled="true"/>
<obj-c disabled="true"/>
<amf disabled="true"/>
<gwt disabled="true"/>
<jboss disabled="true"/>
<object-c disabled="true"/>
<rubby disabled="true"/>
<jaxws-client disabled="true"/>
<jersey disabled="false"/>
<docs title="ICMD API" docsDir="./" splashPackage="cmd.acmd_mdc_servlet" includeDefaultDownloads="true" includeExampleXml="false" disableRestMountpoint="true" copyright="copyright" forceExampleJson="true"/>
</modules>
答案 0 :(得分:2)
您的“包含模式”不正确。 “includes”指的是类,而不是 jars 。所以它可能看起来像:
<include pattern="com.mycompany.api.resources.**"/>
另外,在调用Enunciate时,请确保所有这些类都在类路径中。