public void deploy()

in src/main/java/org/apache/sling/maven/bundlesupport/deploy/method/SlingPostDeployMethod.java [43:61]


    public void deploy(URI targetURL, File file, String bundleSymbolicName, DeployContext context) throws IOException {
        /* truncate off trailing slash as this has special behaviorisms in
         * the SlingPostServlet around created node name conventions */
        targetURL = stripTrailingSlash(targetURL);
        
        // append pseudo path after root URL to not get redirected for nothing
        final HttpPost filePost = new HttpPost(targetURL);

        /* Request JSON response from Sling instead of standard HTML, to
         * reduce the payload size (if the PostServlet supports it). */
        filePost.setHeader("Accept", JSON_MIME_TYPE);
        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
        builder.addTextBody("*@TypeHint", "nt:file");
        builder.addBinaryBody("*", file, ContentType.create(context.getMimeType()), file.getName());
        filePost.setEntity(builder.build());
        
        String response = context.getHttpClient().execute(filePost, new BasicHttpClientResponseHandler());
        context.getLog().debug("Received response: " + response);
    }