Video – How to import a Visio model (or any other) into BPM 12c


Welcome to Red Maverick’s first video.

In this video, we’ll guide you on how to import an existing Visio BPMN model into Oracle BPM12c, using Process Composer.




ADF Listeners - Part II

ADF Application Event Listeners – Part II

Hi all,

In my previous post  ADF Application Event Listeners – Part I I have focused in some of the ADF applications event listeners that we can listen and how to do it. In this post I will show you some examples of data that you can get from those event listeners and in some cases rewrite it.


HTTP Session Events

After application session is created the sessionCreated method is triggered. From the HttpSessionEvent input parameter in the same method you are able to access data from these classes:

  • servlet.http.HttpSession
  • servlet.internal.session.MemorySessionData
  • servlet.internal.session.MemorySessionContext
  • servlet.internal.WebAppServletContext

For internal classes is not recommend to make any change on them, however, you are able to access it for your own purpose.

In order to get these previous classes you just need the following:

public void sessionCreated(HttpSessionEvent httpSessionEvent) {
   HttpSession httpSession = httpSessionEvent.getSession();   

   MemorySessionData msd = (MemorySessionData)httpSessionEvent.getSource();
   MemorySessionContext msc = (MemorySessionContext)msd.getContext();

   WebAppServletContext appServletContext = msd.getWebAppServletContext();


In the next table is presented the resume of what you may find.

Class Method Description
HttpSession getId() Returns de the unique identifier assigned to the created session.
getCreationDate() Returns the time when the session was created measured in milliseconds.
getMaxInactiveInterval() Returns the maximum time interval, in seconds that the servlet container will keep the session open between client accesses. If configured the value will be the same as configured in the property “Session Timeout” in the “web.xml” file.
getLastAccessedTime() Returns the last time the client sent a request associated with this session measured in milliseconds.
Invalidate() Invalidated this session then unbinds any objects bound to it.
MemorySessionData getConcurrentRequestCount() Returns the number of concurrent requests for the application.
MemorySessionContext getCurrOpenSessionsCount() Returns the number of concurrent open sessions for the application.
getPersistentStoreType() The scope type where the session data is stored. This value will be the same as configured in the property “Store Type” in the “weblogic-application.xml”.
getTotalOpenSessionsCount() Returns the number open sessions for the application.
getWebAppServletContext() Returns the class that retrieves the context of the current servlet of the application. We will see in further detail this class.

Servlet Context Listener

The Servlet Context is initiated during the first application access after deployment. For future accesses to the application the servlet context is reused interchangeably of the new sessions created.

After the servlet context is initialized the contextInitialized method is triggered. From the ServletContextEvent input parameter in the same method you are able to access data from these classes:

  • servlet.internal.WebAppServletContext
  • application.internal.ApplicationContextImpl
  • management.configuration.AppDeploymentMBean
  • servlet.internal.WebAppConfigManager
  • management.configuration.WebAppComponentMBeanImpl
  • management.runtime.ServletRuntimeMBean

For internal classes is not recommend to make any change on them, however, you are able to access it for your own purpose.

In order to get these previous classes you just need the following:

public void contextInitialized(ServletContextEvent servletContextEvent) {
   WebAppServletContext wasc = (WebAppServletContext)servletContextEvent.getSource();
   ApplicationContextImpl acimpl = (ApplicationContextImpl)wasc.getApplicationContext();
   AppDeploymentMBean appDeploymentMBean = acimpl.getAppDeploymentMBean();
   WebAppComponentMBeanImpl appComponentMBean = WebAppComponentMBeanImpl)wasc.getMBean();
   ServletRuntimeMBean[] srmb = wasc.getServletRuntimeMBeans();


In the next table is presented the resume of what you may find.

Class Method Description
WebAppServletContext getAppDisplayName() Application display name.
getMBean() Returns the WebAppComponentMBeanImpl class.
getServletRuntimeMBeans() Returns the ServletRuntimeMBean class.
getClasspath() Returns the path for all jars included in the application.
getDocroot() Returns the path for the WAR file of the application.
getMajorVersion() Returns the major version of the application.
getMinorVersion() Returns the minor version of the application.
getApplicationSecurityRealmName() Returns the security realm name of the user logged in.
getApplicationParameters() Application Configuration Parameters. This is further detailed next.
getAbsoluteSourcePath() The path of the application’s installation.
getServer() Returns the name of the server where the application is deployed in.
getServerInfo() Returns the server info where the application is deployed in. We will provide an example next.
ApplicationContextImpl getAuthRealmName() Returns the realm name of the user logged in.
getDefaultEncoding() Returns application’s default encoding.
getDispatchPolicy() The class of work executed in queues of the weblogic.
getMimeTypeDefault() Returns application’s mime type.
AppDeploymentMBean getSessionCookieName() Returns the internal name of the session’s cookie.
WebAppConfigManager getSessionJDBCConnectionTimeoutSecs() Returns in seconds the JDBC connection timeout.
getSessionPersistentStoreDir() In my tests I have found “session_db” value.
getSessionPersistentStoreTable() In my tests I have found “wl_servlet_sessions” value.
WebAppComponentMBeanImpl getSessionPersistentStoreType() In my tests I have found “memory” value.
getSessionTimeoutSecs() Returns in seconds the session time out.
ServletRuntimeMBean getName() Returns the name of the servlet.
getType() Returns the type of the servlet.


In the getServerInfo() method from the WebAppServletContext class you can find something like this:

“WebLogic Server Fri Apr 1 20:20:06 PDT 2011 1398638 Oracle WebLogic Server Module Dependencies 10.3 Thu Mar 3 14:37:52 PST 2011 Oracle WebLogic Server on JRockit Virtual Edition Module Dependencies 10.3 Thu Feb 3 16:30:47 EST 2011”


In the getApplicationParameters() method from the ApplicationContextImpl class you can find for example the following parameters:

Parameter Definition
“” The amount of time, in seconds, that the work manager accepts and schedules RMI calls until there are no more RMI requests arriving within the RMI grace period during a gracefulshutdown or a retirement.
“” Immediately places the application into Administration mode without waiting for current HTTP sessions to complete.
“” Indicates that a running application should switch to Administration mode and accept only Administration requests via a configured Administration channel. If this option is not specified, the running application is stopped and cannot accept Administration or client requests until is it restarted.


In the ServletRuntimeMBean class you can find for example the following servlets:

Name Type
JspServlet ServletRuntime
Faces Servlet ServletRuntime
FileServlet ServletRuntime
resources ServletRuntime
adw ServletRuntime
WebServiceServlet ServletRuntime
MapProxyServlet ServletRuntime
GatewayServlet ServletRuntime

Servlet Request Listener

The Servlet Request Listener is triggered whenever a new request is made to the server regarding the current application. For those cases the requestInitialized method is triggered with the ServletRequestEvent class as input parameter.

ServletRequestEvent and ServletContextEvent extend from the same java class “java.util.EventObject”. You will be able to find the same data as detailed for the “Servlet Context Listener”.

Phase Listeners

You can listen to all lifecycle phases. From the beforePhase and afterPhase methods you are able to access and manipulate data from these classes:

  • servlet.http.HttpServletRequest
  • servlet.http.HttpServletResponse

You can get these classes as detailed next:

public void beforePhase(PhaseEvent phaseEvent) {
   //You get the current phase for what the event has been triggered.        
   System.out.println("getPhaseId: " + phaseEvent.getPhaseId());
   FacesContext vFacesContext = phaseEvent.getFacesContext();    
   ExternalContext vExternalContext = vFacesContext.getExternalContext();
   HttpServletRequest vRequest = (HttpServletRequest)vExternalContext.getRequest());
   Map<String, Object[]> queryStringMap = vRequest.getParameterMap();
   HttpServletResponse vResponse = (HttpServletResponse)vExternalContext.getResponse();


Note: Don’t forget to set the getPhaseId method to trigger all or only the phases that you really want when you are creating your own custom Phase Listener.

public PhaseId getPhaseId() {
  return PhaseId.ANY_PHASE;


If you create a custom Filter you are able to manipulate the data from the request and response by setting the data from the servletRequest and servletResponse input parameters’ classes for the doFilter method.

In order to set the data from the servletRequest class do the following steps:

  1. Create a class that extends from “servlet.http.HttpServletRequestWrapper” class.CustomHttpServletRequestWrapper
  2. Override the methods you want to customize.CustomHttpServletRequestWrapper_OverideMethods
  3. Set the new class in the doFilter method.
    public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse,
                         FilterChain filterChain) throws, javax.servlet.ServletException{
       CustomHttpServletRequestWrapper requestWrapper = new CustomHttpServletRequestWrapper((HttpServletRequest)servletRequest);
       filterChain.doFilter(requestWrapper, servletResponse);


On the next post we’ll explore how to use these application events to get custom query string parameters and reinject them in new sessions after session’s time out.


Pedro Gabriel



Feature Image by Melvin Gaal