Hide template reference

In this post I will describe how one can you pass template reference without using request parameter. The default profile of Mobile Form takes all the parameters like template reference, data reference etc through HTTP request parameter. If Mobile Form is deployed to serve the forms on internet then you might not like to expose such URLs on public forums. That is probably because it would expose the internal repository structure to the end user.
With the default profile, a form url would like http://<lcserver>:<port>/lc/content/xfaforms/profiles/test.html?contentRoot=repository:///Applications/FormSubmission/1.0&template=SimpleForm.xdp. This link contains the template reference present in your LC repository which you might not like to expose. In this post, I will cover how you can create a new profile to cope up with this problem.

Creating a new Mobile Form profile is very similar to creating a new resource and resource renderer i.e. to create a sling script and a jcr content node if required. I created a sample application package. You can install  the package using http://<lcserver>:<port>/lc/crx/packmgr/index.jsp UI.

Now go to http://<lcserver>:<port>/lc/crx/de page (CRXDE Lite).  Browse the content node and you would notice nodes like following:

profile1

 

A sling:folder node form, then nt:unstructured node leave and template. Mobile Form rendition service, an OSGi service reponsible for generating html5 snippet for the xdp, can also take input from a template child node of the profile node which is leave in this case. If you select profile node leave in crxde lite, you notice the properties of this node like the following:

 

 

profile3

 

You would notice one of the properties on the profile node is sling:resourceSuperType which is xfaforms/profile in this case. This is the property that makes any node Mobile Form profile node. This suggests sling to pass on the http requests to this node via profile renderer scripts which is profile jsp in Mobile Form context.

Mobile Form profile jsp page usually takes input from the request parameter but that is not the only way to pass parameters. For example to pass template info to profile jsp, you can create a child node named template in profile node hierarchy and specify template reference like the following:

profile2

 

Using the child template node you can hide the template information from URL of the form. The new URL would be  http://<lcserver>:<port>/lc/content/forms/leave.html without any refresh to the template location.

 

5 Responses to Hide template reference

  1. Darren says:

    Hi Raga – thanks for this example. It is a useful piece of information. I have a question around dynamically changing the node properties at runtime. If you have a JSP that dynamically changes the contentRoot and name properties, then redirect the user to the profile page rendering the different form in the different location.
    Could you run into concurrency issues doing this? Would there be a better way to use one profile and modify these node properties at runtime so they are still hidden from the user but maintain concurrency?

  2. Pingback: Hide parameters from Mobile Form URL

Leave a Reply

Your email address will not be published. Required fields are marked *


5 + four =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>