public void doLink( HttpServletRequest request, HttpServletResponse response )
throws IOException, ServletException, ConfigException {
String sessionName = request.getParameter( Constants.FILE );
TestDefinition test = getTest( sessionName );
WebappConfig config = TestRecorderFilter.instance().getWebapp();
try {
if ( test == null ) {
String msg = "No test was found for name( " + sessionName + " )";
forward( request, response, msg, Constants.ERROR_PAGE, true );
return;
}
File recFile = getRecordSessionFile( test );
if ( !recFile.exists() ) {
String msg = "No file was found for test( " + test.getName() + " ), file( " +
recFile.getAbsolutePath() + " )";
forward( request, response, msg, Constants.ERROR_PAGE, true );
return;
}
RecordSessionBean bean = null;
try {
bean = XMLHelper.getRecordSessionBean( recFile );
}
catch ( SessionXMLException e ) {
String msg = "Failed processing file for record session( " + test.getName() + " ), file( " +
recFile.getAbsolutePath() + " )";
forward( request, response, msg, Constants.ERROR_PAGE, true );
return;
}
RequestData rd = bean.getRequestData( 0 );
if ( rd == null ) {
String msg = "Unable to find the first request in the test ( " + test.getName() + " ), file( " +
recFile.getAbsolutePath() + " )";
forward( request, response, msg, Constants.ERROR_PAGE, true );
return;
}
String host = config.getServer().getHostname();
if ( host.equals( "localhost" ) )
{
host = request.getServerName();
}
response.sendRedirect( rd.getUri( host, config.getServer().getPort() ) );
return;
}
catch ( Exception e ) {
String msg = "ERROR: failed to display test details, exception( " + e.getMessage() +
" ), test( " + test.getName() + " )";