private void deployArtifact(BuildArtifact buildArtifact, SRunningBuild build, String baseContext, TomcatManager tomcatManager, TomcatStagingDeploy stagingDeploy) throws TomcatManagerException, IOException { assert build.getBranch() != null; File artifact = new File(build.getArtifactsDirectory(), buildArtifact.getRelativePath()); String path = baseContext + "/" + build.getBranch().getName(); String tomcatBasePath = UrlUtils.extractBaseUrl(tomcatManager.getURL()); stagingDeploy.setWebPath(tomcatBasePath + path); TomcatManagerResponse response = tomcatManager.deploy(path, artifact, true, path, artifact.length()); if (HttpStatus.SC_OK != response.getStatusCode()) { throw new TomcatManagerException(response.getReasonPhrase()); } }