Delete and Import folder with content as xml in Hippo using Java.

114 views
Skip to first unread message

ganesh raju

unread,
Oct 13, 2014, 5:07:47 AM10/13/14
to hippo-c...@googlegroups.com
Hi All,

I am very new to hippo, i have one requirement i have to write Rest based service in java to delete and import folder content as XML.
could you plz help me out.



thanks
ganesh

Jasper Floor

unread,
Oct 13, 2014, 7:12:53 AM10/13/14
to hippo-c...@googlegroups.com

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

ganesh raju

unread,
Oct 13, 2014, 8:53:15 AM10/13/14
to hippo-c...@googlegroups.com
Hi Jasper,

thanks for your quick reply.
i am using  ( RESTFUL API SUPPORT - CONTENT CONTEXT AWARE JAX-RS SERVICES ) is it proper one ?

where can i specify (file) below details ?

<sv:node sv:name="restapi">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hst:mount</sv:value>
  </sv:property>
  <sv:property sv:name="hst:alias" sv:type="String">
    <sv:value>restapi</sv:value>
  </sv:property>
  <sv:property sv:name="hst:isSite" sv:type="Boolean">
    <sv:value>false</sv:value>
  </sv:property>
  <sv:property sv:name="hst:namedpipeline" sv:type="String">
    <sv:value>JaxrsRestContentPipeline</sv:value>
  </sv:property>
</sv:node>

Jasper Floor

unread,
Oct 13, 2014, 11:03:10 AM10/13/14
to hippo-c...@googlegroups.com
Hi,

it depends on your usecase, but it should work. I would suggest running through the basic hippo tutorials to get a feel of how Hippo works.

ganesh raju

unread,
Oct 14, 2014, 9:25:14 AM10/14/14
to hippo-c...@googlegroups.com
Dear Jasper,

thanks for your reply.

i have gone through some basic tutorials of HIPPO.

Below bean configuration do i need to set in spring.xml ? and how i can do that ?

could you please me know your comments on  configuration part.



 
  <!-- The following three imports will include pipeline configurations for both JaxrsRestPlainPipeline and JaxrsRestContentPipeline !!! -->
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-jackson.xml" />
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-plain-pipeline.xml" />
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-content-pipeline.xml" />
 
  <!-- Your custom JAX-RS REST Plain Resource Providers will be added into the following list !!! -->
  <!-- The following sourceList is not used for Content/Context Aware JAX-RS Services, but used for Plain JAX-RS Services. -->
  <bean id="customRestPlainResourceProviders" class="org.springframework.beans.factory.config.ListFactoryBean">
    <property name="sourceList">
      <list>
      </list>
    </property>
  </bean>

On Monday, 13 October 2014 20:33:10 UTC+5:30, Jasper Floor wrote:
Hi,

it depends on your usecase, but it should work. I would suggest running through the basic hippo tutorials to get a feel of how Hippo works.
On Mon, Oct 13, 2014 at 2:53 PM, ganesh raju <ganeshr...@gmail.com> wrote:
Hi Jasper,

thanks for your quick reply.
i am using  ( RESTFUL API SUPPORT - CONTENT CONTEXT AWARE JAX-RS SERVICES ) is it proper one ?

where can i specify (file) below details ?

<sv:node sv:name="restapi">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hst:mount</sv:value>
  </sv:property>
  <sv:property sv:name="hst:alias" sv:type="String">
    <sv:value>restapi</sv:value>
  </sv:property>
  <sv:property sv:name="hst:isSite" sv:type="Boolean">
    <<code style="font-variant:inherit;font-stretch:inheri
...

ganesh raju

unread,
Oct 14, 2014, 9:58:18 AM10/14/14
to hippo-c...@googlegroups.com
Dear Jasper,

i am getting below ERROR, could you please help.

[][]org.hippoecm.hst.jaxrs.services.content.AbstractContentResource.[] - Failed to retrieve content bean. java.lang.NullPointerException
2014-10-14 19:24:34.104 ERROR [qtp66192343-19][][WebApplicationException]com.art.webapp.hippo.cms.rest.HippoContentRest.getHippoHtmlRepresentation[22] - java.lang.NullPointerException

Jasper Floor

unread,
Oct 14, 2014, 10:48:39 AM10/14/14
to hippo-c...@googlegroups.com
Hi,

the configuration should go into a directory project/hst/src/main/resources/META-INF/hst-assembly/overrides/configuration.xml.

All I can say about that error is that it can't find the content bean. Perhaps you can set a breakpoint and figure out exactly what is being asked for and where exactly it is failing.

--

ganesh raju

unread,
Oct 15, 2014, 7:54:52 AM10/15/14
to hippo-c...@googlegroups.com
Dear Jasper,

do to delete and update folders in Hippo, i have to create bean. this beans represent as nodes in CMS ?
i want to know how i can create node as bean, could please let me know how to do this.

1) i have created one rest like below

@Path("/myhippoproject:testdoc/")
public class HippoContentRest extends AbstractContentResource  {
@RolesAllowed(value={"everybody"})
    @GET
    @Path("/")
    public HippoHtmlRepresentation getHippoHtmlRepresentation(
                      @Context HttpServletRequest servletRequest,
                      @Context HttpServletResponse servletResponse) throws ObjectBeanManagerException {
HstRequestContext requestContext = getRequestContext(servletRequest);
ContentRewriter contentRewriter = getContentRewriter();
getRequestContentBean(requestContext);
//HstRequestContext requestContext = RequestContextProvider
// HstRequestContext
return super.getHippoHtmlRepresentation(servletRequest, null, null);
    }

}


My hippo structure you can i find in attachment. how i can create content beans from that.
could you please let me know.


On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:
nodes.png

Jasper Floor

unread,
Oct 15, 2014, 8:37:18 AM10/15/14
to hippo-c...@googlegroups.com
Hi,

a bean in this case is the jvm representation of a document. You have to create those in your java code  and they have to be linked to a node type in your cnd. If you are looking to create a document then you don't need to get the request content bean as there won't be one.

mvg,
Jasper

--

ganesh raju

unread,
Oct 15, 2014, 9:00:14 AM10/15/14
to hippo-c...@googlegroups.com
Dear Jasper,

there is one folder system, this i want to delete through REST api.

could you please let me know what is the right way to do ?


On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:

ganesh raju

unread,
Oct 15, 2014, 9:54:13 AM10/15/14
to hippo-c...@googlegroups.com
Hi Jasper,

could please help i have gone through hippo tutorials, may be i am not understanding things properly.

i really got stuck how to delete and add new folder (Ex: like uploaded image 'system')


 me what are the steps i have to do ?

do i need to add any spring related dependencies also ? 

i have done following things 

1) i have added pom.xml entries
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.1_spec</artifactId>
<version>1.0.1</version>
<!-- NOTE: You should use 'provided' instead of 'compile' when your application 
container provides javax.annotation.security package. -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.onehippo.cms7.hst.components</groupId>
<artifactId>hst-jaxrs</artifactId>
<version>2.26.01</version>
</dependency>

2) i have added  custom-jaxrs-resources.xml

3) i have create one Rest api


On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:

ganesh raju

unread,
Oct 16, 2014, 8:56:18 AM10/16/14
to hippo-c...@googlegroups.com
Hi Jasper,

could you please let me know what is mount and how can i configure ?

sorry if i irritated you.

thanks 
ganesh


On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:

Jasper Floor

unread,
Oct 16, 2014, 9:40:53 AM10/16/14
to hippo-c...@googlegroups.com
Hi,

you haven't irritated me. If I don't answer it's because I'm busy with other things. Please don't worry about that.

I'm not really sure exactly what it is you are asking now. You can take a look at the feeds project (https://forge.onehippo.org/gf/project/feeds/). This uses a rest pipeline, though for generating output.

So is it that you are reaching your rest service but don't know what to do from there?

Why do you want to delete/create via REST? Perhaps it is the right way for you or perhaps we can suggest another route. For now I understand you want to be able to manipulate the cms through REST. This is certainly possible.

this page
http://www.onehippo.org/library/concepts/rest/restful-jax-rs-component-support-in-hst-2.html

has some code which sort of outlines what you want. I'm not sure what to add to what is there already. Also take a look at the resource links at the bottom.


mvg,
Jasper


--

ganesh raju

unread,
Oct 16, 2014, 10:48:48 AM10/16/14
to hippo-c...@googlegroups.com
Thanks Jasper,


In my project jetty sever it's not identifying custom-jaxrs-resources.xml file, we have multiple modules of hippo.
inside content module i have created folder structure like META-INFO/hst-assembly/overrides/
please see the attachment for more info about modules.

but it is identifying hippoecm-extension.xml. 

the following content i added in that.

<?xml version="1.0" encoding="UTF-8"?>
       xsi:schemaLocation="http://www.springframework.org/schema/beans
 
 
  <!-- The following three imports will include pipeline configurations for
       both JaxrsRestPlainPipeline and JaxrsRestContentPipeline !!! -->
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs
                    /SpringComponentManager-rest-jackson.xml" />
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs
                    /SpringComponentManager-rest-plain-pipeline.xml" />
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs
                    /SpringComponentManager-rest-content-pipeline.xml" />
 
  <!-- Your custom JAX-RS REST Plain Resource Providers will be added into
       the following list !!! -->
  <bean id="customRestPlainResourceProviders"
        class="org.springframework.beans.factory.config.ListFactoryBean">
    <property name="sourceList">
      <list>
          <bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider">
          <constructor-arg>
            <bean class="com.art.webapp.hippo.cms.rest.HippoContentRest" />
          </constructor-arg>
        </bean>
      </list>
    </property>
  </bean>
 
  <!-- Your custom JAX-RS REST Content/Context Aware Resource Providers
       will be added into the following list !!! -->
  <bean id="customRestContentResourceProviders"
        class="org.springframework.beans.factory.config.ListFactoryBean">
    <property name="sourceList">
      <list>
           <bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider">
          <constructor-arg>
            <bean class="com.art.webapp.hippo.cms.rest.HippoContentRest" />
          </constructor-arg>
        </bean>
      </list>
    </property>
  </bean>
 
</beans>


On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:
hippo-modules.png

marijan milicevic

unread,
Oct 16, 2014, 10:56:35 AM10/16/14
to hippo-c...@googlegroups.com
Hi,

your file contains customRestContentResourceProviders node twice,
override folder should go into your site module and not in the content module, where it is located currently, 

hth
cheers
marijan

--

ganesh raju

unread,
Oct 17, 2014, 6:31:40 AM10/17/14
to hippo-c...@googlegroups.com

hi marijan milicevic ,

I don't have site module, i am having below modules.
but all modules contains site folder.
dio i need to create site module ?

1) addon
2) cms
3) common
4) content
5) parent

thanks 
ganesh

On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:

marijan milicevic

unread,
Oct 17, 2014, 7:26:16 AM10/17/14
to hippo-c...@googlegroups.com
Hi,

On Fri, Oct 17, 2014 at 12:31 PM, ganesh raju <ganeshr...@gmail.com> wrote:

hi marijan milicevic ,

I don't have site module, i am having below modules.
but all modules contains site folder.
dio i need to create site module ?


once you run hippo archetype [1] it creates site, bootstrap and site and essentials module. I have no idea how you created your project and why is it missing...

cheers
marijan 




1) addon
2) cms
3) common
4) content
5) parent

thanks 
ganesh

On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:
Hi All,

I am very new to hippo, i have one requirement i have to write Rest based service in java to delete and import folder content as XML.
could you plz help me out.



thanks
ganesh

--

marijan milicevic

unread,
Oct 17, 2014, 7:36:19 AM10/17/14
to hippo-c...@googlegroups.com
On Fri, Oct 17, 2014 at 1:26 PM, marijan milicevic <m.mil...@onehippo.com> wrote:
Hi,

On Fri, Oct 17, 2014 at 12:31 PM, ganesh raju <ganeshr...@gmail.com> wrote:

hi marijan milicevic ,

I don't have site module, i am having below modules.
but all modules contains site folder.
dio i need to create site module ?


once you run hippo archetype [1] it creates site, bootstrap and site and essentials module. I have no idea how you created your project and why is it missing...


this: "and site and essentials" should be "cms and essentials"
cheers
marijan

ganesh raju

unread,
Oct 17, 2014, 8:58:36 AM10/17/14
to hippo-c...@googlegroups.com
Hi all,

i have created components module based on hippo-go-green as below.
i have created custom-jaxrs-resources.xml file, but some how jetty server is not reading, could you please help em out.

ganesh
On Monday, 13 October 2014 14:37:47 UTC+5:30, ganesh raju wrote:

Bas van Leeuwen

unread,
Oct 20, 2014, 5:35:07 AM10/20/14
to hippo-c...@googlegroups.com
Dear Ganesh,

It appears that your questions and needs go beyond simple Q&A style help. I'd advise you to contact Hippo's sa...@onehippo.com team to see if Hippo can help you with intensive training and/or some consultancy for your project.

Regards,
Bas

Bas van Leeuwen | Community Manager | Hippo

b.vanl...@onehippo.com - Hippo
Amsterdam - Oosteinde 11, 1017 WT  Amsterdam
Boston - 101 Main Street, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

--
Reply all
Reply to author
Forward
0 new messages