# Storing or uploading a asset (pdf,png) files using java into cms

**URL:** <https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [September 8, 2020, 3:56am UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091 "2020-09-08T03:56:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjireddyavula](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anjireddyavula](https://community.bloomreach.com/u/anjireddyavula)\
**Post date:** [September 8, 2020, 3:56am UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091/1 "2020-09-08T03:56:37Z")

</div>

As per my requirement i want to store a pdf or png format documents into the CMS using java. can you please guide me how to proceed further.

---

<div class="post-metadata">

**Author:** ![dynamit-dave](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dynamit-dave/32/754_2.png) [@dynamit-dave](https://community.bloomreach.com/u/dynamit-dave)\
**Post date:** [September 15, 2020, 1:13pm UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091/2 "2020-09-15T13:13:52Z")

</div>

Have you taken a look at the [Hippo Content Export / Import](https://bloomreach-forge.github.io/content-export-import/) tool? We’ve used it in the past on a few different solutions and found that it is helpful

---

<div class="post-metadata">

**Author:** ![anjireddyavula](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anjireddyavula](https://community.bloomreach.com/u/anjireddyavula)\
**Post date:** [September 15, 2020, 1:28pm UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091/3 "2020-09-15T13:28:03Z")

</div>

Thanks for your reply. we checked that one but i didn’t found any java related example there. they are provided groovy script only.

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [September 15, 2020, 1:42pm UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091/4 "2020-09-15T13:42:58Z")

</div>

Hi,

Groovy code can be easily convertible to Java code as Groovy allows most Java style code plus their own shortcuts.  
And, the built-in REST Service [1] is actually a Java implementation similarly to what you’re seeing in the groovy examples. See [2] and the other Java sources.

Woonsan

[1] [https://bloomreach-forge.github.io/content-export-import/builtin-rest-services.html](https://bloomreach-forge.github.io/content-export-import/builtin-rest-services.html)  
[2] [https://github.com/bloomreach-forge/content-export-import/blob/develop/repository-jaxrs/src/main/java/org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java](https://github.com/bloomreach-forge/content-export-import/blob/develop/repository-jaxrs/src/main/java/org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java)

---

<div class="post-metadata">

**Author:** ![anjireddyavula](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anjireddyavula](https://community.bloomreach.com/u/anjireddyavula)\
**Post date:** [September 21, 2020, 7:05am UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091/5 "2020-09-21T07:05:39Z")

</div>

Thanks Woonsanko for your inputs.

If possible can you please provide the example how to invoke the above EximImportService.java using java component. I already understand the code but here problem is invoking the service using testing method. I’m unable to create content node structure for the pdf docuemnt (The asset is take as HippoBean as primary type , I’m facing difficult for creating the content node for pdf via java). If possible please provide the test class for import and export service using java.

Thanks and have a nice day.  
Anji

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [September 21, 2020, 1:50pm UTC](https://community.bloomreach.com/t/storing-or-uploading-a-asset-pdf-png-files-using-java-into-cms/2091/6 "2020-09-21T13:50:30Z")

</div>

> [@anjireddyavula](#):
>
> If possible can you please provide the example how to invoke the above EximImportService.java using java component. I already understand the code but here problem is invoking the service using testing method. I’m unable to create content node structure for the pdf docuemnt (The asset is take as HippoBean as primary type , I’m facing difficult for creating the content node for pdf via java). If possible please provide the test class for import and export service using java.

As it is a JAX-RS service, I don’t think it’s proper to use it in a groovy updater script directly.  
Perhaps you can ask for some help from our professional consulting services about how to convert the groovy example to a java module to fulfill your use cases.

Woonsan
