我正在關注鏈接 https://access.redhat.com/documentation/en-US/OpenShift_Enterprise/2/pdf/REST_API_Guide/OpenShift_Enterprise-2-REST_API_Guide-en-US.pdf 來構建我的rest api Java應用程序,該應用程序將從Web位置將WAR二進制文件部署到我的帳戶中。openshift,休息apis二進制部署
我正在
InboundJaxrsResponse {上下文= ClientResponse {方法= POST,URI = https://openshift.redhat.com/broker/rest/application/# {myAppID} /部署中,狀態= 422,原因=無法處理的實體}}作爲響應:
其中# {} myAppID是應用程序的UUID,我在這裏更換爲安全
我使用GlassFish的REST API和我的一段代碼:
String url_of_war = "https://code.google.com/p/web-actions/downloads/detail?name=helloworld.war";
WebTarget webtarget;
Client client
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String arg0, SSLSession arg1) {
return true;
}
};
client = ClientBuilder.newBuilder().sslContext(trustAllCertificates()).hostnameVerifier(hostnameVerifier).build();
}
URIBuilder uriBuilder = new URIBuilder();
try {
uriBuilder = uriBuilder.setScheme("https").setHost("openshift.redhat.com/broker/rest/").setPath("application/#{myAppId}/deployments");
if (getPort() > 0) {
uriBuilder = uriBuilder.setPort(getPort());
}
URI uri = uriBuilder.build();
webtarget = client.target(uri);
} catch (Exception e) {
String msg = "Could not build URI!";
throw new RuntimeException(msg, e);
}
Invocation.Builder invocationBuilder = webtarget.request(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON_TYPE);
invocationBuilder.header("Authorization", "Basic "+Base64.encodeBase64String("#{myuser}:#{mypass}".getBytes()));
Form form = new Form();
form.param("hot_deploy", "false");
form.param("force_clean_build", "false");
form.param("artifact_url", URLEncoder.encode(url_of_war, "UTF-8"));
Response response = invocationBuilder.post(Entity.form(form));
我在這裏做錯了什麼,我在這30天內沒有線索在線,我也試圖創建openshift/jboss兼容的部署文件夾,我放置了戰爭文件,並提供下載作爲copmressed .tar.gz文件,但同樣的問題 您的幫助是高度讚賞。 謝謝
糾正,我使用的戰爭網址是:String url_of_war =「https://web-actions.googlecode.com/files/helloworld.war」; – user2778633