Get context root or URL of ADF / Webcenter application

Hi,

I have requirement to get the context root in javascript on page load.Not on any event.If you need on java you can try my previous solution like get the current viewId or url in ADF using ControllerContext. Following solution will work in any application

Try this

window.location.protocol = “http:” // gives you protocol
window.location.host = “techartifact.com”
window.location.pathname = “blogs/2015/08/building-taskflow-for-reuse.html”

var pathArray = window.location.pathname.split(‘/’);
var secondLevelLocation = pathArray[1]; // this will give you the context root of application

Similarly you can get the current page number or param etc in javascript.

Similarly if you need this context root on some button event you can try like passing it using a af:clientAttribute and EL as *#{facesContext.externalContext.request.contextPath}*

<af:document id=”d1”>
<af:resource type="javascript">
        function onLoad(evt){
            var path=evt.getSource().getProperty("pagePath");
            window.location.replace(path);// here we were trying a redirect , just an example
        }
        </af:resource>
        <af:clientListener method="onLoad" type="load"/>
        <af:clientAttribute name="pagePath"
                            value="#{facesContext.externalContext.request.contextPath}/faces/<pagePath>"/>
….
</af:document>

 

Happy coding in techartifact

Building ADF Taskflow for reuse

Hi All,

If you making taskflow for reuse either as jar or in portal and so on.Always make sure one property that Library Internal
This property makes an entry in task-flow-registry.xml and enable/disable taskflow to reuse.

Library Internal: This property controls the visibility of a task flow when packaged in an ADF library.
This helps developers to expose only those task flows that are indented for reuse.

taskflowProperties

if you check this property you will have task-flow-registry.xml as below

<?xml version = '1.0' encoding = 'UTF-8'?>
<task-flow-registry xmlns="http://xmlns.oracle.com/adf/controller/rc">
 <task-flow-descriptor path="../../main/public_html/WEB-INF/testTaskFlow.xml" id="" type="" uses-page-fragments="false" library-internal="true" remote-invocable="false" train="false"/>
</task-flow-registry>

 

So always make sure you never check this property if you want to reuse.Or if you have parent taskflow and 5 sub taskflow which is called by parent taskflow then you can have 5 sub taskflow as
internal library but parent should be as internal library false.

Happy reusing with Vinay in techartifact

Deploy ADF application as shared library in weblogic

Shared library – WebLogic Shared Library is an Enterprise Application Archive, a stand-alone EJB, a Web Application module, or a JAR file that is registered with Oracle WebLogic Server as a shared library. The library resources can be shared between multiple applications, alleviating the need to have duplicate copies of the resources in each application. For an example, we can all dependency as shared libraries in weblogic.

Normally in bigger application, best practice is to use common features application or dependency as shared library in weblogic. For example, taking an webcenter portal application
we are making custom taskflow and using it in webcenter portal application. We can deploy these adf taskflow as shared libraries and can reference in weblogic.xml for Portal application.

We have two option.
– Deploy adf app as jar and then deploy as shared library or wrap jar into war profile and deploy as shared library.
– We can directly deploy adf application as war shared lib in Weblogic.

Following is the process for ADF/ Webcenter Application in jdeveloper

1) Create deployment profile as war file.
2) Create an MANIFEST.MF file as META-INF/MANIFEST.MF

Manifest-Version: 1.0
Implementation-Title: ADF_Shared_Lib
Implementation-Version: 1.0
Specification-Title: ADF_Shared_Lib
Specification-Version: 1.0
Extension-Name: ADF_Shared_Lib

3) Edit war deployment profile and add MANIFEST.MF in war options.

555

4) Deploy ADF taskflow to weblogic(assuming you have made connection with weblogic in jdeveloper) to specific managed server or admin server.
5) mark option as deploy as shared library instead of application.

11

222

444

6) In master (Portal) application enter reference of your shared library as follows

ADF_Shared_Lib 1.0
1.0
true

This way you can directly deploy from the jdeveloper. Other options is to deploy as war file and find war file from specified location and go to weblogic admin console
and install as shared library

11111

Note: If you deploying shared library again, make sure, you increase implementation version every time to specify version no.

Video –

Troubleshoot :

IOException: ‘Invalid header field; with manifest
Solution – Make sure name is name is correct. There is proper spacing after colon in manifest file content.

Unresolved WebApp library references defined in weblogic.xml
Solution- Make sure you have same implementation version and specification version of shared library, If there is mismatch you will get this error.

Till then happy deployment in Weblogic with Vinay…..