new document's url generation

38 views
Skip to first unread message

Lev Merenkov

unread,
Jan 26, 2015, 11:01:25 AM1/26/15
to hippo-c...@googlegroups.com
Hello,

let me describe the small problem we faced with.
When you are entering the name of the new document, the future url of this document is formed by Hippo automatically (you may see it in the line under the name of document you are entering). Hippo removes some symbols not allowed in urls (e.g. "#" symbol), converts symbols in lower case and does some other transformations.
Our customer wants additional functionality of this feature. They want also underscores and dots ("_" and ".") to be replaced by hyphens ("-") during new document creation or renaming.
In other words, document name like " test.test_test" should turn into url like "test-test-test".

Could you suggest any way of reaching this?
Thank you in advance!


Best regards,
Lev
 

Tobias Jeger

unread,
Jan 26, 2015, 11:17:21 AM1/26/15
to hippo-c...@googlegroups.com
Hi Lev,

The CMS configuration /hippo:configuration/hippo:frontend/cms/cms-services/settingsService/codecs
suggests that the StringCodec org.hippoecm.repository.api.StringCodecFactory$UriEncoding is used for this.

HTH

Tobi


--
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.



--
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

Lev Merenkov

unread,
Jan 27, 2015, 4:23:08 AM1/27/15
to hippo-c...@googlegroups.com
Hi Tobi,

thank you for your response!
I have just investigated the usages of class org.hippoecm.repository.api.StringCodecFactory$UriEncoding. Seems like it is explicitly instantiated in many places of Hippo code so it's not possible to create some custom realisation of this class. Generally saying, we are not allowed to fork Hippo classes at all by our conventions.

Do you have any other suggestions how could we reach the goal or maybe you could advice any more convenient use of StringCodecFactory$UriEncoding then forking?

Olivier Bourgeois

unread,
Jan 27, 2015, 4:39:11 AM1/27/15
to hippo-c...@googlegroups.com
Hi Lev,

   maybe you can leverage the fact that StringCodedFactory have been recently extended to support different locales:

So if you have this in your CMS version you can register an encoder for your specific replacements.

Best regards,
Olivier.

--

Lev Merenkov

unread,
Jan 27, 2015, 5:55:14 AM1/27/15
to hippo-c...@googlegroups.com
Hi Olivier,

thank you for your suggestion!

In our cms version I see only the following method: public StringCodec getStringCodec(String encoding)  Can it serve our needs from your perspective?

To be honest, it still be not clear enough for me how it's possible to register our own codec and how to make Hippo uses right this codec during the document creation.

Will be looking forward for your advices!


Best regards,
Lev

Olivier Bourgeois

unread,
Jan 27, 2015, 6:29:30 AM1/27/15
to hippo-c...@googlegroups.com
Hi Lev,

  then I am afraid you are using an older version of Hippo that doesn't have the feature yet. Maybe you can bump the repository dependency to >= 2.24.15 in the main POM?

   About how to register and use it, the best is probably to look at the test, following the links in the JIRA ticket:


It's quite straightforward: the locale is anything you want and is registered through a Map that is handed to the StringCodecFactory as constructor parameter.

Best regards,
Olivier.

--
Reply all
Reply to author
Forward
0 new messages