HippoCMS Restcall content relative link problem

317 views
Skip to first unread message

jin lin

unread,
Jul 29, 2013, 10:16:43 AM7/29/13
to hippo-c...@googlegroups.com
I have already add the rest support (link)of my website.  the CMS and my website are under different domain. when I used restcall to pull the contents like html code "<a href="/abc">  the contents will automatically convert to <a href ="site/rest/abc">     site is for hippo site and rest is for rest call mount point.
so  obvious the relative path does not support if we use rest call to pull contents from cms to other websites.
I am just wondering that is there anyway to keep same relative url after rest call and instead using absolute path. 

Jasper Floor

unread,
Jul 30, 2013, 7:24:23 AM7/30/13
to hippo-c...@googlegroups.com
HI,

perhaps this is what you want:

(not the same link as what you gave)

mvg,
Jasper

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
Most Hippo developers are active here and/or follow the Stackoverflow [hippo-cms] tag.
 
The old Nabble archive can be found here: http://hippo.2275632.n2.nabble.com/Hippo-CMS-7-f2274273.html
 
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/groups/opt_out.
 
 

Bert Leunis

unread,
Jul 30, 2013, 10:03:27 AM7/30/13
to hippo-c...@googlegroups.com
Hi,

Did you use HST to create the links for you? HST provides the correct links you want, never concatenate links your self. Read [1] for instructions and background of this topic.

You are using a Content Aware Rest pipeline. Then HST link rewriting is supported.




With kind regards/Met vriendelijke groet,
Bert Leunis

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


On Mon, Jul 29, 2013 at 4:16 PM, jin lin <bboyj...@gmail.com> wrote:

Maryse Morin

unread,
Jul 30, 2013, 10:16:11 AM7/30/13
to hippo-c...@googlegroups.com

Please remove all email addresses @alogient.com from your mailing list.

Thanks you!

Bas van Leeuwen

unread,
Jul 30, 2013, 10:46:57 AM7/30/13
to hippo-c...@googlegroups.com
I've removed the two registered members.

Regards,
Bas van Leeuwen

jin lin

unread,
Jul 30, 2013, 2:15:07 PM7/30/13
to hippo-c...@googlegroups.com
i

jin lin

unread,
Jul 30, 2013, 2:17:24 PM7/30/13
to hippo-c...@googlegroups.com
Hi I read the link. But how can I put the HST Link inside the CMS documents.   is it for sites?

Thanks.

On Tuesday, July 30, 2013 10:03:27 AM UTC-4, b.leunis wrote:

Bert Leunis

unread,
Jul 30, 2013, 2:27:26 PM7/30/13
to hippo-c...@googlegroups.com
On Tue, Jul 30, 2013 at 8:17 PM, jin lin <bboyj...@gmail.com> wrote:
Hi I read the link. But how can I put the HST Link inside the CMS documents.   is it for sites?
Yes, you use HST to create channels in which you make your content available. The CMS is just a big box of documents. How they are available is up to you. In 99% of the cases you use HST to create a channel. In your case a REST api.

jin lin

unread,
Jul 30, 2013, 2:47:16 PM7/30/13
to hippo-c...@googlegroups.com
Thanks for the reply, but I still don't get it.    Let's say I put  <a href="/abc" ></a> inside the CMS documents.     and this will convert to <a href ="site/rest/abc"></a> after the rest call.     I read the URL you have posted. 
<hst:link var="abc" path="/abc"/>
 <a href="${abc}"></a>
but this is automatically gone because the htmlcleaner inside the CMS documents. 
I do not quite understand how it works.

Ard Schrijvers

unread,
Jul 30, 2013, 6:10:09 PM7/30/13
to hippo-c...@googlegroups.com
Hello Jin Lin,

On Tue, Jul 30, 2013 at 8:47 PM, jin lin <bboyj...@gmail.com> wrote:
> Thanks for the reply, but I still don't get it. Let's say I put <a
> href="/abc" ></a> inside the CMS documents. and this will convert to <a
> href ="site/rest/abc"></a> after the rest call. I read the URL you have
> posted.
> <hst:link var="abc" path="/abc"/>
> <a href="${abc}"></a>
> but this is automatically gone because the htmlcleaner inside the CMS
> documents.
> I do not quite understand how it works.

I'll try to give some general concepts explanation. I think our
documentation is not quite good enough at this moment for general
architectural overview kind of explanations : I am working on this the
coming months every now and then. I will cover rest concepts as well.
I only have started with [1] at this moment which is not about REST or
the HST yet. More will follow.

Any way, in a nutshell :

Hippo CMS is document oriented, not page oriented. This means, in the
CMS when editing documents, you are not creating pages. You might not
even know as an editor where you document ends up as a url...also, it
can be exposed in multiple channels (site, rest, rss). Thus obviously,
since the same document can be exposed in multiple channels (and
multiple environments, for example test, acct, prod all having
different host names and urls), a document in the cms can never have a
'URL'. Also, internal links to other documents are not URLs : They are
just references. So, documents are just plain content, with links to
internal or external documents (the external links are already fully
qualified urls of course)

that is in a very small nutshell the CMS document part.

Now, we have the HST, which is a delivery tier framework, which is
normally used to build sites, rest apis, rss, pdf, etc. The HST is a
framework as it calls the code you write. In the sense, Hippo Site
Toolkit is a confusing name. Hippo Site Framework would be more
accurate. Any way, the HST from birds eye view has two parts:

1) Request matching phase [2] : To which channel should some url
resolve and to which sitemap item
2) Request processing phase [3] : Which component tree to render in
case of normal site generation, or, in case of REST apis, which JAX-RS
endpoint to process [4,5,6].

Now, the HST use the matching phase to map a incoming URL to some
sitemapitem (in case of REST api you can do without a sitemap). The
HST *knows* how to rewrite internal documents links to real URLs. You
can do this by using the <hst:link hippobean="${mybean}"> tag and
inject a hippoBean in it (HippoBean is actually a lightweight wrapper
around a jcr document). The HST will then general a link for that
bean. Rewriting all links in some html blob is done with <hst:html>
tag. Any way, this is all quite site related.

However, you can expose the very same content also over a different
channel than a site, for example over a REST api. You then have to
create a mount or sitemapitem that delegates to either plain rest
pipeline or content rest pipeline. In the rest representations, you
can use the HstLinkCreator. This one will create correct links for jcr
nodes that you expose over REST.

I know the above is a way too short explanation, but it is kind of
difficult to explain the entire cms 7 concept and hst in one mail :).
I can only give you some examples of rest apis you can look at. See
[7]. for this one, svn co the 1.04.xx and start it up locally. On the
site homepage you can see in the content some links to REST endpoints.
The gogreen demo also has examples for it. If you want, I can check
out tomorrow the gogreen code and where to find the examples, that
might help...

Last thing about hst linkrewriting : We normally develop locally on
localhost and deploy the site always as site.war. This means, the
context path is always /site. In production, we normally also deploy
as site,war. Then however we have httpd in front that injects the
/site part of the url, so visitors of course don't see the /site part.
To make sure that in that case the hst does not generate links
containing /site, we set in the repository at /hst:hst/hst:hosts the
boolean 'hst:showcontextpath' to false.

more about hst links can be found at [8,9]

Regards Ard ... hope this already helps a bit

[1] http://www.onehippo.com/en/resources/blogs/2013/07/hippo-cms-a-birds-eye-architectural-tour.html
[2] http://www.onehippo.org/7_8/library/concepts/request-handling/hst-2-request-matching.html
[3] http://www.onehippo.org/7_8/library/concepts/request-handling/hst-2-request-processing.html
[4] http://www.onehippo.org/7_8/library/concepts/rest/restful-jax-rs-component-support-in-hst-2.html
[5] http://www.onehippo.org/7_8/library/concepts/rest/restful-api-support---content-context-aware-jax-rs-services.html
[6] http://www.onehippo.org/7_8/library/concepts/rest/restful-api-support---plain-jax-rs-services.html
[7] http://svn.onehippo.org/repos/hippo/hippo-cms7/testsuite/branches/hippo-testsuite-1.04.xx/components/src/main/java/org/hippoecm/hst/demo/jaxrs/

[8] http://www.onehippo.org/7_8/library/concepts/links-and-urls/hst-2-urls.html
[9] http://www.onehippo.org/7_8/library/concepts/links-and-urls/context-aware-canonical-preferred-and-navigationstateful-urls.html
Boston - 1 Broadway, Cambridge, MA 02142

jin lin

unread,
Aug 7, 2013, 12:00:12 PM8/7/13
to hippo-c...@googlegroups.com
Hi,   Thanks for explanation.  That helps a lot about the understanding. However,  I still fixed this problem,
since we are not going to use the hippo website.  we can use HST Link to rewrite the link.  Instead, I use the Jax-RS Restful service,
disable the context-path would make url without the site. but the restful mount point still existed. how to take it off?  is there any configure allow me to do it?

Jin

Ard Schrijvers

unread,
Aug 7, 2013, 12:57:16 PM8/7/13
to hippo-c...@googlegroups.com

If you configure the rest mount to be the hst:root mount then you should be fine. Since you do not have a site you can replace the hst:root with the rest mount. Please let me know if this answers your question.

Regards Ard

Op 7 aug. 2013 18:00 schreef "jin lin" <bboyj...@gmail.com> het volgende:
Reply all
Reply to author
Forward
0 new messages