Skip to content

Commit da97ab5

Browse files
committed
8253474: Javadoc clean up in HttpsExchange, HttpsParameters, and HttpsServer
Reviewed-by: dfuchs, michaelm
1 parent 7e26404 commit da97ab5

File tree

3 files changed

+103
-108
lines changed

3 files changed

+103
-108
lines changed

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsExchange.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,27 @@
2525

2626
package com.sun.net.httpserver;
2727

28-
import java.io.*;
29-
import java.nio.*;
30-
import java.nio.channels.*;
31-
import java.net.*;
32-
import javax.net.ssl.*;
33-
import java.util.*;
28+
import javax.net.ssl.SSLSession;
3429

3530
/**
36-
* This class encapsulates a HTTPS request received and a
37-
* response to be generated in one exchange and defines
38-
* the extensions to HttpExchange that are specific to the HTTPS protocol.
31+
* This class encapsulates a HTTPS request received and a response to be
32+
* generated in one exchange and defines the extensions to {@link HttpExchange}
33+
* that are specific to the HTTPS protocol.
34+
*
3935
* @since 1.6
4036
*/
4137

4238
public abstract class HttpsExchange extends HttpExchange {
4339

44-
protected HttpsExchange () {
45-
}
40+
/**
41+
* Constructor for subclasses to call.
42+
*/
43+
protected HttpsExchange() {}
4644

4745
/**
48-
* Get the SSLSession for this exchange.
49-
* @return the SSLSession
46+
* Get the {@link SSLSession} for this exchange.
47+
*
48+
* @return the {@code SSLSession}
5049
*/
51-
public abstract SSLSession getSSLSession ();
50+
public abstract SSLSession getSSLSession();
5251
}

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsParameters.java

Lines changed: 43 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,23 @@
2626
package com.sun.net.httpserver;
2727

2828
import java.net.InetSocketAddress;
29-
30-
//BEGIN_TIGER_EXCLUDE
3129
import javax.net.ssl.SSLParameters;
32-
//END_TIGER_EXCLUDE
3330

3431
/**
35-
* Represents the set of parameters for each https
36-
* connection negotiated with clients. One of these
37-
* is created and passed to
38-
* {@link HttpsConfigurator#configure(HttpsParameters)}
39-
* for every incoming https connection,
40-
* in order to determine the parameters to use.
41-
* <p>
42-
* The underlying SSL parameters may be established either
43-
* via the set/get methods of this class, or else via
44-
* a {@link javax.net.ssl.SSLParameters} object. SSLParameters
45-
* is the preferred method, because in the future,
46-
* additional configuration capabilities may be added to that class, and
47-
* it is easier to determine the set of supported parameters and their
48-
* default values with SSLParameters. Also, if an SSLParameters object is
49-
* provided via
50-
* {@link #setSSLParameters(SSLParameters)} then those parameter settings
51-
* are used, and any settings made in this object are ignored.
32+
* Represents the set of parameters for each https connection negotiated with
33+
* clients. One of these is created and passed to
34+
* {@link HttpsConfigurator#configure(HttpsParameters)} for every incoming https
35+
* connection, in order to determine the parameters to use.
36+
*
37+
* <p> The underlying SSL parameters may be established either via the set/get
38+
* methods of this class, or else via a {@link javax.net.ssl.SSLParameters}
39+
* object. {@code SSLParameters} is the preferred method, because in the future,
40+
* additional configuration capabilities may be added to that class, and it is
41+
* easier to determine the set of supported parameters and their default values
42+
* with SSLParameters. Also, if an {@code SSLParameters} object is provided via
43+
* {@link #setSSLParameters(SSLParameters)} then those parameter settings are
44+
* used, and any settings made in this object are ignored.
45+
*
5246
* @since 1.6
5347
*/
5448
public abstract class HttpsParameters {
@@ -64,41 +58,39 @@ public abstract class HttpsParameters {
6458
protected HttpsParameters() {}
6559

6660
/**
67-
* Returns the HttpsConfigurator for this HttpsParameters.
61+
* Returns the {@link HttpsConfigurator} for this {@code HttpsParameters}.
6862
*
69-
* @return HttpsConfigurator for this instance of HttpsParameters
63+
* @return {@code HttpsConfigurator} for this instance of {@code HttpsParameters}
7064
*/
7165
public abstract HttpsConfigurator getHttpsConfigurator();
7266

7367
/**
74-
* Returns the address of the remote client initiating the
75-
* connection.
68+
* Returns the address of the remote client initiating the connection.
7669
*
77-
* @return Address of the remote client initiating the connection
70+
* @return address of the remote client initiating the connection
7871
*/
7972
public abstract InetSocketAddress getClientAddress();
8073

81-
//BEGIN_TIGER_EXCLUDE
8274
/**
83-
* Sets the SSLParameters to use for this HttpsParameters.
84-
* The parameters must be supported by the SSLContext contained
85-
* by the HttpsConfigurator associated with this HttpsParameters.
75+
* Sets the {@link SSLParameters} to use for this {@code HttpsParameters}.
76+
* The parameters must be supported by the {@link SSLContext} contained
77+
* by the {@link HttpsConfigurator} associated with this {@code HttpsParameters}.
8678
* If no parameters are set, then the default behavior is to use
87-
* the default parameters from the associated SSLContext.
88-
* @param params the SSLParameters to set. If <code>null</code>
89-
* then the existing parameters (if any) remain unchanged.
90-
* @throws IllegalArgumentException if any of the parameters are
91-
* invalid or unsupported.
79+
* the default parameters from the associated {@link SSLContext}.
80+
*
81+
* @param params the {@code SSLParameters} to set. If {@code null} then the
82+
* existing parameters (if any) remain unchanged
83+
* @throws IllegalArgumentException if any of the parameters are invalid or
84+
* unsupported
9285
*/
93-
public abstract void setSSLParameters (SSLParameters params);
94-
//END_TIGER_EXCLUDE
86+
public abstract void setSSLParameters(SSLParameters params);
9587

9688
/**
97-
* Returns a copy of the array of ciphersuites or null if none
89+
* Returns a copy of the array of ciphersuites or {@code null} if none
9890
* have been set.
9991
*
100-
* @return a copy of the array of ciphersuites or null if none
101-
* have been set.
92+
* @return a copy of the array of ciphersuites or {@code null} if none have
93+
* been set
10294
*/
10395
public String[] getCipherSuites() {
10496
return cipherSuites != null ? cipherSuites.clone() : null;
@@ -107,18 +99,18 @@ public String[] getCipherSuites() {
10799
/**
108100
* Sets the array of ciphersuites.
109101
*
110-
* @param cipherSuites the array of ciphersuites (or null)
102+
* @param cipherSuites the array of ciphersuites (or {@code null})
111103
*/
112104
public void setCipherSuites(String[] cipherSuites) {
113105
this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null;
114106
}
115107

116108
/**
117-
* Returns a copy of the array of protocols or null if none
118-
* have been set.
109+
* Returns a copy of the array of protocols or {@code null} if none have been
110+
* set.
119111
*
120-
* @return a copy of the array of protocols or null if none
121-
* have been set.
112+
* @return a copy of the array of protocols or {@code null} if none have been
113+
* set
122114
*/
123115
public String[] getProtocols() {
124116
return protocols != null ? protocols.clone() : null;
@@ -127,7 +119,7 @@ public String[] getProtocols() {
127119
/**
128120
* Sets the array of protocols.
129121
*
130-
* @param protocols the array of protocols (or null)
122+
* @param protocols the array of protocols (or {@code null})
131123
*/
132124
public void setProtocols(String[] protocols) {
133125
this.protocols = protocols != null ? protocols.clone() : null;
@@ -136,15 +128,15 @@ public void setProtocols(String[] protocols) {
136128
/**
137129
* Returns whether client authentication should be requested.
138130
*
139-
* @return whether client authentication should be requested.
131+
* @return whether client authentication should be requested
140132
*/
141133
public boolean getWantClientAuth() {
142134
return wantClientAuth;
143135
}
144136

145137
/**
146-
* Sets whether client authentication should be requested. Calling
147-
* this method clears the <code>needClientAuth</code> flag.
138+
* Sets whether client authentication should be requested. Calling this
139+
* method clears the {@code needClientAuth} flag.
148140
*
149141
* @param wantClientAuth whether client authentication should be requested
150142
*/
@@ -155,15 +147,15 @@ public void setWantClientAuth(boolean wantClientAuth) {
155147
/**
156148
* Returns whether client authentication should be required.
157149
*
158-
* @return whether client authentication should be required.
150+
* @return whether client authentication should be required
159151
*/
160152
public boolean getNeedClientAuth() {
161153
return needClientAuth;
162154
}
163155

164156
/**
165-
* Sets whether client authentication should be required. Calling
166-
* this method clears the <code>wantClientAuth</code> flag.
157+
* Sets whether client authentication should be required. Calling this method
158+
* clears the {@code wantClientAuth} flag.
167159
*
168160
* @param needClientAuth whether client authentication should be required
169161
*/

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,80 +25,84 @@
2525

2626
package com.sun.net.httpserver;
2727

28-
import java.net.*;
29-
import java.io.*;
30-
import java.nio.*;
31-
import java.security.*;
32-
import java.nio.channels.*;
33-
import java.util.*;
34-
import java.util.concurrent.*;
35-
import javax.net.ssl.*;
36-
import com.sun.net.httpserver.spi.*;
28+
import java.io.IOException;
29+
import java.net.BindException;
30+
import java.net.InetSocketAddress;
31+
import com.sun.net.httpserver.spi.HttpServerProvider;
3732

3833
/**
39-
* This class is an extension of {@link HttpServer} which provides
40-
* support for HTTPS. <p>
41-
* A HttpsServer must have an associated {@link HttpsConfigurator} object
34+
* This class is an extension of {@link HttpServer} which provides support for
35+
* HTTPS.
36+
*
37+
* <p>A {@code HttpsServer} must have an associated {@link HttpsConfigurator} object
4238
* which is used to establish the SSL configuration for the SSL connections.
43-
* <p>
44-
* All other configuration is the same as for HttpServer.
39+
*
40+
* <p>All other configuration is the same as for {@code HttpServer}.
41+
*
4542
* @since 1.6
4643
*/
4744

4845
public abstract class HttpsServer extends HttpServer {
4946

5047
/**
48+
* Constructor for subclasses to call.
5149
*/
52-
protected HttpsServer () {
50+
protected HttpsServer() {
5351
}
5452

5553
/**
56-
* creates a HttpsServer instance which is initially not bound to any local address/port.
57-
* The HttpsServer is acquired from the currently installed {@link HttpServerProvider}
58-
* The server must be bound using {@link #bind(InetSocketAddress,int)} before it can be used.
59-
* The server must also have a HttpsConfigurator established with {@link #setHttpsConfigurator(HttpsConfigurator)}
60-
* @throws IOException
54+
* Creates a {@code HttpsServer} instance which is initially not bound to any
55+
* local address/port. The {@code HttpsServer} is acquired from the currently
56+
* installed {@link HttpServerProvider}. The server must be bound using
57+
* {@link #bind(InetSocketAddress,int)} before it can be used. The server
58+
* must also have a {@code HttpsConfigurator} established with
59+
* {@link #setHttpsConfigurator(HttpsConfigurator)}.
60+
*
61+
* @throws IOException if an I/O error occurs
6162
*/
62-
public static HttpsServer create () throws IOException {
63-
return create (null, 0);
63+
public static HttpsServer create() throws IOException {
64+
return create(null, 0);
6465
}
6566

6667
/**
67-
* Create a <code>HttpsServer</code> instance which will bind to the
68-
* specified {@link java.net.InetSocketAddress} (IP address and port number)
68+
* Create a {@code HttpsServer} instance which will bind to the specified
69+
* {@link java.net.InetSocketAddress} (IP address and port number).
6970
*
7071
* A maximum backlog can also be specified. This is the maximum number of
71-
* queued incoming connections to allow on the listening socket.
72-
* Queued TCP connections exceeding this limit may be rejected by the TCP implementation.
73-
* The HttpsServer is acquired from the currently installed {@link HttpServerProvider}
74-
* The server must have a HttpsConfigurator established with {@link #setHttpsConfigurator(HttpsConfigurator)}
72+
* queued incoming connections to allow on the listening socket. Queued TCP
73+
* connections exceeding this limit may be rejected by the TCP implementation.
74+
* The {@code HttpsServer} is acquired from the currently installed
75+
* {@link HttpServerProvider}. The server must have a {@code HttpsConfigurator}
76+
* established with {@link #setHttpsConfigurator(HttpsConfigurator)}.
7577
*
76-
* @param addr the address to listen on, if <code>null</code> then bind() must be called
77-
* to set the address
78-
* @param backlog the socket backlog. If this value is less than or equal to zero,
79-
* then a system default value is used.
78+
* @param addr the address to listen on, if {@code null} then
79+
* {@link #bind(InetSocketAddress,int)} must be called to set
80+
* the address
81+
* @param backlog the socket backlog. If this value is less than or equal to
82+
* zero, then a system default value is used.
8083
* @throws BindException if the server cannot bind to the requested address,
81-
* or if the server is already bound.
82-
* @throws IOException
84+
* or if the server is already bound
85+
* @throws IOException if an I/O error occurs
8386
*/
8487

85-
public static HttpsServer create (
86-
InetSocketAddress addr, int backlog
87-
) throws IOException {
88+
public static HttpsServer create(InetSocketAddress addr, int backlog) throws IOException {
8889
HttpServerProvider provider = HttpServerProvider.provider();
89-
return provider.createHttpsServer (addr, backlog);
90+
return provider.createHttpsServer(addr, backlog);
9091
}
9192

9293
/**
9394
* Sets this server's {@link HttpsConfigurator} object.
94-
* @param config the HttpsConfigurator to set
95-
* @throws NullPointerException if config is null.
95+
*
96+
* @param config the {@code HttpsConfigurator} to set
97+
* @throws NullPointerException if config is {@code null}
9698
*/
97-
public abstract void setHttpsConfigurator (HttpsConfigurator config) ;
99+
public abstract void setHttpsConfigurator(HttpsConfigurator config);
98100

99101
/**
100102
* Gets this server's {@link HttpsConfigurator} object, if it has been set.
101-
* @return the HttpsConfigurator for this server, or <code>null</code> if not set.
103+
*
104+
* @return the {@code HttpsConfigurator} for this server, or {@code null} if
105+
* not set
102106
*/
103-
public abstract HttpsConfigurator getHttpsConfigurator ();
107+
public abstract HttpsConfigurator getHttpsConfigurator();
104108
}

0 commit comments

Comments
 (0)