Enable ADF Logger in Jdeveloper

Performt the following  steps to add the ADFLogger in your JDeveloper.

 1. Click on the Actions Tab in the Log windows which appears in the Editor. Select the option – Configure Oracle Diagnostic Logging

2. Expand the Root Logger

3. Click on the + icon to add the java classes which you need to include in the loggers. Select Add persistent loggers

4. Click on the Search Icon and select the com -> <YOUR_PACKAGE> folder from the available java classes. Click OK.

5. Select the Logger level as INFO.

6. Right Click on the Project –-> Project Properties -> Run/Debug/Profile.

7. Select the Default Configuration “Default” and click on Edit.

8. Add the value   -Djbo.debugoutput=adflogger in the java options. Click Ok

9. Perform the same steps for the Project to add the AppModule java file.

10. Run the application from login.jsp

11. The logs will be added in the logger placed at the below path. Please check for your local path accordingly.

 


Oracle ADF Framebusting in Web Application

Oracle ADF provides the oracle.adf.view.rich.security.FRAME_BUSTING context parameter to implement the Framebusting in the web application.

When a malicious site tries to retrieve the content of a page from another domain into a frame and allows hyperlinks or buttons (partial content of the original page) and performs action, it is known as clickjacking. Framebusting helps the web application to prevent from clickjacking

If you want to consume your ADF application in a frame, set the below given configuration in the web.xml of the web application.

<context-param>
<param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
<param-value>never</param-value>
</context-param>

The apache server might require the commenting of the X-Frame-Options: sameorigin. The current apache server will show the below settings

HTTP/1.1 200 OK

Server: Apache

Cache-Control: no-cache

Pragma: no-cache

X-Powered-By: JSF/1.2

X-Frame-Options: sameorigin

Content-Type: text/html;charset=UTF-8

Transfer-Encoding: chunked

Connection: Keep-Alive


Oracle ADF redirection to login page on session expiry exception by invoking the web Filter in web.xml

Make the following entries in the web.xml in the <filter> tag

<filter>

<filter-name>SessionExpiryFilter</filter-name>

<filter-class> com.test.session. InvokeSessionExpiryFilter </filter-class>

<init-param>

<param-name>RedirectWhenSessionTimeout</param-name>

<param-value>login.jspx</param-value>

</init-param>

</filter>

Create a new java class – InvokeSessionExpiryFilter

package com.test.session;

import java.io.IOException;

import javax.faces.context.ExternalContext;

import javax.faces.context.FacesContext;

import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

public class InvokeSessionExpiryFilter implements Filter {

private FilterConfig _filterConfig = null;

public void init(FilterConfig filterConfig) throws ServletException {

_filterConfig = filterConfig;

}

public void destroy() {

_filterConfig = null;

}

public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain) throws IOException,

ServletException {

boolean bypass = true;

String URL = ((HttpServletRequest)request).getRequestURL().toString();

HttpServletRequest httpRequest = null;

HttpSession session = null;

try {

httpRequest = (HttpServletRequest)request;

session = httpRequest.getSession();

if (session.getAttribute(“loginName”) == null) {

session.invalidate();

bypass = false;

} else {

bypass = true;

}

}

} catch (NullPointerException e) {

// RESET THE BYPASS FLAG TO FALSE IF LOGIN NAME IS NULL

bypass = false  ;

//  e.printStackTrace();

}catch (Exception e) {

// RESET THE BYPASS FLAG TO FALSE IF LOGIN NAME IS NULL

//  e.printStackTrace();

bypass = false  ;

}


Clustered Environment mapping in Oracle ADF

In the Web logic Server Clustered Environment for ADF, add the corresponding mapping in the ADF application so that the application can be accessed in case of any server failure. Following entries in the adf-config.xml and Weblogic.xml will be required to be updated.

Weblogic-application.xml: The file will be placed in the Application Resource tab -> META_INF folder. Open the XML file and add the below given tag in the file before the end tag </weblogic-application>

<session-descriptor>

<persistent-store-type>replicated_if_clustered</persistent-store-type>

</session-descriptor>

adf-config.xml: The file will be placed in the Application Resource tab -> ADF META-INF folder. Open the XML file and add the below given tag in the file before the end tag </adf-config>

<adf-controller-config xmlns=”http://xmlns.oracle.com/adf/controller/config”>

<adf-scope-ha-support>true</adf-scope-ha-support>

</adf-controller-config>


Creating business Components in ADF 11g

Perform the below given steps for creating the Business Components in JDeveloper 11g using ADF 11g
1) Create a new Application by selecting File > New > General > Applications > Application

2)  From the available application template list, select Fusion Web Application (ADF), Click OK

3)  Name the Application as testComponentApp.

4)  The Application should be selected with ADF Model Project and ADF View Controller Project.

5)  Right –Click on Model Project and select New > General > Connections > Database  

     Connection

Provide the Database Connection details as mentioned below:

  • Connection Name: testDBConn
  • Connection Type ( JDBC/ MySQL / Oracle Lite)
  • User Name
  • Password
  • Driver: Thin Driver / oci8
  • Host Name
  • SID / Service Name
  • JDBC Port

6)      Test the Connection. If it returns ‘SUCCESS’, the connection is established successfully.

7)      Right –Click on Model Project and select New >Business Tier > Business Components from Tables.

8)     Select the Connection – testDBConn

9)     Select the Schema from the list of available schemas fetched from Oracle Database.

10)  Enter the Filter expression in the Name Filter field to minimize the Database table search.

11)  Click on QUERY button to execute the filter on the database table.

12)  Select the table from the Available Table List and click on > icon to move it to the selected table list.

13)  Click Next.

14)  The list of available columns in the table will be shown. Move the columns to the selected column list.

15)  Click Next

16)  List of Business Component for the table selected will be shown. Click next.

17)  Click Finish.

18)  The Wizard will create the Entity Object which will be placed in the model package of the Model Project.