Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on April 16, 2012 13:32:10    Last update: April 16, 2012 13:32:10
There are two steps to create a custom function for JSP: Declare the function in the TLD: <?xml version="1.0" encoding="UTF-8" ?> <taglib... Implement the function (must be static): package com.example; public class UrlTransl... To use the function: <%@ taglib uri="http://www.example.com/jsp/tags" p...
Created by nogeek on March 13, 2012 11:53:49    Last update: March 13, 2012 11:53:49
A. To configure Apache httpd to proxy Tomcat using HTTP: Load Apache httpd modules ( httpd.conf ): LoadModule proxy_module /usr/lib/apache2/modules/m... Configure Apache httpd proxy: <VirtualHost *:80> ServerAdmin webmaster@my... Configure Tomcat HTTP connector with appropriate proxyName and proxyPort : <Connector port="8080" protocol="HTTP/1.1"... Note: context path must be the same for httpd and Tomcat. B. To configure Apache httpd to proxy Tomcat using AJP: Load Apache httpd modules ( httpd.conf ): LoadModule proxy_module /usr/lib/apache2/modules/m... Configure Apache httpd proxy: <VirtualHost *:80> ServerAdmin webmaster@my... Configure Tomcat AJP connector: <Connector port="8009" protocol="AJP/1.3" redirect... You can try this if context path must be changed between Tomcat and httpd: <VirtualHost *:80> ServerAdmin webmaster@my... But this may not work in case the servlet context path is written in the HTML content. ProxyPassReverse only...
Created by Fang on February 21, 2012 20:54:23    Last update: February 21, 2012 20:57:57
Tomcat gzip compression filter can be turned on with " compression=on " in server.xml : <Connector port="8080" protocol="HTTP/1.1" ... The default compressed MIME types are: text/html,text/xml,text/plain . It would be nice to add other types: <Connector port="8080" protocol="HTT...
Created by voodoo on September 30, 2011 08:22:39    Last update: February 18, 2012 16:17:36
This iptables rule redirects all port 80 traffic from subnet 192.168.0.0/24 to 192.168.0.1 running HTTP proxy (say squid): /usr/sbin/iptables -t nat -A PREROUTING -s 192.168... Make any packets destined to port 3256 on firewall be NAT'ed to internal system server on port 80: iptables -t nat -I PREROUTING -s ! 192.168.2.0/24 ... To make internal web server work for clients from the internet, LAN and the firewall itself: Make all packets from the Internet going to port 80 on the firewall ( $INET_IP ) to be redirected (or DNAT'ed) to the internal HTTP server ( $HTTP_IP ): iptables -t nat -A PREROUTING --dst $INET_IP -p tc... SNAT the packets entering the firewall that are destined for $HTTP_IP (internal HTTP server) port 80 so that they...
Created by nogeek on December 29, 2011 13:31:44    Last update: December 29, 2011 14:29:13
Tomcat allows you to create multiple server instances for the same installation. The installation directory is identified as CATALINA_HOME , the instance directory is identified as CATALINA_BASE . Here are the steps: Create a base directory for the new instance, for example: /home/nogeek/tomcat1 . Create the subdirectories: mkdir -p /home/nogeek/tomcat/{bin,conf,logs,temp,w... Copy web.xml from the installation directory: cp $CATALINA_HOME/conf/web.xml /home/nogeek/tomcat... Copy logging.properties from the installation directory: cp $CATALINA_HOME/conf/logging.properties /home/no... Create server.xml under tomcat1/conf : <?xml version='1.0' encoding='utf-8'?> <Server ... Create script setenv.sh under tomcat1/bin : # Edit this file to set custom options # Tomcat... Copy startup.sh and shutdown.sh from the installation directory. Add the following two lines to the beginning of each: CATALINA_BASE=/home/nogeek/tomcat1 export CATAL... Create a soft link for catalina.sh in tomcat1/bin : $ ln -s ~/apache-tomcat-7.0.22/bin/catalina.sh cat...
Created by mee2 on November 20, 2011 21:00:58    Last update: November 20, 2011 21:10:22
Alfresco community-4.0.b has only 64-bit installer for Linux. These are the steps to manually install it on 32-bit Ubuntu Linux. Download alfresco-community-4.0.b.zip from http://wiki.alfresco.com/wiki/Download_and_Install_Alfresco . Install dependencies: $ sudo apt-get install imagemagick swftools postgr... Note: swftools was not available as a package for Ubuntu 11.10, I installed it with source . Create alfresco database: $ sudo bash [sudo] password for alfresco: ... Copy everything from the Alfresco web-server folder to Tomcat: $ cp -R alfresco-community-4.0.b/web-server/* apac... Edit $TOMCAT_HOME/conf/catalina.properties , change shared.loader to: shared.loader=${catalina.base}/shared/classes,${ca... Edit Tomcat conf file conf/server.xml , add URIEncoding="UTF-8" : <Connector port="8080" protocol="HTTP/1.1" ... Customize alfresco-global.properties : $ mv shared/classes/alfresco-global.properties.sam... Edit shared/classes/alfresco-global.properties : ############################### ## Common A... Copy keystore files from alfresco.war : expand alfresco.war , grab the whole keystore directory from...
Created by Dr. Xi on September 30, 2011 15:34:47    Last update: September 30, 2011 15:34:47
A naive try would be something like this: $ nc -l 8082 | nc remote_host 80 Yes, it does forward the request from local port 8082 to remote_host:80 , but the response is dumped to stdout , not routed back to the client as expected. Using a named pipe makes it work: $ mkfifo backpipe $ nc -l 8082 0<backpipe | nc ... Use tee to get a glimpse of the response through the pipe (I wasn't able to find a way to dump the request): $ nc -k -l 8082 0<backpipe | nc localhost 80 | tee... The GNU netcat has a different syntax than the stock nc . It also supports different switches. To listen to port 1234: $ netcat -l -p 1234...
Created by magnum on September 27, 2011 21:51:05    Last update: September 28, 2011 18:02:49
Client socket usually does not call bind . But I've seen code that does and it was puzzling to me what bind does to a client socket. Therefore, this little test program. It retrieves a web url and displays info about the socket. You can optionally give a bind host name/ip and port and see what it does. Here are my test results: $ ./client www.google.com Local addr: 172.16.0.... This is the code: #include <stdio.h> #include <stdlib.h> #incl...
Created by magnum on September 27, 2011 09:32:18    Last update: September 27, 2011 09:33:04
Use tcpdump to monitor traffic on a network: To print all incoming and outgoing packets on host 192.168.0.1 : tcpdump host 192.168.0.1 To print all incoming and outgoing IP packets on host firebird : tcpdump ip host firebird To write raw packets to a file, rather than parsing and printing them out: tcpdump ip host firebird -w /tmp/firebird.pcap To listen on interface eth0 (without this, tcpdump listens on the lowest numbered, configured up interface except loopback): tcpdump -i eth0 ip Use switch -X for more verbose output: tcpdump -i eth0 ip -X host 192.168.0.1 Outgoing from 192.168.0.1 : tcpdump -i eth0 ip -X src host 192.168.0.1 Incoming to 192.168.0.1 : tcpdump -i eth0 ip -X dst host 192.168.0.1 More verbose output: tcpdump -i eth0 tcp -vvX host 192.168.0.1...
Created by Dr. Xi on August 11, 2007 15:56:47    Last update: July 19, 2011 08:15:55
Here's a list of common TCP ports. You can find a more complete list here: http://www.gasmi.net/docs/tcp.html . Port Number Service Description 21 FTP File Transfer Protocol 22 SSH Secure Shell 23 Telnet Telnet remote login 25 SMTP Simple Mail Transfer Protocol 70 gopher Gopher 79 finger Finger 80 HTTP Hyper Text Transfer Protocol (WWW) 88 Kerberos Kerberos authentication 94 tivoli Tivoli Object Dispatcher 110 pop3 Post Office Protocol Version 3 123 ntp Network Time Protocol 137 netbios NetBIOS Name Service 138 netbios NetBIOS Datagram 139 netbios NetBIOS Session 143 imap Internet Message Access Protocol 161 snmp Simple Network Management Protocol 162 snmptrap SNMP trap 194 irc Internet Relay Chat Protocol 389 ldap Lightweight Directory Access Protocol 443 https Secure HTTP 445 SMB MS Server Message...
Previous  1 2 3 4 Next