Friday, September 26, 2008

How does URL sent to Web Listener reach OC4J?

An OC4J instance is a process running externally to Apache. The user’s entry point to an OC4J is, as for all Oracle Application Server components, a URL sent to an Apache web listener.
A typical httpd.conf file will include a line such as this

include "c:\oracle\ias9i\Apache\Apache\conf\mod_oc4j.conf"

which points to the file that configures the module modoc4j. The following is a simple version of this file:
LoadModule oc4j_module modules/ApacheModuleOc4j.dll
<IfModule mod_oc4j.c>
Oc4jMount /j2ee/* Oc4jMount /hrj demo
</IfModule>
This file first specifies the dynamic link library that is the modoc4j code and then creates two virtual paths with the Oc4jMount directive. This is a token that takes two values: the first is a virtual path; the second is the name of an OC4J instance to which to send URLs with that virtual path.
So if the Apache instance receives this URL
http://hostname.com:7777/hrj/helloworld?name=barani

Apache will pass it through to an OC4J instance called demo, which will load and run the Java class helloworld using the value barani for the argument name.The first Oc4jMount directive only has a single value: the virtual path /j2ee/*.All URLs that include this path will be dispatched to the default OC4J instance, which is known as the home instance.

There are various communications protocols used in the OC4J application environment.First, end users’ browsers use HTTP to send URLs to the Apache web listener.These requests are routed to modoc4j within the Apache executable, and then modoc4j uses AJP1.3 (Apache Jserv Protocol version 1.3) to send the request on to the appropriate OC4J instance. The OC4J instance will load and run the requested Java class, which is probably a servlet. The servlet may then use RMI to contact a Java bean, which could again be running in a different OC4J instance on a different machine. Then the bean might use Oracle Net to contact a database and LDAP to contact an OID.

No comments:

Post a Comment