in flow/src/java/org/apache/struts/flow/core/source/impl/URLSource.java [147:205]
protected void getInfos()
{
// exists will be set below depending on the m_url type
m_exists = false;
if (!m_isPost)
{
try
{
if (null == m_connection)
{
m_connection = m_url.openConnection();
String userInfo = getUserInfo();
if (m_url.getProtocol().startsWith("http") && userInfo != null){
m_connection.setRequestProperty("Authorization", "Basic " + SourceUtil.encodeBASE64(userInfo));
}
}
setLastModified(m_connection.getLastModified());
m_mimeType = m_connection.getContentType();
int contentLength = m_connection.getContentLength();
setContentLength(contentLength);
if ( m_connection instanceof HttpURLConnection )
{
// check the status code for exists
// if the url does not exists we might also get an IOException here!
try
{
final int statusCode = ((HttpURLConnection)m_connection).getResponseCode();
if ( statusCode == 200 || statusCode == 304 )
{
m_exists = true;
}
else
{
m_exists = false;
}
}
catch (IOException ignore)
{
m_exists = false;
}
}
else
{
m_exists = contentLength > 0;
}
}
catch (IOException ignore)
{
super.getInfos();
}
}
else
{
// do not open m_connection when using post!
super.getInfos();
}
}