我正在尝试通过rest api在guvnor中创建资产。但是该资产在 guvnor 中的其他资产下被创建为 txt。我怎样才能使其成为规则资产或模型资产。下面是我的代码
Client client = ClientBuilder.newClient();
client.register(HttpAuthenticationFeature.basic("admin", "admin"));
client.register(MultiPartFeature.class);
final MultiPart multipart = new FormDataMultiPart();
File file = new File("C:\\assetfile.xml");
multipart.bodyPart(new FormDataBodyPart("asset",file,MediaType.APPLICATION_XML_TYPE));
final Response response = client.target("http://localhost:8080/guvnor-5.5.0.Final-tomcat-6.0/rest/packages/samplePackage/assets")
.request()
.post(Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA_TYPE));
System.out.println(response.readEntity(String.class));
client.close();
我的 xml 文件是
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<asset>
<author>admin</author>
<description/>
<metadata>
<checkInComment/>
<disabled>false</disabled>
<format>brl<format>
<versionNumber>1</versionNumber>
</metadata>
<sourceLink>
http://localhost:8080/guvnor-5.5.0.Final-tomcat-6.0/rest/packages/samplePackage/assets/location1234/source
</sourceLink>
<title>location1234</title>
</asset>