KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > net > DefaultServerSocketFactory


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.catalina.net;
30
31
32 import java.io.IOException JavaDoc;
33 import java.net.InetAddress JavaDoc;
34 import java.net.ServerSocket JavaDoc;
35 import java.security.KeyStoreException JavaDoc;
36 import java.security.NoSuchAlgorithmException JavaDoc;
37 import java.security.UnrecoverableKeyException JavaDoc;
38 import java.security.KeyManagementException JavaDoc;
39 import java.security.cert.CertificateException JavaDoc;
40 import org.apache.catalina.net.ServerSocketFactory;
41
42
43 /**
44  * Default server socket factory, which returns unadorned server sockets.
45  *
46  * @author db@eng.sun.com
47  * @author Harish Prabandham
48  * @author Craig R. McClanahan
49  */

50
51 public final class DefaultServerSocketFactory implements ServerSocketFactory {
52
53
54     // --------------------------------------------------------- Public Methods
55

56
57     /**
58      * Returns a server socket which uses all network interfaces on
59      * the host, and is bound to a the specified port. The socket is
60      * configured with the socket options (such as accept timeout)
61      * given to this factory.
62      *
63      * @param port the port to listen to
64      *
65      * @exception IOException input/output or network error
66      * @exception KeyStoreException error instantiating the
67      * KeyStore from file (SSL only)
68      * @exception NoSuchAlgorithmException KeyStore algorithm unsupported
69      * by current provider (SSL only)
70      * @exception CertificateException general certificate error (SSL only)
71      * @exception UnrecoverableKeyException internal KeyStore problem with
72      * the certificate (SSL only)
73      * @exception KeyManagementException problem in the key management
74      * layer (SSL only)
75      */

76     public ServerSocket JavaDoc createSocket (int port)
77     throws IOException JavaDoc, KeyStoreException JavaDoc, NoSuchAlgorithmException JavaDoc,
78            CertificateException JavaDoc, UnrecoverableKeyException JavaDoc,
79            KeyManagementException JavaDoc {
80
81         return (new ServerSocket JavaDoc(port));
82
83     }
84
85
86     /**
87      * Returns a server socket which uses all network interfaces on
88      * the host, is bound to a the specified port, and uses the
89      * specified connection backlog. The socket is configured with
90      * the socket options (such as accept timeout) given to this factory.
91      *
92      * @param port the port to listen to
93      * @param backlog how many connections are queued
94      *
95      * @exception IOException input/output or network error
96      * @exception KeyStoreException error instantiating the
97      * KeyStore from file (SSL only)
98      * @exception NoSuchAlgorithmException KeyStore algorithm unsupported
99      * by current provider (SSL only)
100      * @exception CertificateException general certificate error (SSL only)
101      * @exception UnrecoverableKeyException internal KeyStore problem with
102      * the certificate (SSL only)
103      * @exception KeyManagementException problem in the key management
104      * layer (SSL only)
105      */

106     public ServerSocket JavaDoc createSocket (int port, int backlog)
107     throws IOException JavaDoc, KeyStoreException JavaDoc, NoSuchAlgorithmException JavaDoc,
108            CertificateException JavaDoc, UnrecoverableKeyException JavaDoc,
109            KeyManagementException JavaDoc {
110
111         return (new ServerSocket JavaDoc(port, backlog));
112
113     }
114
115
116     /**
117      * Returns a server socket which uses only the specified network
118      * interface on the local host, is bound to a the specified port,
119      * and uses the specified connection backlog. The socket is configured
120      * with the socket options (such as accept timeout) given to this factory.
121      *
122      * @param port the port to listen to
123      * @param backlog how many connections are queued
124      * @param ifAddress the network interface address to use
125      *
126      * @exception IOException input/output or network error
127      * @exception KeyStoreException error instantiating the
128      * KeyStore from file (SSL only)
129      * @exception NoSuchAlgorithmException KeyStore algorithm unsupported
130      * by current provider (SSL only)
131      * @exception CertificateException general certificate error (SSL only)
132      * @exception UnrecoverableKeyException internal KeyStore problem with
133      * the certificate (SSL only)
134      * @exception KeyManagementException problem in the key management
135      * layer (SSL only)
136      */

137     public ServerSocket JavaDoc createSocket (int port, int backlog,
138                                       InetAddress JavaDoc ifAddress)
139     throws IOException JavaDoc, KeyStoreException JavaDoc, NoSuchAlgorithmException JavaDoc,
140            CertificateException JavaDoc, UnrecoverableKeyException JavaDoc,
141            KeyManagementException JavaDoc {
142
143         return (new ServerSocket JavaDoc(port, backlog, ifAddress));
144
145     }
146
147
148 }
149
Popular Tags