X

Blogs about Deep Learning, Machine Learning, AI, NLP, Security, Oracle Traffic Director,Oracle iPlanet WebServer

  • October 24, 2008

Understanding Oralce iPlanet/Sun Java System Web Server 7.0 - for developers


Here are things a developer working on Oracle Iplanet Web Server 7.0 or writing a NSAPI plugin should know  

The latest Oracle iPlanet Web Server(formerly known as Sun Java System Web Server) 7.0 latest update download location : http://www.oracle.com/technetwork/java/webtier/downloads/index.html

The latest Sun Java System Web Server 7.0 update 9 documentation : http://download.oracle.com/docs/cd/E18958_01/index.htm

Bookmark NSAPI configuration guide :
http://docs.sun.com/app/docs/doc/820-4843
and Administrator's Configuration File
Reference http://docs.sun.com/app/docs/doc/820-4841 (which has
interfaces)

Some examples on how to write a plugin for Oracle iPlanet Web Server 7.0

<ws-install-dir>/samples/nsapi has some examples about how to write a custom plugin.



Let me start by explaining the basics of our Web Server first in this blog 

To add your own .so dynamic library 

In magnus.conf configuration file we can load our own .so's  as shown below :

#cat magnus.conf

Init fn="load-modules" shlib="libj2eeplugin.so"

Different request and response processing stages in Oralce iPlanet Web Server 7.0

In Sun Java System Web Server 7.0 there are different stages AuthTrans, NameTrans, PathCheck, ObjectType, Service, Output, Input, Error as given in obj.conf.  More info in
http://docs.sun.com/app/docs/doc/820-4841/abvag?a=view . We can even make
own function that can be executed in a different stages and add it here
in this file.

cat obj.conf
...
<Object name="default">
AuthTrans fn="match-browser" browser="\*MSIE\*"
ssl-unclean-shutdown="true"

NameTrans fn="ntrans-j2ee" name="j2ee"
NameTrans fn="pfx2dir" from="/mc-icons"
dir="/opt/ws/lib/icons"
name="es-internal"

PathCheck fn="uri-clean"
PathCheck fn="check-acl" acl="default"
PathCheck fn="find-pathinfo"
PathCheck fn="find-index-j2ee"
PathCheck fn="find-index"
index-names="index.html,home.html,index.jsp"

ObjectType fn="type-j2ee"
ObjectType fn="type-by-extension"
ObjectType fn="force-type" type="text/plain"
Service method="(GET|HEAD)" type="magnus-internal/directory"
fn="index-common"

Service method="(GET|HEAD|POST)" type="\*~magnus-internal/\*"
fn="send-file"

Service method="TRACE" fn="service-trace"
Error fn="error-j2ee"
AddLog fn="flex-log"
</Object>

<Object name="j2ee">
Service fn="service-j2ee" method="\*"
</Object>

...
<Object name="compress-on-demand">
Output fn="insert-filter" filter="http-compression"
</Object>

Filters

In Web Server we can insert filters like NSPR I/O layer. Filters enable
functions to intercept and possibly
modify data sent to and from the server. More info is in :
http://docs.sun.com/app/docs/doc/820-4843/abvek?a=view . There are two
types of filters Input and Output.

Some important Structures in Oracle iPlanet Web Server 7.0

Sun Java System Web Server 7.0 has Request
structure
http://docs.sun.com/app/docs/doc/820-4843/abvmz?l=en&a=view . It has 4 pblock s which stores data in key and
value pairs. More information is given in http://docs.sun.com/app/docs/doc/820-4843/abvmv?l=en&a=view

typedef struct{
\*/Server working variables \*/
pblock \*vars;
/\* The method, URI, and protocol revision of this request \*/
pblock \*reqpb;
/\* Protocol specific headers \*/
int loadhdrs;
pblock \*headers;
/\* Server's response headers \*/
int senthdrs;
pblock \*srvhdrs;
/\* The object set constructed to fulfill this request \*/
httpd_objset \*os;
} Request;

We can print these pblocks by INTpblock_pblock2str(rq-><pblockname>, NULL);. All request
headers will be parsed and put into headers pblock. Response
headers will be put into srvhdrs pblock.

Memory Management

Every
request has its own memory pool which gets freed automatically. So we
should call MALLOC , FREE, STRDUP etc. rather than malloc, free, and
strdup.

Join the discussion

Comments ( 2 )
  • Baskar Friday, March 11, 2011

    Meena,

    Could you please explain what are AuthTrans, NameTrans, PathCheck, ObjectType, Service, Output, Input, Error in obj.conf ?

    Also, explain their functionalities.

    Thanks,

    Baskar


  • Meena Friday, March 11, 2011

    What is it you are trying to achieve. You can ask questions in forum

    http://forums.oracle.com/forums/forum.jspa?forumID=863

    Its is in NSAPI Programmers guide :

    http://download.oracle.com/docs/cd/E19146-01/821-1833/index.html

    After the client sends its request to a server, it is helpful to define a set of logical steps which the server must perform before a response is sent.

    The following steps are performed in the normal response process:

    \* Authorization translation

    \* Name translation

    \* Path checks

    \* Object type

    \* Respond to request

    \* Log the transaction

    If at any time one of these steps fail, another step must be performed to handle the error and inform the client about what happened.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.