Adopt a School

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Friday, December 30, 2011

Redirecting to a URL from a action listener in ADF 11g

Very recently I was working on implementing OaAuth flow a typical standard these days to authenticate against various social media sties like facebook, twitter etc. using my ADF app. Typically, the first step in OaAuth flow is to call to a url passing some sort of consumer or app id which then in turns after authentication invokes a callback url from your application to do the next step.

As a result, I needed a way to invoke the url from adf command button actionListener after constructing the url containing user supplied consumerKey. So, here is how you can invoke the url after that:



    FacesContext fc = FacesContext.getCurrentInstance();
    String callbackUrl = "https://www.facebook.com/dialog/oauth?client_id=" + fbClientId.getValue().toString() + "&redirect_uri=http://mycallbackURL&scope=publish_stream";
    try
    {
      fc.getExternalContext().redirect(callbackUrl);
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }

So this is written in the actionListener and fbClientId is bound to a inputText on UI.


Thursday, August 4, 2011

Conclusion on Chris Muir's ADF Task Flow Behavior in 11g

Chris Muir wrote an excellent series on the behavior of adf task flows in conjunction with the transaction control options and am connection. You can find all from the last post available here 

For little impatient people who may not have enough time to go through all the 4 blog posts may read the key points here:


1. A Bounded Task flow knows to which AM to connect and establish which db connection only via page definition file bindings. So, a transaction wont be initiated or a 
db connection won't be created until some event is triggered on the page to access page definition bindings.

2. If "No Controller Transaction" option is chosen then creation of transaction are totally relied on BC4J. 

3. Chained calls of bounded task flows with no controller transaction option and other transaction options should not be mixed to avoid unpredictable results.

4. Calling a bounded task flow with option use existing transaction from another bounder task flow with option 'always create a new transaction' and both having different 
db connections will cause the caller db connection to be used in the called BTF as well. 

5. 11.1.2 onwards there is no automatic nesting of AM of the called BTF under calling BTF's AM. So prior to 11.1.2 this would have resulted into just 1 AM Pool but now all AMs would be treated as root AM and having their own pool (unless they are explicitly nested at design time). Needless to say they will still share the same transaction/connection (if called BTF has option used exiting transaction (or, if possible))

Tuesday, August 2, 2011

Forcing weblogic server to pick project defined libraries

While building a web application using external jars you may frequently hit issues of having multiple jars containing different versions of same class in the class path and thus unable to run your app. In case of weblogic server you can always force the server to pick classes from your included libraries instead of from other places.
To do it just put the following lines in the weblogic.xml


<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

In case weblogic.xml does not exist in your app then right click web project and click new. Go to deployment descriptors and choose weblogic.xml. This should generate a weblogic.xml file for you in case of jdeveloper.

Sunday, June 19, 2011

Changes to VO query edit in ADF 11g Jdeveloper 11.1.2

New jdev 11.1.1.2  VO query edit now shows test and explain instead of test. This is very nice and much more productive than earlier versions.