in tomcat-maven-plugin-it/src/main/java/org/apache/tomcat/maven/it/AbstractWarProjectIT.java [157:190]
private String getResponseBody( int timeout )
{
String responseBody = null;
final long startTime = System.currentTimeMillis();
final long endTime = startTime + timeout;
long currentTime = System.currentTimeMillis();
try
{
while ( pingUrl() != 200 && currentTime < endTime )
{
logger.debug( "Ping..." );
Thread.sleep( 500 );
currentTime = System.currentTimeMillis();
}
if ( currentTime < endTime )
{
responseBody = getResponseBody();
logger.debug( "Received: " + responseBody );
}
else
{
logger.error( "Timeout met while trying to access web application." );
}
}
catch ( IOException e )
{
logger.error( "Exception while trying to access web application.", e );
}
catch ( InterruptedException e )
{
logger.error( "Exception while trying to access web application.", e );
}
return responseBody;
}