private void createFileCache(Http h) throws PropertyVetoException { while (true) { try { if (parser.next() == START_ELEMENT) { if (parser.getLocalName().equals("file-cache") && h != null) { FileCache fc = h.createChild(FileCache.class); h.setFileCache(fc); for (int i = 0; i < parser.getAttributeCount(); i++) { String attr = parser.getAttributeLocalName(i); String val = parser.getAttributeValue(i); if (attr.equals("enabled")) { fc.setEnabled(val); } } break; } } } catch (TransactionFailure ex) { logger.log( Level.SEVERE, failureCreatingFileCacheConfig, ex); } catch (XMLStreamException ex) { logger.log( Level.SEVERE, problemParsingFileCacheElement, ex); } } }
public Object run(Protocols param) throws TransactionFailure { final Protocol protocol = param.createChild(Protocol.class); param.getProtocol().add(protocol); protocol.setName(ASADMIN_LISTENER); Http http = protocol.createChild(Http.class); http.setFileCache(http.createChild(FileCache.class)); protocol.setHttp(http); http.setDefaultVirtualServer(ASADMIN_VIRTUAL_SERVER); http.setMaxConnections("250"); return protocol; } }, protocols);
private Http writeableHttpWithFileCacheChild(final Transaction t, final Protocol secAdminListenerProtocol_w) throws TransactionFailure { /* * Because of the calling context, the secAdminListenerProtocol is already * writeable -- it was just created moments ago and has not yet * been committed. */ Http http_w; Http http = secAdminListenerProtocol_w.getHttp(); if (http == null) { http_w = secAdminListenerProtocol_w.createChild(Http.class); secAdminListenerProtocol_w.setHttp(http_w); } else { http_w = t.enroll(http); } http_w.setDefaultVirtualServer(ASADMIN_VIRTUAL_SERVER_NAME); http_w.setEncodedSlashEnabled("true"); final FileCache cache = http_w.createChild(FileCache.class); // cache.setEnabled("false"); http_w.setFileCache(cache); return http_w; }