@@ -0,0 +1,2437 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.teradata.prestomanager.common;%0A%0Aimport org.glassfish.jersey.client.JerseyClient;%0A%0Aimport javax.ws.rs.client.Entity;%0Aimport javax.ws.rs.client.Invocation;%0Aimport javax.ws.rs.client.WebTarget;%0Aimport javax.ws.rs.core.MediaType;%0A%0Aimport java.net.URI;%0A%0Aimport static java.util.Objects.requireNonNull;%0Aimport static org.glassfish.jersey.client.JerseyClientBuilder.createClient;%0A%0Apublic class RequestBuilder%0A%7B%0A    private final URI path;%0A    private Entity body;%0A    private String headerName;%0A    private Object headerValue;%0A    private static JerseyClient jerseyClient = createClient();%0A%0A    private RequestBuilder(URI path) %7B%0A        this.path = path;%0A    %7D%0A%0A    public static RequestBuilder newRequestBuilder(URI path)%0A    %7B%0A        return new RequestBuilder(path);%0A    %7D%0A%0A    public RequestBuilder withBody(Entity body)%0A    %7B%0A        this.body = body;%0A        return this;%0A    %7D%0A%0A    public RequestBuilder withHeader(String headerName, Object headerValue)%0A    %7B%0A        this.headerName = headerName;%0A        this.headerValue = headerValue;%0A        return this;%0A    %7D%0A%0A    public Invocation buildGet()%0A    %7B%0A        return build().buildGet();%0A    %7D%0A%0A    public Invocation buildPut()%0A    %7B%0A        requireNonNull(body, %22body is null%22);%0A%0A        return build().buildPut(body);%0A    %7D%0A%0A    public Invocation buildPost()%0A    %7B%0A        requireNonNull(body, %22body is null%22);%0A%0A        return build().buildPost(body);%0A    %7D%0A%0A    public Invocation buildDelete()%0A    %7B%0A        return build().buildDelete();%0A    %7D%0A%0A    private Invocation.Builder build()%0A    %7B%0A        WebTarget webTarget = jerseyClient.target(path);%0A        Invocation.Builder invocationBuilder = webTarget.request(MediaType.TEXT_PLAIN);%0A        if (headerValue != null && headerName != null) %7B%0A            invocationBuilder.header(headerName, headerValue);%0A        %7D%0A        return invocationBuilder;%0A    %7D%0A%7D%0A

Add builder for http request