http.setPath(path);
public ApplicationServerManagerResult reload(String appPath) throws IOException { try { // reload.setQueryString(buildPathQueryArgs(appPath)); // This is the only way to get changes made to web.xml to // be picked up, reload DOES NOT reload the web.xml stop(appPath); Thread.sleep(1500); return start(appPath); } catch (InterruptedException e) { return parseResult("FAIL - "+e.toString()); } finally { stop.releaseConnection(); stop.setPath(stopPath); start.releaseConnection(); start.setPath(startPath); } }
@Override public Document getDocument(Document document, DocumentFactory factory) throws IOException { HttpMethod request = new GetMethod(baseURL); request.addRequestHeader("Authorization", String.format("Bearer %s", bearerToken)); //TODO request.setPath(path + document.getId()); int status = client.executeMethod(request); if(status == 200) { JsonNode json = mapper.readValue(request.getResponseBody(), JsonNode.class); for(FieldDescriptor descriptor : factory.listFields()) { try { Object value = getValue(json, descriptor); if(value != null) { document.setValue(descriptor, value); } else LOG.warn("No data found for id {}", document.getId()); } catch (IOException e) { LOG.warn("Cannot use data for id {}: {}", document.getId(), e.getMessage()); } } return document; } else throw new IOException(request.getStatusText()); }
public ApplicationServerManagerResult undeploy(String appPath) throws IOException { try { undeploy.setQueryString(buildPathQueryArgs(appPath)); client.executeMethod(undeploy); return parseResult(undeploy.getResponseBodyAsString()); } finally { undeploy.releaseConnection(); undeploy.setPath(undeployPath); } }
/** * Prepares a Method object. */ void setupMethod(final HttpMethod method) throws FileSystemException, URIException { String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(urlCharset); method.setPath(pathEncoded); method.setFollowRedirects(true); method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS"); }
public ApplicationServerManagerResult start(String appPath) throws IOException { try { start.setQueryString(buildPathQueryArgs(appPath)); client.executeMethod(start); return parseResult(start.getResponseBodyAsString()); } finally { start.releaseConnection(); start.setPath(startPath); } }
public ApplicationServerManagerResult stop(String appPath) throws IOException { try { stop.setQueryString(buildPathQueryArgs(appPath)); client.executeMethod(stop); return parseResult(stop.getResponseBodyAsString()); } finally { stop.releaseConnection(); stop.setPath(stopPath); } }
public void verifyTarget(TransferTarget target) throws TransferException { HttpMethod verifyRequest = getPostMethod(); try { HostConfiguration hostConfig = getHostConfig(target); HttpState httpState = getHttpState(target); verifyRequest.setPath(target.getEndpointPath() + "/test"); try { int response = httpClient.executeMethod(hostConfig, verifyRequest, httpState); checkResponseStatus("verifyTarget", response, verifyRequest); } catch (RuntimeException e) { throw e; } catch (Exception e) { String error = "Failed to execute HTTP request to target"; log.debug(error, e); throw new TransferException(MSG_HTTP_REQUEST_FAILED, new Object[]{"verifyTraget", target.toString(), e.toString()}, e); } } finally { verifyRequest.releaseConnection(); } }
public void verifyTarget(TransferTarget target) throws TransferException { HttpMethod verifyRequest = getPostMethod(); try { HostConfiguration hostConfig = getHostConfig(target); HttpState httpState = getHttpState(target); verifyRequest.setPath(target.getEndpointPath() + "/test"); try { int response = httpClient.executeMethod(hostConfig, verifyRequest, httpState); checkResponseStatus("verifyTarget", response, verifyRequest); } catch (RuntimeException e) { throw e; } catch (Exception e) { String error = "Failed to execute HTTP request to target"; log.debug(error, e); throw new TransferException(MSG_HTTP_REQUEST_FAILED, new Object[]{"verifyTraget", target.toString(), e.toString()}, e); } } finally { verifyRequest.releaseConnection(); } }
HttpState httpState = getHttpState(target); abortRequest.setPath(target.getEndpointPath() + "/abort");
HttpState httpState = getHttpState(target); prepareRequest.setPath(target.getEndpointPath() + "/prepare");
HttpState httpState = getHttpState(target); abortRequest.setPath(target.getEndpointPath() + "/abort");
HttpState httpState = getHttpState(target); commitRequest.setPath(target.getEndpointPath() + "/commit");
HttpState httpState = getHttpState(target); prepareRequest.setPath(target.getEndpointPath() + "/prepare");
/** * Prepares a HttpMethod object. * * @param method The object which gets prepared to access the file object. * @throws FileSystemException if an error occurs. * @throws URIException if path cannot be represented. * @since 2.0 (was package) */ protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException { final String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset()); method.setPath(pathEncoded); method.setFollowRedirects(this.getFollowRedirect()); method.setRequestHeader("User-Agent", this.getUserAgent()); }
/** * Prepares a HttpMethod object. * * @param method The object which gets prepared to access the file object. * @throws FileSystemException if an error occurs. * @throws URIException if path cannot be represented. * @since 2.0 (was package) */ protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException { final String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset()); method.setPath(pathEncoded); method.setFollowRedirects(this.getFollowRedirect()); method.setRequestHeader("User-Agent", this.getUserAgent()); }
/** * Prepares a HttpMethod object. * * @param method The object which gets prepared to access the file object. * @throws FileSystemException if an error occurs. * @throws URIException if path cannot be represented. * @since 2.0 (was package) */ protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException { final String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset()); method.setPath(pathEncoded); method.setFollowRedirects(this.getFollowRedirect()); method.setRequestHeader("User-Agent", this.getUserAgent()); }
/** * Prepares a Method object. * * @param method the HttpMethod. * @throws FileSystemException if an error occurs encoding the uri. * @throws URIException if the URI is in error. */ @Override protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException { final String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset()); method.setPath(pathEncoded); method.setFollowRedirects(this.getFollowRedirect()); method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS"); method.addRequestHeader("Cache-control", "no-cache"); method.addRequestHeader("Cache-store", "no-store"); method.addRequestHeader("Pragma", "no-cache"); method.addRequestHeader("Expires", "0"); }
/** * Prepares a Method object. * * @param method the HttpMethod. * @throws FileSystemException if an error occurs encoding the uri. * @throws URIException if the URI is in error. */ @Override protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException { final String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset()); method.setPath(pathEncoded); method.setFollowRedirects(this.getFollowRedirect()); method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS"); method.addRequestHeader("Cache-control", "no-cache"); method.addRequestHeader("Cache-store", "no-store"); method.addRequestHeader("Pragma", "no-cache"); method.addRequestHeader("Expires", "0"); }
/** * Prepares a Method object. * * @param method the HttpMethod. * @throws FileSystemException if an error occurs encoding the uri. * @throws URIException if the URI is in error. */ @Override protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException { final String pathEncoded = ((URLFileName) getName()).getPathQueryEncoded(this.getUrlCharset()); method.setPath(pathEncoded); method.setFollowRedirects(this.getFollowRedirect()); method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS"); method.addRequestHeader("Cache-control", "no-cache"); method.addRequestHeader("Cache-store", "no-store"); method.addRequestHeader("Pragma", "no-cache"); method.addRequestHeader("Expires", "0"); }