in src/main/java/org/apache/sling/maven/bundlesupport/fsresource/FsMountHelper.java [211:233]
private void removeConfiguration(final URI consoleTargetUrl, final String pid) throws MojoExecutionException {
final URI postUrl = consoleTargetUrl.resolve("configMgr/" + pid);
final HttpPost post = new HttpPost(postUrl);
List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("apply", "true"));
params.add(new BasicNameValuePair("delete", "true"));
post.setEntity(new UrlEncodedFormEntity(params));
try {
JsonObject expectedJsonResponse =
Json.createObjectBuilder().add("status", true).build();
// https://github.com/apache/felix-dev/blob/6603d69977f4cea8b9b9dd2faf5d320906b43368/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigManager.java#L145
httpClient.execute(
post,
new ResponseCodeEnforcingResponseHandler(
"application/json",
response -> JsonSupport.parseObject(response).equals(expectedJsonResponse),
HttpStatus.SC_OK));
} catch (IOException ex) {
throw new MojoExecutionException(
"Removing configuration at " + postUrl + " failed, cause: " + ex.getMessage(), ex);
}
}