}
@SuppressWarnings("unchecked")
public void parse(DeploymentUnit unit, Object dataObj) throws Exception {
RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
if (rackAppMetaData == null) {
rackAppMetaData = new RackMetaData();
rackAppMetaData.attachTo( unit );
}
Map<String, Object> webData = (Map<String, Object>) dataObj;
rackAppMetaData.setContextPath( (String) webData.get( "context" ) );
rackAppMetaData.setStaticPathPrefix( (String) webData.get( "static" ) );
if (webData.get( "rackup" ) != null) {
rackAppMetaData.setRackUpScriptLocation( (String) webData.get( "rackup" ) );
}
Object hosts = webData.get( "host" );
if (hosts instanceof List) {
List<String> list = (List<String>) hosts;
for (String each : list) {
rackAppMetaData.addHost( each );
}
} else {
rackAppMetaData.addHost( (String) hosts );
}
String timeoutStr = null;
if (webData.containsKey( "session-timeout" )) {
timeoutStr = webData.get( "session-timeout" ).toString();
} else if (webData.containsKey( "session_timeout" )) {
timeoutStr = webData.get( "session_timeout" ).toString();
}
rackAppMetaData.setSessionTimeout( TimeInterval.parseInterval( timeoutStr, TimeUnit.MINUTES ) );
}