Skip to content

Oracle Webcenter External Applications Real Scenario Case – Part I

5 de July de 2011

Today I’ll talk about Webcenter integration with External Application. First of all, I
would like appreciate my friend Sami Koivu for the help that he give me.

When you’re thinking about integration with external applications using Webcenter there are this OOTB options:

  • WebClipping Portlet
  • Webcenter External Application
  • Webcenter Pagelet Producer
  • Portlets

It’s important bounce that this isn’t a official documentation about this options, it’s just my experiences trying using it in a real scenario.

The scenario that I’ll simulate here is:

I have a external application with this specifications:

  • Java Web application;
  • Tomcat as container Java;
  • The app login is based on Tomcat Realm;
  • Tomcat use cookies for keep the user session

This is a very common scenario since that many clients has Java Web Application with Apache Tomcat.

In the other way I has a Webcenter Portal application that need consume the pages of the application, working like a jsp:include, but always keeping my Portal Template. The final integration should be like a iFrame but without height and width fixed.

The portlets are very useful if for JSF / ADF applications. It’s can be used too if you pretend create some code to integrate the application. I’ll discard this option because my java web application is based only in JSP and Servlets, and I don’t need create integrations with code, I just want “show” my application in a Webcenter Page Template.  Anyway if you pretend use portlet, this documentation can help you:

http://download.oracle.com/docs/cd/B32110_01/webcenter.1013/b31074/jpsdg_java_intro.htm

First of all, we need think about my Web Application and login for it. The Java WebApp use Tomcat Realm based authentication. For make the Single Sign On between webcenter and tomcat I’ll create a class that intercepts the Tomcat Autenthicate request, get a header from HTTP Request and pass forward to tomcat autenthicate with a thread local, futher I’ll extend Realm Base class and make autenthication just using my headers. Here it’s a example:

public static ThreadLocal<String> loggedOnUser = new ThreadLocal<String>();

@Override

publicvoid invoke(Request req, Response resp) throws IOException, ServletException {

Principal princ = req.getPrincipal();

if (princ == null) {

          String username = req.getHeader(“someCustomHeader”);

               loggedOnUser.set(username);

}else {

   System.out.println(“:: No header ” );

    loggedOnUser.remove();

}

}

else {

System.out.println(“:: Already have a principal in request, do nothing.”);

}

getNext().invoke(req, resp);

}

 }

In second classe, I extend the RealmBase and change the authenticate method, I added this lines to my custom method:

String header = HeaderAuthValve.

loggedOnUser.get();

if (header != null) {

return getPrincipal(header, “password”);

}

From now we has your application using just a header to autenthicate . In a production scenario you should thinking about the security for this case.

Now we know that beyond show the application in Webcenter Template it’s necessary set some header in http request for the application. And now we can discard the default External Application from Webcenter, because there isn’t options to send http headers using this method.

So, let’s talk about WebClipping Portlet.

WebClipping is a Oracle PDK Portlet that came with Webcenter and it’s based on Oracle Portal experiences. On really the WebClipping remains from the Oracle Portal portlets.

The main objective for the WebClipping is “clip” some pages to your application, it’s work like a iFrame but isn’t a iframe. So you’ll can keep your template and webClipping is worried about keep this.

So let’s do the integration. To do this you’ll need a default Webcenter Portal Application (http://download.oracle.com/docs/cd/E17904_01/webcenter.1111/e10273/createapp.htm)

First of all we need register the WebClipping producer. When you install Webcenter you have the Webclipping in WC_Portlets Managed server.

  1. Open Application Resources from your project. Click with the right button in Connections – New Connection – Oracle PDK Java Producer;
  2. Choose some name for you producer;
  3. Fill URL Endpoint with something
    like that: <a href=”http://:8889/portalTools/webClipping/”>http://<port&gt;:8889/portalTools/webClipping/
  4. Mark Enable Producer Sessions
  5. Finish;
  6. Open the home.jspx page
  7. Drang and drop Web Clipping Portlet to cust:panelCustomizable
  8. Select ADF Rich Portlet
  9. Run the portal
  10. Log in with a admin user. The default user is weblogic, pass: weblogic1
  11. Press CTRL + SHIFT + E to go in the Edit Mode
  12. Click in icon
  13. Insert the location from your application and click “start”
  14. Click Select
  15. Now you’ll come back to the original WebClipping configuring screen
  16. Change URL Rewriting to “inline”. With this option when you navigate in your clipped application you’ll continue in the same “page” that WebClipping Portlet is inserted, works like a iframe, but without a frame.
  17. Click Ok.
  18. Now you have your application Clipped.
  19. After do this, probably you’ll get some problemns. The main problemn is that WebClipping doesn’t keep the cookies from the user session. There’s a Enhancement Request in Metalink (Bug 3532654, Bug 7147665, Note 315805.1), if you’re reading this in a future that there isn’t this problemn, I’m happy for you! Please tell me in comments that you’re in this future =D

So, in this step, you can try connect WebClipping and a WebCenter External Application, this is a option. But this will solve just the problemn in the first time that you open the page with webClipping, don’t forgot that WebClipping doesn’t keep the user cookies. Maybe in some scenario using this two (WebClipping +
WebCenter External Application) solve the problem.

This is the first part of this topic. I’ll continue soon int part II. See ya.

3 Comments
  1. Kaon permalink

    Thanks for sharing. Looking forward to part 2~

  2. Hi,

    I want to ask something. I already followed your steps for creating web clipping, and it works. But it seems the web clipping can be accessed if i do log in first in the web center. Is there any configurations or something so i can access web clipping without doing log in?

    Thanks,
    Taufix

    • nmaia permalink

      Sorry by delay.

      Did you already solved? You cannot see the portlet before login? Did you try change configurations in jazn-data?

Leave a comment