本文整理汇总了Java中sun.net.ProgressSource类的典型用法代码示例。如果您正苦于以下问题:Java ProgressSource类的具体用法?Java ProgressSource怎么用?Java ProgressSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressSource类属于sun.net包,在下文中一共展示了ProgressSource类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MeteredStream
import sun.net.ProgressSource; //导入依赖的package包/类
public MeteredStream(InputStream is, ProgressSource pi, long expected)
{
super(is);
this.pi = pi;
this.expected = expected;
if (pi != null) {
pi.updateProgress(0, expected);
}
}
示例2: parseHTTP
import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request. It usually looks
something like: "HTTP/1.0 <number> comment\r\n". */
public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
/* If "HTTP/*" is found in the beginning, return true. Let
* HttpURLConnection parse the mime header itself.
*
* If this isn't valid HTTP, then we don't try to parse a header
* out of the beginning of the response into the responses,
* and instead just queue up the output stream to it's very beginning.
* This seems most reasonable, and is what the NN browser does.
*/
try {
serverInput = serverSocket.getInputStream();
if (capture != null) {
serverInput = new HttpCaptureInputStream(serverInput, capture);
}
serverInput = new BufferedInputStream(serverInput);
return (parseHTTPHeader(responses, pi, httpuc));
} catch (SocketTimeoutException stex) {
// We don't want to retry the request when the app. sets a timeout
// but don't close the server if timeout while waiting for 100-continue
if (ignoreContinue) {
closeServer();
}
throw stex;
} catch (IOException e) {
closeServer();
cachedHttpClient = false;
if (!failedOnce && requests != null) {
failedOnce = true;
if (getRequestMethod().equals("CONNECT")
|| streaming
|| (httpuc.getRequestMethod().equals("POST")
&& !retryPostProp)) {
// do not retry the request
} else {
// try once more
openServer();
if (needsTunneling()) {
MessageHeader origRequests = requests;
httpuc.doTunneling();
requests = origRequests;
}
afterConnect();
writeRequests(requests, poster);
return parseHTTP(responses, pi, httpuc);
}
}
throw e;
}
}
示例3: KeepAliveStream
import sun.net.ProgressSource; //导入依赖的package包/类
/**
* Constructor
*/
public KeepAliveStream(InputStream is, ProgressSource pi, long expected, HttpClient hc) {
super(is, pi, expected);
this.hc = hc;
}
示例4: parseHTTP
import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request. It usually looks
something like: {@literal "HTTP/1.0 <number> comment\r\n"}. */
public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
/* If "HTTP/*" is found in the beginning, return true. Let
* HttpURLConnection parse the mime header itself.
*
* If this isn't valid HTTP, then we don't try to parse a header
* out of the beginning of the response into the responses,
* and instead just queue up the output stream to it's very beginning.
* This seems most reasonable, and is what the NN browser does.
*/
try {
serverInput = serverSocket.getInputStream();
if (capture != null) {
serverInput = new HttpCaptureInputStream(serverInput, capture);
}
serverInput = new BufferedInputStream(serverInput);
return (parseHTTPHeader(responses, pi, httpuc));
} catch (SocketTimeoutException stex) {
// We don't want to retry the request when the app. sets a timeout
// but don't close the server if timeout while waiting for 100-continue
if (ignoreContinue) {
closeServer();
}
throw stex;
} catch (IOException e) {
closeServer();
cachedHttpClient = false;
if (!failedOnce && requests != null) {
failedOnce = true;
if (getRequestMethod().equals("CONNECT")
|| streaming
|| (httpuc.getRequestMethod().equals("POST")
&& !retryPostProp)) {
// do not retry the request
} else {
// try once more
openServer();
if (needsTunneling()) {
MessageHeader origRequests = requests;
httpuc.doTunneling();
requests = origRequests;
}
afterConnect();
writeRequests(requests, poster);
return parseHTTP(responses, pi, httpuc);
}
}
throw e;
}
}
示例5: parseHTTP
import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request. It usually looks
something like: "HTTP/1.0 <number> comment\r\n". */
public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
/* If "HTTP/*" is found in the beginning, return true. Let
* HttpURLConnection parse the mime header itself.
*
* If this isn't valid HTTP, then we don't try to parse a header
* out of the beginning of the response into the responses,
* and instead just queue up the output stream to it's very beginning.
* This seems most reasonable, and is what the NN browser does.
*/
try {
serverInput = serverSocket.getInputStream();
if (capture != null) {
serverInput = new HttpCaptureInputStream(serverInput, capture);
}
serverInput = new BufferedInputStream(serverInput);
return (parseHTTPHeader(responses, pi, httpuc));
} catch (SocketTimeoutException stex) {
// We don't want to retry the request when the app. sets a timeout
// but don't close the server if timeout while waiting for 100-continue
if (ignoreContinue) {
closeServer();
}
throw stex;
} catch (IOException e) {
closeServer();
cachedHttpClient = false;
if (!failedOnce && requests != null) {
failedOnce = true;
if (httpuc.getRequestMethod().equals("POST") && (!retryPostProp || streaming)) {
// do not retry the request
} else {
// try once more
openServer();
if (needsTunneling()) {
httpuc.doTunneling();
}
afterConnect();
writeRequests(requests, poster);
return parseHTTP(responses, pi, httpuc);
}
}
throw e;
}
}
示例6: parseHTTP
import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request. It usually looks
something like: "HTTP/1.0 <number> comment\r\n". */
public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
/* If "HTTP/*" is found in the beginning, return true. Let
* HttpURLConnection parse the mime header itself.
*
* If this isn't valid HTTP, then we don't try to parse a header
* out of the beginning of the response into the responses,
* and instead just queue up the output stream to it's very beginning.
* This seems most reasonable, and is what the NN browser does.
*/
try {
serverInput = serverSocket.getInputStream();
if (capture != null) {
serverInput = new HttpCaptureInputStream(serverInput, capture);
}
serverInput = new BufferedInputStream(serverInput);
return (parseHTTPHeader(responses, pi, httpuc));
} catch (SocketTimeoutException stex) {
// We don't want to retry the request when the app. sets a timeout
// but don't close the server if timeout while waiting for 100-continue
if (ignoreContinue) {
closeServer();
}
throw stex;
} catch (IOException e) {
closeServer();
cachedHttpClient = false;
if (!failedOnce && requests != null) {
failedOnce = true;
if (getRequestMethod().equals("CONNECT") ||
(httpuc.getRequestMethod().equals("POST") &&
(!retryPostProp || streaming))) {
// do not retry the request
} else {
// try once more
openServer();
if (needsTunneling()) {
httpuc.doTunneling();
}
afterConnect();
writeRequests(requests, poster);
return parseHTTP(responses, pi, httpuc);
}
}
throw e;
}
}
示例7: parseHTTP
import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request. It usually looks
something like: "HTTP/1.0 <number> comment\r\n". */
public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
/* If "HTTP/*" is found in the beginning, return true. Let
* HttpURLConnection parse the mime header itself.
*
* If this isn't valid HTTP, then we don't try to parse a header
* out of the beginning of the response into the responses,
* and instead just queue up the output stream to it's very beginning.
* This seems most reasonable, and is what the NN browser does.
*/
try {
serverInput = serverSocket.getInputStream();
if (capture != null) {
serverInput = new HttpCaptureInputStream(serverInput, capture);
}
serverInput = new BufferedInputStream(serverInput);
return (parseHTTPHeader(responses, pi, httpuc));
} catch (SocketTimeoutException stex) {
// We don't want to retry the request when the app. sets a timeout
// but don't close the server if timeout while waiting for 100-continue
if (ignoreContinue) {
closeServer();
}
throw stex;
} catch (IOException e) {
closeServer();
cachedHttpClient = false;
if (!failedOnce && requests != null) {
failedOnce = true;
if (getRequestMethod().equals("CONNECT") ||
(httpuc.getRequestMethod().equals("POST") &&
(!retryPostProp || streaming))) {
// do not retry the request
} else {
// try once more
openServer();
if (needsTunneling()) {
MessageHeader origRequests = requests;
httpuc.doTunneling();
requests = origRequests;
}
afterConnect();
writeRequests(requests, poster);
return parseHTTP(responses, pi, httpuc);
}
}
throw e;
}
}