use of net.sourceforge.processdash.net.http.WebServer in project processdash by dtuma.
the class TeamStartBootstrap method testContinuation.
/** Attempt to open the continuation page, to make certain it will
* succeed when the user visits it in their browser.
*
* @return an error message if the page cannot be opened, null if
* all is well.
*/
private String testContinuation(String prefix, String continuationURI) {
if (prefix != null)
continuationURI = WebServer.urlEncodePath(prefix) + "/" + continuationURI;
try {
WebServer ws = getTinyWebServer();
String continuationURL = "http://" + ws.getHostName(false) + ":" + ws.getPort() + continuationURI;
URL u = new URL(continuationURL);
logger.finer("Testing continuation URL " + continuationURL);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
conn.connect();
int status = conn.getResponseCode();
if (status == 200)
return null;
logger.warning("Received response code of " + status + " for " + continuationURL);
} catch (Exception e) {
logger.log(Level.WARNING, "Received exception when contacting " + continuationURI, e);
}
return resources.getString("Errors.Cannot_Use_Process");
}
Aggregations