Java Doc for HTTPServer.java in  » Web-Server » BareHTTP » org » savarese » barehttp » 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 » BareHTTP » org.savarese.barehttp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.savarese.barehttp.HTTPServer

HTTPServer
public class HTTPServer (Code)
Implements a server that listens for incoming client connections and services each with HTTPSession instances. A port number, bind address, and maximum number of client connections to service may be specified.
author:
   Daniel F. Savarese

Inner Class :final class Session implements Callable<Void>
Inner Class :class Server implements Callable<Void>

Field Summary
final public static  intDEFAULT_MAX_CONNECTIONS
     The default maximum number of concurrent client connections (10) that will be accepted if not specified.
final public static  intDEFAULT_PORT
     The default port number (8080) to bind to if not specified.
 InetAddressbindAddress
    
 StringdocumentRoot
    
 ExecutorServiceexecutor
    
 inthttpPortmaxConnectionsbacklogconnectionCount
    
 Serverserver
    

Constructor Summary
public  HTTPServer(String documentRoot)
    
public  HTTPServer(String root, int port, int maxConnections)
     Creates an HTTPServer instance.

Method Summary
synchronized  intdecrementConnectionCount()
    
public  InetAddressgetBindAddress()
     Returns the network interface address the server will bind to.
public synchronized  InetAddressgetBoundAddress()
     If the server is running, returns the address currently bound to.
public synchronized  intgetBoundPort()
     If the server is running, returns the port number currently bound to.
public synchronized  intgetConnectionCount()
     Returns the number of client connections currently established.
public  StringgetDocumentRoot()
     Returns the document root directory pathname.
public  intgetMaxConnections()
     Returns the maximum number of concurrent client connections that will be accepted.
public  intgetPort()
     The port number the server will bind to.
synchronized  intincrementConnectionCount()
    
public synchronized  booleanisRunning()
     Returns true if the server is in a running state, false if not.
public synchronized  voidsetBindAddress(InetAddress bindAddr)
     Sets the network interface address the server should bind to.
public synchronized  voidsetMaxConnections(int maxConnections)
     Sets the maximum number of concurrent client connections the server should accept.
public synchronized  voidsetPort(int port)
     Sets the port number the server should bind to.
public synchronized  voidstart()
     Starts listening for incoming connectons in an asynchronously initiated thread.
public synchronized  booleanstop(long timeout, TimeUnit unit)
     Schedules termination of the server, closes the server socket, and waits for the specified amount of time or until the server is terminated before returning.
Parameters:
  timeout - The maximum amount of time to wait for termination.
Parameters:
  unit - The unit of time for the timeout.

Field Detail
DEFAULT_MAX_CONNECTIONS
final public static int DEFAULT_MAX_CONNECTIONS(Code)
The default maximum number of concurrent client connections (10) that will be accepted if not specified.



DEFAULT_PORT
final public static int DEFAULT_PORT(Code)
The default port number (8080) to bind to if not specified.



bindAddress
InetAddress bindAddress(Code)



documentRoot
String documentRoot(Code)



executor
ExecutorService executor(Code)



httpPortmaxConnectionsbacklogconnectionCount
int httpPortmaxConnectionsbacklogconnectionCount(Code)



server
Server server(Code)




Constructor Detail
HTTPServer
public HTTPServer(String documentRoot)(Code)
Same as HTTPServer(documentRoot, DEFAULT_PORT, DEFAULT_MAX_CONNECTIONS);



HTTPServer
public HTTPServer(String root, int port, int maxConnections)(Code)
Creates an HTTPServer instance.
Parameters:
  root - The fully qualified document root directory pathname.
Parameters:
  port - The port number the server should bind to.
Parameters:
  maxConnections - The maximum number of client connections theserver should accept.




Method Detail
decrementConnectionCount
synchronized int decrementConnectionCount()(Code)



getBindAddress
public InetAddress getBindAddress()(Code)
Returns the network interface address the server will bind to. A null return value signifies the wildcard address. The network interface address the server will bind to.



getBoundAddress
public synchronized InetAddress getBoundAddress()(Code)
If the server is running, returns the address currently bound to. Otherwise, returns null. The port number currently bound to or -1 if not bound.



getBoundPort
public synchronized int getBoundPort()(Code)
If the server is running, returns the port number currently bound to. Otherwise, returns -1. The port number currently bound to or -1 if not bound.



getConnectionCount
public synchronized int getConnectionCount()(Code)
Returns the number of client connections currently established. The number of client connections currently established.



getDocumentRoot
public String getDocumentRoot()(Code)
Returns the document root directory pathname. The document root directory pathname.



getMaxConnections
public int getMaxConnections()(Code)
Returns the maximum number of concurrent client connections that will be accepted. The maximum number of concurrent client connections thatwill be accepted.



getPort
public int getPort()(Code)
The port number the server will bind to. The port number the server will bind to.



incrementConnectionCount
synchronized int incrementConnectionCount()(Code)



isRunning
public synchronized boolean isRunning()(Code)
Returns true if the server is in a running state, false if not. True if the server is in a running state, false if not.



setBindAddress
public synchronized void setBindAddress(InetAddress bindAddr)(Code)
Sets the network interface address the server should bind to. By default, the server binds to the wildcard address. The new bind address takes effect the next time HTTPServer.start is invoked (after a HTTPServer.stop if already running).
Parameters:
  bindAddr - The network interface the server should bind to.It may be null to reset to the wildcard.



setMaxConnections
public synchronized void setMaxConnections(int maxConnections)(Code)
Sets the maximum number of concurrent client connections the server should accept.
Parameters:
  maxConnections - The maximum number of concurrent clientconnections the server should accept.



setPort
public synchronized void setPort(int port)(Code)
Sets the port number the server should bind to. By default, the server binds to HTTPServer.DEFAULT_PORT . The new port takes effect the next time HTTPServer.start is invoked (after a HTTPServer.stop if already running).
Parameters:
  port - The port number the server should bind to.



start
public synchronized void start() throws IOException, IllegalStateException(Code)
Starts listening for incoming connectons in an asynchronously initiated thread. The method returns immediately after the listening thread is established, making the HTTPServer instance an active object.
throws:
  IOException - If the server socket cannot be bound.
throws:
  IllegalStateException - If the server is already running.



stop
public synchronized boolean stop(long timeout, TimeUnit unit) throws IOException(Code)
Schedules termination of the server, closes the server socket, and waits for the specified amount of time or until the server is terminated before returning.
Parameters:
  timeout - The maximum amount of time to wait for termination.
Parameters:
  unit - The unit of time for the timeout. True if the server terminated before the method returned,false if not. If false is returned, the server will not becompletely terminated untl HTTPServer.isRunning returns false.Subsequent calls to stop will have no effect while terminating.



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.