Title: WebTalk Implementing Web Services with a dedicated Java daemon
1WebTalkImplementing Web Services with a
dedicated Java daemon
Geert Van Pamel HP-Interex Belux Mannheim,
Germany 10-12 November 2008
2Introduction
- A Java application behaving as a web server
- Java the HTTP protocol is the base
- and IP TCP UDP programming
- Virtual file system
- Not about Applets, Servlets or JSP
- Not about Jakarta or Tomcat
- No SOAP, no BPEL, no WSDL
- KISS Keep it simple
3Why this Project?
- Interoperability of networked clients servers
- Using Open standards
- HTTP protocol
- Network socket programming
- Interfacing with middleware
- Daemon written in Java
- Any client supporting HTTP the protocol
4Why Java?
- Using standard Java
- Extensible
- Can run on any platform CORE
- Easy testing
- Easy implementation
- Can easily interface with other Java classes
- Stable good exception handling
- Well documented
- Modern language many programmers available
5Architecture
Alert
Legacy server
WebTalk Client
WebTalk Server
Legacy server
WebTalk Client
Management Station
6The basic Algorithm
- Initialise the program
- Verify that it runs on one of the registered
servers - Verify the command parameters, overruling default
parameters - Open the log file if requested
- Create the main server listening socket
- Perform the main server loop (endless)
- Listen to the network port and wait for the next
client request - Get the client identification
- Check access authorisation
- Get the client capabilities
- Get the client input parameters
- Parse input parameters
- Validate input parameters
- Perform a server transaction
- Convert the status and results to the client
capabilities - Log the request and the results in the error log
- Return status and results to the client program
- Close the client network connection
7Program Header
- package webtalk
- import java.io.
- import java.net.
- import java.util.
- import java.text.
- public class WebTalk
- // Creates a new instance of WebTalk
- public WebTalk()
-
- // main program
8Program initialization
- private static int tcpPort 2006 // P1
listen port 2006 - private static String logDirName "/tmp"
- private static FileOutputStream logFile // P3
logging mode log,sms - private static PrintWriter log null
- public static void main(String args)
- String crlfStr System.getProperty("line.sepa
rator") - String runModeDefault "normal" // P2
run mode normal - if (crlfStr.equals("\r\n")) logDirName
"c\\temp" - if (args.length 1 !args0.equals(""))
tcpPort Integer.parseInt(args0) // P1
listen port - logFileName "webtalk-" tcpPort ".log"
- if (args.length )
- logFile new FileOutputStream(new
File(logDirName, logFileName), true) - log new PrintWriter (logFile, true)
- catch (FileNotFoundException e)
- writeLog(e.toString()) // But we
continue processing, since not fatal -
9Blocking Unauthorized Server
- try
- serverAddress InetAddress.getLocalHost()
- remoteHost serverAddress.getHostAddress()
- serverHost remoteHost
- serverName serverAddress.getCanonicalHostNam
e() - catch (UnknownHostException e)
- sendPanic(e.toString())
- System.exit(8)
-
- if (!allowRemoteHost (remoteHost))
- sendPanic("Reject host") // Unauthorized
server (address) - System.exit(2)
10Open Server Socket
- try
- server new ServerSocket(tcpPort)
- catch (IOException e)
- sendPanic(e.toString())
- System.exit(1)
-
- private final static String versionString
"WebTalk/20070531 (Java/HTTP)" - sendPanic("Starting " versionString)
11Waiting the next Client
- while (true)
- try
- client server.accept()
- catch (IOException e)
- sendPanic(e.toString())
- System.exit(4)
-
- remoteAddress client.getRemoteSocketAddress(
).toString() - remoteHost remoteAddress.substring(1,
remoteAddress.indexOf('', 1)) - try
- in new BufferedReader(
- new InputStreamReader(client.getInputStream(),
webCharset)) - out new PrintStream(client.getOutputStre
am(), false, webCharset) - catch (IOException e)
- sendPanic(e.toString())
- System.exit(5)
-
- // main processing logic here
12Client Access Control
- private final static int MAXIP 50
- private static int clientCount new int
1MAXIP - private static String allowAddress new String
1MAXIP - allowAddress14 nslookup("client1.mshome.net")
- allowAddress15 "192.168.210.34"
- if (!allowRemoteHost (remoteHost))
- sendPanic("Reject host "
remoteHost) -
- static boolean allowRemoteHost (String
remoteAddress) - boolean allowIP
- allowIP false
- for (int i 1 i
- if (remoteAddress.equals(allowAddressi))
- allowIP true
- clientCounti
- break
13Getting Browser Input
- String webTalkIn
- webTalkIn "\n-- Start request"
- // Get the client request
- while (webTalkIn ! null ! webTalkIn.equals("")
) - // Here comes the parsing of the browser
request - // Get the next HTTP header until empty line
encountered - webTalkIn in.readLine()
14Parsing the Client URL
- String webRequest // GET /urlPath/...?webPara
mvalue... HTTP/1.1 - String mainPath
- String urlPath
- String webParam
- String paramPair
- writeLog(remoteHost " " gmTime " "
webTalkIn) - webRequest webTalkIn.split(" ")
- mainPath webRequest1.split("?", 2)
- urlPath mainPath0.split("/")
- webParam mainPath1.split("")
- / Here we should map the key/value pairs into
the application logic / - for (int c 0 c
- paramPair webParamc.split("", 2)
- paramPair0 paramPair0.toUpperCase()
- //System.out.println(paramPair0)
- //System.out.println(paramPair1)
15Parsing HTTP Headers
- User-Agent
- Via
- Accept-Language
- HTTP/1.x
- Authentication
- Connection keep-alive
16Identifying the Browser
- / set default userAgent /
- if (userAgent unkownUserAgent
- webRequest.length 2
- webRequest0.equals("User-Agent"))
- if (runMode.equals("trace"))
writeLog(webTalkIn) - if (webRequest1.startsWith("Mozilla"))
- // Firefox, Internet Explorer
- userAgent mozillaUserAgent
- else
- // Lynx, Opera
- userAgent otherUserAgent
-
17The main Server Logic
- Some examples we have implemented with success in
production are - Validating Web forms by calling WebTalk via TCP
socket programming - Apache Embedded Perl calling WebTalk for order
validation - .Net calling the WebTalk server to validate
customer orders - Validating customer orders via a DTMF and a text
to speech system - Oracle PL/SQL calling the WebTalk server to
validate customer orders via the UTL_HTTP and
UTL_TCP package 6
18Returning Server Results
- static void writeBody (String bodyText)
- int bodyLength
- String headerStr
- if (userAgent unknownUserAgent)
- bodyLength 2 bodyText.length()
- if (userAgent otherUserAgent) bodyLength
6 // tag - headerStr "HTTP/1.1 200 OK\nDate "
httpTime - "\nServer " versionString
- "\nExpires -1\nCache-Control
no-cache, no-store, - max-age0,
must-revalidate\nPragma no-cache" - "\nContent-Length " bodyLength
- "\nConnection close\nContent-Type
text/html\n - if (userAgent otherUserAgent)
headerStr "\n" - if (runMode.equals("debug"))
writeLog(headerStr) - headerStr headerStr.replaceAll("\n",
"\r\n") "\r" - out.println(headerStr)
-
- if (runMode.equals("debug"))
writeLog(bodyText)
19GMT Time in HTTP Format
- 01234567890123456789012345678
- Fri Nov 03 135156 GMT 2006 standard GMT format
(gmTime) - Fri, 03 Nov 2006 145156 GMT internet GMT format
(httpTime) - private static String gmTime
- private static String httpTime
- Date now
- TimeZone tz TimeZone.getTimeZone("GMT")
- tz.setDefault(tz)
- now new Date()
- gmTime now.toString()
- httpTime gmTime.substring(0,3) ','
- gmTime.substring(7,10)
- gmTime.substring(3,7)
- gmTime.substring(23,28)
- gmTime.substring(10,23)
20Disabling Client Browser Cache
- Our application is data driven
- We must ensure that browsers, or proxies never
cache requests. - Therefore we send the following headers
- Expires -1
- Cache-Control no-cache, no-store, max-age0,
must-revalidate - Pragma no-cache
21Close the Door
- One client at a time
- try
- in.close()
- out.close()
- client.close()
- catch (IOException e)
- sendPanic(e.toString())
- System.exit(6)
22Client Examples
- Normal clients can be browsers like Firefox 8,
Opera 8, or Internet Explorer - http//servername2006/hub/2186/ivr?p1123456p2
012345678 - With telnet
- telnet servername 2006
- GET /hub/2186/ivr?p1123456p2012345678
- (enter)
- With Lynx 8
- lynx "http//servername2006/hub/2186/ivr?p1123
456p2012345678" - With netcat
- echo "GET /hub/2186/ivr?p1123456p2012345678\n
" nc servername 2006
23Other Clients
- Perl
- PHP
- Unix Socket programs
- .Net clients
- Database systems like Oracle 6
- Telecom servers like IVR
24Example Perl
- use IOSocketINET
- Server "servername2006"
- my sock IOSocketINET-new(PeerAddr
Server, Proto 'tcp') - webStat ""
- if (sock)
- sock-write("GET /status\n\n")
- sock-recv(webStat, 2000)
- close(sock)
-
- print "webStat\n"
25Example Oracle stored Procedure
- CREATE FUNCTION web_request (
- request in string)
- return string is
- c utl_tcp.connection len PLS_INTEGER
- result string(2000)
- BEGIN
- c utl_tcp.open_connection ('servername',
2006) - len utl_tcp.write_line(c, 'GET '
request) - len utl_tcp.write_line(c)
- result utl_tcp.get_line(c, TRUE)
- utl_tcp.close_connection(c)
- return result
- END
- select web_request (/status) from dual
26Caveat Firefox and Opera
- server loop
- if (urlPath.length 2 urlPath1.equals("favi
con.ico")) - runMode "ignore"
-
- generating output
- if (runMode.equals("ignore"))
- writeBody(clientResult)
27Simulate a Server (1)
- vi netcat.txt
- HTTP/1.1 200 OK
- Date Tue, 29 May 2007 114708 GMT
- Server WebTalk/20070528 (Java/HTTP)
- Last-Modified Tue, 29 May 2007 114708 GMT
- Expires -1
- Cache-Control no-cache, no-store, max-age0,
must-revalidate - Pragma no-cache
- Content-Length 18
- Connection close
- Content-Type text/html
- P10003P242108
28Simulate a Server (2)
- while true do nc lp 2005
- lynx dump http//localhost2005/test
- lynx source http//localhost2005/test
- nc p 2005 localhost
- telnet localhost 2005
29Server Management Starting the Server
- Unix
- su - apache -c 'java -jar /html/java/bin/webtalk.j
ar 2006 normal log,sms /dev/null 2 /dev/null - On Windows platforms you can start the server
from a scheduled tasks (at system startup) - Windows
- java -jar C\html\java\bin\webtalk.jar 2006 trace
nul 2 nul - General format of startup command
- java -jar webtalk.jar port runmode log,sms
nul 2 nul - Parameters
- port TCP port number (default 2006 you can use
2005 for testing) - runmode debug test trace quiet disable
normal (default) - log "log" to trigger the logging to disk, with
nolog logging is disabled - sms "nosms" to disable sending SMS messages
30Stopping the Server
- Unix
- ps ef grep webtalk
- kill pid
- Windows
- tasklist /fi imagename eq java.exe
- taskkill /pid ProcessID
31Temporarily Disable Panic Button
- http//servername2006/disable
- http//servername2006/enable
- Internally the following code gets executed
- if (urlPath.length 2
- urlPath1.equals("disable")
- urlPath1.equals("enable"))
- runModeDefault urlPath1
- clientResult "Server " runModeDefault
- sendPanic(clientResult)
32Resume normal functioning
- http//servername2006/normal
- http//servername2006/notrace
- http//servername2006/nodebug
- Internally the following code gets executed
- if (urlPath.length 2 urlPath1.equals("norm
al")) - runModeDefault urlPath1
- clientResult "Enable " urlPath1
33Recycling the Log File
- daynum(date u)
- for port in 2005 2006 do
- lynx -dump http//servernameport/nolog
/dev/null - mv /tmp/webtalk-port.log /scratch/webtalk/log
/webtalk-port-daynum.log - lynx -dump http//servernameport/log
/dev/null - done
34Open and close the Log File
- if (urlPath.length 2 urlPath1.equals("log"
) log null) - clientResult "Append logfile"
- logFile new FileOutputStream(new
File(logDirName, logFileName), true) - log new PrintWriter (logFile, true)
-
- else if (urlPath.length 2
urlPath1.equals("nolog") log ! null) - clientResult "Closing logfile"
- logFile.close()
- log null
35Local Server Monitoring
- To verify that the process runs
- Unix
- ps -ef grep "java -jar"
-
- apache 114167 1 0.0 140120 pts/0
001.63 java -jar /html/java/bin/webtalk.jar 2006 - Windows
- tasklist /fi "imagename eq java.exe" /v
-
- Image Name PID Session Name Session
Mem Usage Status -
- java.exe 716 Console 0
12.676 K Unknown - Network monitoring
- netstat -a -n
36Remote Server Monitoring
- for tn in 2005 2006 do
- telnet servername tn 1 /dev/null \
- grep -v 'Connection closed by foreign host.' \
- /usr/local/bin/sendpanic "" "servernametn"
- GET /status HTTP/1.0
- EOF
- done
37Status of the Server
- http//servername2006/status
- server loop
- if (urlPath.length 2 urlPath1.equals("stat
us")) - runMode "status"
- generating output
- if (runMode.equals("status")) runMode
runModeDefault - clientResult "Server " serverName "("
serverHost ")" "\nPort " tcpPort
"\nClient " remoteHost "\nStart
Time " startTime "\nReset Time "
resetTime "\nTime " gmTime
"\nVersion " versionString "\nMode "
runMode "\nLanguage "
acceptLanguage "\nUser Agent "
userAgent "\nTop Client "
allowAddress1 "(" clientCount1 ")"
writeBody(clientResult)
38Usage Statistics
- http//servername2006/counters
- Usage counters per IP address since Mon Jun 04
205639 GMT 2007 - 192.168.86.109 2110 client1.mshome.net
- 192.168.219.113 1198 client2.mshome.net
- 192.168.112.50 916 client3.mshome.net
- This is handled by the following code
- if (urlPath.length 2 urlPath1.equals("coun
ters")) - clientResult "Usage counters per client since
" resetTime "\n" - for (int i 1 i
- if (!allowAddressi.equals(""))
- clientResult "\n"
allowAddressi - "\t" clientCounti
- "\t" rnslookup
(allowAddressi)
39Resetting Counters
- http//servername2006/reset
- if (urlPath.length 2 urlPath1.equals("rese
t")) - resetTime gmTime
- clientResult "Reset counters"
- for (int i 1 i clientCounti 0
40Building the Application
- java -version
- java version "1.4.2"
- Java(TM) 2 Runtime Environment, Standard Edition
- Fast VM (build 1.4.2-6, native threads, mixed
mode, 01/09/2007-2317) - Store the source code in a subdirectory, and
compile with javac. - javac webtalk/WebTalk.java
41Run Interactively
- Unix
- export CLASSPATHlib1.jarlib2.jar.
- Windows
- set CLASSPATHlib1.jarlib2.jar.
- To start the program interactively, immediately
after compiling - java webtalk/WebTalk 2005 debug nolog,nosms
42Build the JAR File
- The manifest file contains a list of all other
required jar files and the name of the main
module to run. If your application is complex,
multiple jar files will be needed. - jar -cv0fm webtalk.jar webtalk/manifest.mf
webtalk/.class - vi webtalk/manifest.mf
- ...
- Manifest-Version 1.0
- Created-By 1.3.0_05 (Sun Microsystems Inc.)
- Class-Path lib1.jar lib2.jar
- Main-Class webtalk/WebTalk
43Error Handling
44General Exception Handling
- try
- // put main program logic here
- catch (Exception e)
- e.printStackTrace ()
- sendPanic(e.toString())
- System.exit(7)
- finally
- sendPanic("Server closing down")
45Enable Debugging
- To enable disable debugging
- http//servername2006/nodebug
- if (urlPath.length 2 urlPath1.equals("debu
g")) - runModeDefault urlPath1
- clientResult "Enable debug"
46Enable Tracing
- To enable disable tracing
- http//servername2006/notrace
- if (urlPath.length 2 urlPath1.equals("trac
e")) - runModeDefault urlPath1
- clientResult "Enable trace"
-
47Enable Quiet mode
- To set quiet mode
- http//servername2006/quiet
- if (urlPath.length 2 urlPath1.equals("quie
t")) - runModeDefault urlPath1
- clientResult "Enable quiet mode"
-
48Error Logging
- static void sendPanic (String panicString)
- writeLog(panicString)
- if (smsRelayAddress ! null)
- sendSMS (serverName " " serverHost ""
tcpPort " " - panicString
- " from " remoteHost " "
gmTime) -
- static void writeLog (String logText)
- system.err.println(logText)
- if (log ! null)
- log.println(logText)
-
49Sending SMS Alarm
- static void sendSMS (String smsString) byte
sms - DatagramPacket smsPacket
- DatagramSocket smsSocket
- try
- sms smsString.getBytes()
- smsPacket new DatagramPacket (sms,
- sms.length, smsRelayAddressDefault, 535)
- smsSocket new DatagramSocket()
- smsSocket.send (smsPacket)
- smsSocket.close()
- catch (Exception e) // ignore
-
50Disable SMS at Startup
- private static InetAddress smsRelayAddressDefault
- private static InetAddress smsRelayAddress
- try
- smsRelayAddressDefault InetAddress.getByName
("sms-udp-gateway") - catch (Exception e)
- smsRelayAddressDefault null
-
- smsRelayAddress smsRelayAddressDefault
- if (args.length 3 args2.indexOf("nosms")
0) - smsRelayAddress null
51Disable SMS at runtime
- lynx -dump http//servername2006/nosms
- The following code gets executed
- if (urlPath.length 2 urlPath1.equals("sms"
)) - smsRelayAddress smsRelayAddressDefault
- clientResult "Enable sms notification"
- sendPanic(clientResult)
-
- else if (urlPath.length 2
urlPath1.equals("nosms")) - smsRelayAddress null
- clientResult "Disable sms notification"
- sendPanic(clientResult)
52UDP to TCP Relay Server (1)
- import java.io.
- import java.net.
- public class RelaySmsUdp
- public static void main (String args)
- DatagramSocket smsSocket
- DatagramPacket smsPacket
- InetAddress clientAddress
- String clientHost
- String panicString
- Socket outSocket
- PrintWriter out
- byte sms new byte165 // byte array
- String panicDest
- String smsHost
- panicDest "0123456789"
- if (args.length 1
!args0.equals("")) panicDest args0 - smsHost "sms-tcp-gateway"
- if (args.length 2
!args1.equals("")) smsHost args1
53UDP to TCP Relay Server (2)
- try
- smsSocket new DatagramSocket(535) //
listen to port - while (true) try
- smsPacket new DatagramPacket (sms,
sms.length) - smsSocket.receive (smsPacket)
- clientAddress smsPacket.getAddress()
- clientHost clientAddress.getHostAddress()
- panicString new String (smsPacket.getData(),
0, smsPacket.getLength()) - if (!panicString.startsWith("0")) panicString
panicDest " " panicString // prefix with GSM
number if needed -
- if (clientHost.startsWith("192.168.")) //
Filter non-registered IP addresses - outSocket new Socket (smsHost, 535)
- out new PrintWriter(outSocket.getOutputStream
()) - if (panicString.length() 165)
- panicString panicString.substring(0, 165)
- out.println (panicString)
- out.close()
- outSocket.close()
-
54Supported Server Platforms
- Java virtually runs on all platforms
- Any Intel Linux
- Any Intel Windows XP or Vista desktop
- Alpha Tru64 UNIX V5.1B-3 with Java 1.4.2-7, see
11 - Itanium
- Windows server 2003 with Java 1.5.0_07
55Implemented Standards
- DNS
- HTTP, see 2
- Internet date time format
- Java, see 3 4 5
- NFS
- NTP
- TCP/IP
- UDP
- Web Cache control
- ZIP
56What I have learned
- Think in objects
- Keep it simple (divide and conquer)
- Client /server programming is fun
- ... debugging and fault finding even more
- It boosts the team spirit
- It stimulates your own brains and creativity
- TCP sockets do not have an end-of-file...
- a server socket cannot know when the clients
sends their last packet - this is why an empty line has been built into the
HTTP and SMTP protocol - Java (network) programming is not really exotic,
nor complicated - Java initialises all variables to 0, , or null
- Java always start with element 0
- In Java you do not use pointers and linked lists
to create dynamic data structures - Sparse matrices are natural in Java
- Error handling and planning for the unforeseen is
the most important try / catch should be a
habit - The HTTP protocol terminates every line by CRLF.
Originally I terminated every HTTP server output
by LF only using println (\n). None of the
Unix type systems did complain, until a .Net
server replied with a blocking message The
server committed a protocol violation. - Keep the history of your changes, e.g. with RCS,
Revision Control System. - Web applications must disable proxy and browser
cache
57Design Principles
- separate code and data
- flexible data structures
- fully table data driven
- keep the code simple
- code only once (no duplicate instructions)
- do normal things straight
- use industry standards
- use as much as possible standard system functions
- do care about and be conservative with system
resources - give the power to the users
- be flexible, and extensible
- be future proof
- be generous on what you accept, be strict on what
you return - do the unforeseen via exception handling be
robust - be fool proof
- avoid catastrophes at all times
- use what you know
- have maximum security and access control
- allow for logging, tracing, and debugging
- care about supportability
- be platform independent
- write a complete documentation
58Future Extensions and Migration
- Advanced Java debugging
- Appliances
- Application setup via config file instead of
hardcoded - DNS caching
- IPv6 Internet protocol V6
- Java runtime optimisation (tuning, memory usage)
- kill -HUP To change debug level, or restart the
server - Legacy applications
- Load balancing
- Multithreaded server
- NTLM Active Directory user authentication
- POST Allow for other HTTP protocols
- SIF Service Invocation Framework -- SOA services
for Java - Timeout On a bad behaving client connect
(currently we suffer from a DoS problem) - SNMP monitoring
- SOA Extending to Service Oriented Architecture
- System parameters
- UDP monitoring
- XML Input / Output in XML format
59References
- 1 Full program source and additional material
http//www.hp-interex.be/pub/project/webtalk - 2 The HTTP protocol and related standards
http//www.w3.org - 3 Documentation and kits for Java
http//www.sun.com - 4 Java technical documentation
http//java.sun.com/j2se/1.4.2/docs - 5 Java search page http//java.sun.com/j2se/1.4
.2/search.html - 6 Oracle UTL_HTTP http//www.oracle.com/technol
ogy/sample_code/tech/pl_sql/htdocs/x/Utl_Http_Pack
age_Enhancements/Cr_Using_Utl_Http.htm - 7 Iptables http//www.netfilter.org
- 8 Browsers
- The Lynx browser http//lynx.browser.org
- Firefox http//www.firefox.com
- Opera http//www.opera.com
- 9 Perl libraries http//search.cpan.org
- 10 NetBeans http//www.netbeans.org
- 11 HP Java implementations http//www.hp.com/ja
va - 12 Bruce Eckel, Thinking in Java, The
definitive introduction to object-oriented
programming in the language of the World Wide
Web, Fourth Edition, ISBN 0-13-187248-6, 2006,
Prentice Hall, Pearson Education, Code
Supplements at http//www.mindview.net
60Thanks
- My colleague Danny De Thaye to encourage me in my
endeavors - Connect Management for accepting my lecture
- To you
-
- http//www.hp-interex.be/wiki/index.php/UserGeert
ivp - geert.van.pamel_at_belgacom.net
61Questions
62Useful Utilities
- Any web browser 8 To test the server (Firefox,
Internet Explorer, Opera, lynx) - crontab To reset the daily log files, to monitor
- jar Java archive builder
- java Java runtime interpreter
- javac Java Compiler
- Google For help with Java, use e.g. Google
Java ServerSocket - host To lookup the IP address of a machine
- init To start the Web Service
- nc, netcat To test, debug, or simulate
- NetBeans 10 Java IDE Integrated Development
Environment Unix Windows - NFS The server is developed, build tested
cross-platform - nmblookup, nbtstat To lookup the name of a
Windows client, if not registered in DNS - NTP, ntpq To synchronise system time
- Perl 9 Practical Extraction and Reporting
Language - ps, grep, kill To monitor or change run status
- telnet To monitor and test special requests
(does not work in batch) - vi Terminal based editor - on linux, you might
have colours - zip, Winzip To verify (or update) the contents
of jar files.
63Technical Terms
- API Application Programming Interface
- CRLF Carriage Return and Line Feed
- GMT Greenwich Mean Time, almost the same as UTS
(Universal Time Coordinated) - HW Hardware
- IVR Interactive Voice Response
- Jar Java archive
- JDK Java Development Kit
- JRE Java Runtime Environment
- JSP Java Server Pages
- JVM Java Virtual Machine
- OS Operating System
- Platform A combination of hardware and software
- SMS GSM text message (do not confuse with
Microsoft System Management Server) - SW Software (operating system and layered
products) - Unix Any type of Unix, or Linux OS, in general
- UNIX UNIX Trademark
64nslookup
- static String nslookup (String hostName)
- String ipAddress
- try
- ipAddress InetAddress.getByName(hostName
).getHostAddress() - catch (UnknownHostException e)
- ipAddress ""
-
- return ipAddress
65rnslookup
- static String rnslookup (String ipAddress)
- String hostName
- try
- hostName InetAddress.getByName(ipAddress
).getHostName() - catch (UnknownHostException e)
- hostName ""
-
- return hostName
66Abstract
- The speaker presents a Java application that
behaves like a dedicated web server and provides
Web services. It runs as a standalone network
daemon and only calls system and network services
that are directly executed by the JVM. No other
software is necessary. The URL path referenced by
the clients is not referring to files. Instead it
is calling other middleware services and serves
as a Web service gateway. The application only
requires TCP/IP and Java library programming.
Because it is a web server, the browser can be
any client capable of interfacing with the
standard HTTP protocol. - Learn about Java network programming,
specifically about security, reliability,
supportability, monitoring, browser cache
disabling, kit building, starting the Java server
process, troubleshooting and monitoring,
implementing on different operating systems and
platforms, and integrating with other services.
Debugging server processes is difficult because
there is no direct user interface. Every
interaction goes via network sockets, or process
signals. Remotely control the server by using the
HTTP protocol, enable and disable logging,
tracing, and debugging info.