@SuppressWarnings("unchecked")
@Override
public void init() throws ServletException {
super.init();
ServletContext context = getServletContext();
if ( ( template = (String)getServletContext().getAttribute( "template" ) ) == null &&
( template = getInitParameter( "template" ) ) == null ) template = DEFAULT_TEMPLATE;
queryEngine = (QueryEngine)context.getAttribute( "queryEngine" );
documentCollection = (DocumentCollection)context.getAttribute( "collection" );
titleList = (List<CharSequence>)context.getAttribute( "titleList" );
indexMap = queryEngine.indexMap;
try {
urlEncodedMimeType = URLEncoder.encode( (String)context.getAttribute( "mimeType" ), "UTF-8" );
}
catch ( UnsupportedEncodingException cantHappen ) {
throw new RuntimeException( cantHappen );
}
useUri = context.getAttribute( "uri" ) == Boolean.TRUE;
derelativise = context.getAttribute( "derelativise" ) == Boolean.TRUE;
if ( documentCollection != null ) {
sortedIndex = new Index[ indexMap.size() ];
indexMap.values().toArray( sortedIndex );
Arrays.sort( sortedIndex, new Comparator<Index>() {