Apache Restart
sudo /etc/rc.d/init.d/httpd restart
All requests with port :8080 are caught by tomcat as apache is listening at port 80
requests without ports are heard by apache which listens at port 80 and later redirects through 8009
Directory Structure
etc/httpd/
conf/ conf.d/ logs/ modules/ run/
conf/
httpd.conf ssl.crl ssl.crt ssl.csr ssl.key ssl.prm workers.properties
conf.d/
authz_ldap.conf jk.conf perl.conf php.conf python.conf README ssl.conf webalizer.conf welcome.conf
1. etc/httpd/conf/httpd.conf
Attributes include
DocumentRoot "/home/partyaccount/website/htdocs"
DirectoryIndex index.jsp index.html inde
DefaultType text/plain
ErrorLog logs/error_log
AddEncoding x-compress Z
ErrorDocument 500 "The server made a boo boo."
2. worker/properties
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
[uri:/ws/*]
worker=ajp13:localhost:80
3. etc/httpd/conf.d/jk.conf
worker assighnments with respective .jsp,.html etc
4. etc/httpd/conf.d/ssl.conf
will have virtual hosts configured here ex:pa112 etc
document root
server admin
servername
Rewrite rules per vhost klike
RewriteEngine on
RewriteRule ^(.*)/.jsp$ $1.do [L]
Thursday, July 31, 2008
Apache Basics
Friday, July 25, 2008
Overwriting Struts Resouce Bundle Handling
Care needs to be taken when we overwrite the struts resource bundle handling,especially while overwriting the get text method in struts
This is because , if the customised gettext copies this statment
ResourceBundle bundle = LocalizedTextUtil.findResourceBundle(bundleName, resourceLocale);
where bundlename is the bundle in which property is expected
and if the property does not exist in that bundle, Struts internally looks for the entire set of bundles and searches the key. This is not what is expected
and it consumes a lot of time for each literal check and chokes the server.
A quick fix to this would be to search for the expected bundle and then check if the key which is expected is present.This can be done by using bundle.containskey() and later if it exists then by using the above statement. This reduces a lot of time wasted checking for the entire set of bundle for each property.
Your Kit : A CPU and memory Java Profiler
This is a simple kit with 15 day trial period licence which can be got from http://www.yourkit.com/.
It has both windows and linux versions.For the linux version just copy the
1. copy the libyjpagent.so into tomcat/bin
2. set the path by typing export LD_LIBRARY_PATH=/tomcat/bin
3. Add -agentlib:yjpagent to Tomcat JVM startup params as
JAVA_OPTS=" -agentlib:yjpagent -server -Xms512m -Xmx768m ......" in catalina.sh
To connect for the same from Windows
1 Install the windos version
2 Click on connect remotely . Enter the ip of the profiling machine
3 This gives most of the stats. For time wise distibution of thread on the running methods
click start profiling.
It also gives snapshots for the required time duration.
Wednesday, July 23, 2008
Adding Logger interceptor in Struts
When i had a requirement to add user name and session id to every logger statement for debugging purposes i did not think it would be so easy. I came across sites which suggested adding some extra modules and configurations into the log4j.
But i realized there was a much simpler way which was to modify the thread name appending application specific user name and session id into it. As anyways log4j will print the thread name at every logger statement . Thus with minimal changes my cause was served. I added this functionality into every request by making it as a interceptor and adding it into the basic stack.
I have attached the interceptor code for reference.
Tasks get easy when seen for different perspectives.
Friday, April 18, 2008
Sample WorkFlow Engine Using Enhydra Shark - Struts 2
You can download the sample code(Unzip the war) from
http://www.esnips.com/doc/2d2cc8a2-d336-454b-bb76-5950a22714b9/Enyhydra
Saturday, January 5, 2008
Struts 2
The requests are received and is executed via the Filter Dispatcher ,The tags allows creating dynamic webapp .It supports style sheet driven markup . It has MVC architecture
The execution flow includes request sent from the user to which the filterDispatcher determines appropriate action . Interceptors are applied and execution of action takes place.
Output rendering and results are shown to the user. Struts2 uses OGNL for expression language .Value Stack plays an important role in retrieving values (hides different scopes from user)
Validation can be performed declaratively in 3 ways .Basic Validation Performed at the server side orClient Validation (or javascript validation) or Ajax Validation
Interceptors are actions sharing common concern or actions validating input or actions involving pre/post processing .Since these Interceptors are shared objects thry should be thread-safe
Tiles is a templating framework for easy creation of web pages with consistent look and feel
Tiles plugin allows to return Tiles pages .It can also be used with freemarker in addition to Jsps
Object Graph Navigation Language (OGNL) is an expression language to get/set properties of java objects .More pervasively being used to map GUI elements to model objects. Tansformations are made easier by OGNL’s TypeConverter mechanism .A more expressive replacement for property-getting language .
Template is a piece of code, usually written in Freemarker, that is rendered by tags . Freemarker is a template engine used to generate output based on a template .It can be used to generate any kind of text: HTML, XML, RTF, Java source code, etc.
Theme is collection of templates packaged together to provide common functionality. qxhtml’ is an example of wrapping the ‘simple’ theme
Saturday, December 29, 2007
Table Display Using DisplayTags & AjaxTags
The display tag library is an open source suite of custom tags that provide high-level web presentation patterns which will work in an MVC model.
Display tag can be downlaoded from
http://displaytag.sourceforge.net/11/download.html
Actually the display tag library can just... display tables! Give it a list of objects and it will handle column display, sorting, paging, cropping, grouping, exporting, smart linking and decoration of a table in a customizable XHTML style
Exporting includes CSV,PDF,XML,Excel formats.
Pagination and sorting can be easily achieved.Sorting can be done per page or on the entire list based on the option given.Different css can be used for styling.
Table contents can be given as links by href options.Also dynamic links can be provided.Decorators can be used to display the contents of the table in desired formats.Decorators can be applied to tabel as a whole or per column basis.
The object to be displayed can be a Collection, an Enumeration, a Map (values are displayed in row), a Dictionary (values are displayed in row), an array, an Iterator, any Object with an iterator method.
The AJAX JSP Tag Library is a set of JSP tags that simplify the use of Asynchronous JavaScript and XML (AJAX) technology in JavaServer Pages.
It is a wrapper over display tag which allows only the part of the screen to be refreshed without the entire page being sent back to the server.Configeration is simple and all features of the display tag can be used.
Ajax Tags can be downloaded from
.jpg)