Java Doc for Main.java in  » Web-Server » Brazil » sunlabs » brazil » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Brazil » sunlabs.brazil.server 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   sunlabs.brazil.server.Main

Main
public class Main (Code)
Sample main program for starting an http server. A new thread is started for each Server , listening on a socket for HTTP connections. As each connection is accepted, a Request object is constructed, and the registered Handler is called. The configuration properties required by the server and the handler (or handlers), are gathered from command line arguments and configuration files specified on the command line.

The command line arguments are processed in order from left to right, with the results being accumulated in a properties object. The server is then started with Server.props set to the final value of the properties. Some of the properties are interpreted directly by the server, such as the port to listen on, or the handler to use (see Server for the complete list). The rest are arbitrary name/value pairs that may be used by the handler.

Although any of the options may be specified as name/value pairs, some of them: the ones interpreted by the server, the default handler ( FileHandler , or Main , may be prefixed with a "-". Those options are explained below:

-p(ort)
The network port number to run the server on (defaults to 8080)
-r(oot)
The document root directory, used by the FileHandler (defaults to .)
-h(andler)
The document handler class (defaults to FileHandler sunlabs.brazil.handler.FileHandler )
-c(onfig)
A java properties file to add to the current properties. There may be several -config options. Each file is added to the current properties. If the properties file contains a root property, it is treated specially. See below. If the config file is not found in the filesystem, it is read from the jar file, with this class as the virtual current directory if a relative path is provided.
-i(p)
A space seperated list of hosts allowed to access this server If none are supplied, any host may connect. The ip addresses are resolved once, at startup time.
-l(og)
The log level (0->none, 5->max) Causes diagnostic output on the standard output.
-s(tart)
Start a server. Allows multiple servers to be started at once. As soon as a -s is processed, as server is started as if all the options had been processed, then the current properties are cleared. Any options that follow are used for the next server.
-S(ubstitute)
Perform ${..} substitutions on the current values.

Following these options, any additional additional pairs of names and values (no "-"'s allowed) are placed directly in Server.props .

If the resource "/sunlabs/brazil/server/config" is found, it is used to initialize the configuration.

If a non absolute root property is specified in a configuration file, it is modified to resolve relative to the directory containing the configuration file, and not the directory in which the server was started. If multiple configuration files with root properties (or -r options, or "root" properties) are specified, the last one tekes precidence.

The "serverClass" property may be set to the string to use as the server's class, instead of "sunlabs.brazil.server.server"



Field Summary
final static  StringCONFIG
    


Method Summary
public static  voidinitProps(Properties config)
     Initialize a properties file with some standard mime types The FileHandler only delivers files whose suffixes are known to map to mime types.
public static  voidmain(String[] args)
    
public static  booleanstartServer(Properties config)
     Start a server using the supplied properties.

Field Detail
CONFIG
final static String CONFIG(Code)





Method Detail
initProps
public static void initProps(Properties config)(Code)
Initialize a properties file with some standard mime types The FileHandler only delivers files whose suffixes are known to map to mime types. The server is started with the suffixes: .html, .txt, .gif, .jpg, .css, .class, and .jar predefined. If additional types are required, they should be supplied as command line arguments.



main
public static void main(String[] args) throws Exception(Code)



startServer
public static boolean startServer(Properties config)(Code)
Start a server using the supplied properties. The following entries are treated. Specially:
handler
The name of the handler class (defaults to file handler)
host
The host name for this server
log
Diagnostic output level 0-5 (5=most output)
maxReqests
max number of requests for a single socket (default 25)
listenQueue
max size of the OS'slisten queue for server sockets
maxThreads
max number of threads allowed (defaults to 250)
port
Server port (default 8080)
defaultPrefix
prefix into the properties file, normally the empty string "".
restrict
list of hosts allowed to connect (defaults to no restriction)
timeout
The maximum time to wait for a client to send a complete request. Defaults to 30 seconds.
interfaceHost
If specified, a host name that represents the network to server. This is for hosts with multiple ip addresses. If no network host is specified, then connections for all interfaces are accepted

Parameters:
  config - The configuration properties for the server



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.