---
title: "Integrating DocuVieware in your Java client application"
canonical_url: "https://www.nutrient.io/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-java-client-application/"
md_url: "https://www.nutrient.io/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-java-client-application.md"
last_updated: "2026-05-23T00:08:18.055Z"
description: "Integrate the DocuVieware control into your Java client application with setup and implementation steps."
---

# Integrating DocuVieware in your Java client application

> This guide focuses on integrating the DocuVieware control into a client application. Follow the [serving DocuVieware through a REST API](https://www.nutrient.io/guides/docuvieware/other-technologies/serving-docuvieware-through-a-rest-api.md) guide.

> Find the source code for both the REST service and integration examples in your `[INSTALL FOLDER]\Samples\ASP.NET\DocuVieware` folder.

## Prerequisite

DocuVieware only requires its own JavaScript and CSS files from your `[SDK INSTALL DIR]\Redist\DocuVieware (Resources)` folder. In the following examples, it’s assumed that they’re available locally.

```html

<script src="docuvieware-min.js"></script>
<link rel="stylesheet" type="text/css" href="docuvieware-min.css">

```

The last thing required is the complete and accurate URL your REST service is reachable at.

For this guide, it’s assumed that the service is locally running on the machine using port `62968`. The complete URL to the method is:

```text

http://localhost:62968/api/DocuViewareREST/GetDocuViewareControl

```

Your own implementation will mostly differ — especially the port that's usually randomly selected upon project creation by Visual Studio. Adapt the URL to your configuration.

## Integration using Java

There are various ways to access a REST service using Java. In this code sample, Apache HttpClient and JSON-java libraries are used, but other alternatives exist.

```java

/**
 * This project is built with the following libraries:
 * - JSONS-java : https://stleary.github.io/JSON-java/
 * - Apache HttpClient : http://hc.apache.org/httpclient-3.x/
 */
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
/**
 * @author ORPALIS
 */
public class Rest_consume {
 public static final int HTTP_OK = 200;

 public static void main() {
 try {
 DefaultHttpClient httpClient = new DefaultHttpClient();
 HttpPost postRequest = new HttpPost("http://localhost:62968/api/DocuViewareREST/GetDocuViewareControl");
 StringEntity data = new StringEntity(getDocuViewareConfiguration());
 data.setContentType("application/json");
 postRequest.setEntity(data);
 HttpResponse response = httpClient.execute(postRequest);
 if (response.getStatusLine().getStatusCode()!= HTTP_OK) {
 throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
 }
 JSONObject output = new JSONObject(EntityUtils.toString(response.getEntity(), "UTF-8"));
 String html = output.getString("HtmlContent");
 System.out.println(html);
 httpClient.getConnectionManager().shutdown();
 } catch (Exception ex) {
 Logger.getLogger(Rest_consume.class.getName()).log(Level.SEVERE, null, ex);
 }
 }

 public static String getDocuViewareConfiguration() {
 try {
 JSONObject docuViewareConfig = new JSONObject();
 docuViewareConfig.put("SessionId", "mySessionId"); //Set to an arbitrary value, should be replaced by the session identifier from your session mechanism
 docuViewareConfig.put("ControlId", "DocuVieware1");
 docuViewareConfig.put("AllowPrint", true);
 docuViewareConfig.put("EnablePrintButton", true);
 docuViewareConfig.put("AllowUpload", true);
 docuViewareConfig.put("EnableFileUploadButton", true);
 docuViewareConfig.put("CollapsedSnapIn", true);
 docuViewareConfig.put("ShowAnnotationsSnapIn", true);
 docuViewareConfig.put("EnableRotateButtons", true);
 docuViewareConfig.put("EnableZoomButtons", true);
 docuViewareConfig.put("EnablePageViewButtons", true);
 docuViewareConfig.put("EnableMultipleThumbnailSelection", true);
 docuViewareConfig.put("EnableMouseModeButtons", true);
 docuViewareConfig.put("EnableFormFieldsEdition", true);
 docuViewareConfig.put("EnableTwainAcquisitionButton", true);
 return docuViewareConfig.toString();
 } catch (Exception ex) {
 Logger.getLogger(Rest_consume.class.getName()).log(Level.SEVERE, null, ex);
 }
 return null;
 }
}

```

## Related guides

- [Serving DocuVieware through a REST API](https://www.nutrient.io/guides/docuvieware/other-technologies/serving-docuvieware-through-a-rest-api.md)

- [Client/server coming and going with custom actions](https://www.nutrient.io/guides/docuvieware/other-technologies/rest-client-server-coming-and-going-with-custom-actions.md)

- [Use and handling of the selection area](https://www.nutrient.io/guides/docuvieware/other-technologies/rest-use-and-handling-of-the-selection-area.md)

- [Custom snap-in implementation](https://www.nutrient.io/guides/docuvieware/other-technologies/rest-custom-snap-in-implementation.md)
---

## Related pages

- [DocuVieware guide for Blazor](/guides/docuvieware/other-technologies/docuvieware-tutorial-for-blazor.md)
- [Introduction](/guides/docuvieware/other-technologies.md)
- [How to set up and use DocuVieware with React](/guides/docuvieware/other-technologies/how-to-set-up-and-use-docuvieware-with-react.md)
- [Integrating DocuVieware in your Angular2 client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-angular2-client-application.md)
- [Integrating DocuVieware in your ASP.NET Core MVC Razor client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-asp-dotnet-core-mvc-razor-client-application.md)
- [Integrating DocuVieware in your AngularJS client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-angularjs-client-application.md)
- [Integrating DocuVieware in your JavaScript/jQuery client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-javascript-jquery-client-application.md)
- [Integrating DocuVieware into SharePoint 2019](/guides/docuvieware/other-technologies/integrating-docuvieware-into-sharepoint-2019.md)
- [Integrating DocuVieware in your PHP client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-php-client-application.md)
- [Integrating DocuVieware in your ASP.NET MVC Razor client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-asp-dotnet-mvc-razor-client-application.md)
- [Integrating DocuVieware in your Node.js client application](/guides/docuvieware/other-technologies/integrating-docuvieware-in-your-nodejs-client-application.md)
- [Custom snap-in implementation](/guides/docuvieware/other-technologies/rest-custom-snap-in-implementation.md)
- [Integrating DocuVieware with Electron](/guides/docuvieware/other-technologies/integrating-docuvieware-with-electron.md)
- [Client/server coming and going with custom actions](/guides/docuvieware/other-technologies/rest-client-server-coming-and-going-with-custom-actions.md)
- [Use and handling of the selection area](/guides/docuvieware/other-technologies/rest-use-and-handling-of-the-selection-area.md)
- [Serving DocuVieware through a REST API](/guides/docuvieware/other-technologies/serving-docuvieware-through-a-rest-api.md)
- [Your first Angular 10 application with DocuVieware](/guides/docuvieware/other-technologies/your-first-angular-10-application-with-docuvieware.md)

