Recent Notes
Displaying keyword search results 91 - 100
Created by nogeek on April 25, 2010 05:09:14
Last update: April 25, 2010 05:10:46
Oracle Web Cache version used:
Oracle Application Server Web Cache 10.1.2.3.0
...
The test page is a simple Struts action sending a URL redirect:
public ActionForward execute(ActionMapping map...
Web Cache setup
Origin server
Host Name Port
oas.host 7777
Site
Host Name Port URL Path Prefix
webcache.host 80
Test results
Request directly to the OC4J (Oracle Application Server):
C:\work\testAppWebApp2>curl --dump-header - http:/...
Request to Oracle Web Cache:
C:\work\testAppWebApp2>curl --dump-header - http:/...
Notice that Oracle Web Cache correctly translated the host name in the header and HTML page. However, the port number remained that of the Oracle App Server.
Created by Fang on April 01, 2010 22:24:58
Last update: April 02, 2010 02:49:38
In this note I'll show you how to create and package a JSP custom tag. The purpose of this tag is to display a random splash image for a home page, among a set of images. We should be able to add or delete candidate splash images from the WAR archive without the need to change the JSP. This is the intended use of the tag:
<%@ taglib uri="http://custom.tag.com/demo" prefix... In the above example you provide a set of images named splash*.png (e.g., splash1.png, spalsh2.png, ...), and the tag will pick a random one to display when the JSP is rendered. Let's get started. I'll use Maven for this purpose. Create the standard Maven directory structure ./pom.xml ./src ./src/main ./src/main/jav... pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... SplashTag.java package tagdemo; import java.util.ArrayList......
Created by Dr. Xi on February 15, 2010 06:09:56
Last update: February 16, 2010 03:08:34
The context root of a web application determines the root path of URLs that will be handled by that application. For example, if the context root is example , then URLs starting with /example (i.e., /example/* ) will be handled by that application. By default, Tomcat uses the WAR file name (without the .war extension) or, if deployed in exploded directory form, the name of the top level directory as the context root . For example, the pre-installed examples application is deployed under the examples directory under webapps , and its context root is examples . You may want to use a different context root than Tomcat's default. For example, if you build your application with Maven, the resulting WAR file might be named my-fabulous-app-1.0-SNAPSHOT.war...
Created by Dr. Xi on January 29, 2010 23:40:11
Last update: January 29, 2010 23:40:11
Load from specified PATH
// import java.util.Properties
Properties p...
Load from CLASSPATH
Properties p = new Properties();
// Loa...
Write Properties object to a file
// Write properties file.
out = new FileOut...
Created by google.P3SY7GMD on January 25, 2010 16:11:01
Last update: January 25, 2010 16:11:01
Simple have your project in eclipse, and your jars in the build path.
Type CTRL-SHIFT-T... Just entre the name of the class and eclipse show from where it come from.
Created by Dr. Xi on September 29, 2008 23:21:38
Last update: January 16, 2010 23:36:05
Create a startup script for inetd
Copy /etc/init.d/skeleton to /etc/init.d/inetd . Change the top section of the script to read:
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="In...
Now inetd can be stopped/started/restarted like this:
sudo /etc/init.d/inetd stop
sudo /etc/init....
Add links to rc*.d
$ sudo update-rc.d inetd defaults
Adding sy...
If you no longer need to start inetd at boot up:
$ sudo update-rc.d -f inetd remove
update-r...
This would remove the links from the start up sequence but leave /etc/init.d/inetd in place.
Contents of /etc/init.d/skeleton :
#! /bin/sh
### BEGIN INIT INFO
# Provide...
Created by Fang on August 13, 2009 02:59:06
Last update: January 09, 2010 23:36:44
Maven requires JAVA_HOME to be set but the setting is tricky. It doesn't like a PATH inside quotes with a space in it.
C:\>@rem quotes and space doesn't work
C:\>set ...
Created by Dr. Xi on January 04, 2010 05:04:10
Last update: January 07, 2010 15:59:25
This is the error:
>>> import urllib2
>>> f = urllib2.urlopen('htt...
Reason: SSL is not supported in Python installation.
>>> import httplib
>>> hasattr(httplib, 'HTTPS'...
Solution: recompile Python with SSL on
Steps:
Download and install OpenSSL , if you don't have it already.
Download Python source and rebuild Python (the usual steps of configure, make and make install). Python's configure script should be able to pick up your existing SSL libraries automatically and build a shared library _ssl.so.
Some web sites suggest editing the file Modules/setup.dist , uncomment the lines starting with _ssl , and making changes to the SSL path. This would link the SSL library statically to Python.
# Socket module helper for socket(2)
#_socket s...
Created by Dr. Xi on September 13, 2009 03:30:24
Last update: September 13, 2009 03:30:24
Select the Path tool from the Tools menu
Start clicking on the picture to drop vertices on the picture
Hold CTRL and click on the first vertex to close the path
Stroke the path (Edit->Stroke Path), or convert the path to selection (Click the "Create Selection from Path" button)
Created by Fang on September 07, 2009 16:39:37
Last update: September 07, 2009 18:43:04
It's easiest to use the archetype plugin to start a new Maven project. I'll use struts 1 as example since it's not in the built-in archetypes for archetype:generate . Generate a simple webapp with archetype:generate :
C:\work\maven>mvn archetype:generate -DarchetypeAr... It generates a directory structure like this: struts1app struts1app/pom.xml struts1app/src... with a simple POM: <project xmlns="http://maven.apache.org/POM/4.0.0"... Create settings.xml in $HOME/.m2 , add Java.net repository for Java EE dependencies: <?xml version="1.0" encoding="UTF-8"?> <setting... Add Java EE and Struts dependencies in pom.xml . Note that the Java EE dependency has scope provided , meaning that the web app container provides the jars, therefore we don't need to bundle them with our war fie. <project xmlns="http://maven.apache.org/POM/4.0.0"... Create a directory named java under main , create the Struts form and...