private String getHostName(InetSocketAddress address) { return configuration.getAsBoolean(ConfigKey.ALLOW_DNS_REVERSE_LOOKUP) ? address.getHostName() : null; }
private boolean listenForDiscoveryMcRequests(Configuration pConfig) { // Check for system props, system env and agent config boolean sysProp = System.getProperty("jolokia." + ConfigKey.DISCOVERY_ENABLED.getKeyValue()) != null; boolean env = System.getenv("JOLOKIA_DISCOVERY") != null; boolean config = pConfig.getAsBoolean(ConfigKey.DISCOVERY_ENABLED); return sysProp || env || config; } /**
private void addErrorInfo(JSONObject pErrorResp, Throwable pExp, JmxRequest pJmxReq) { if (config.getAsBoolean(ConfigKey.ALLOW_ERROR_DETAILS)) { String includeStackTrace = pJmxReq != null ? pJmxReq.getParameter(ConfigKey.INCLUDE_STACKTRACE) : "true"; if (includeStackTrace.equalsIgnoreCase("true") || (includeStackTrace.equalsIgnoreCase("runtime") && pExp instanceof RuntimeException)) { StringWriter writer = new StringWriter(); pExp.printStackTrace(new PrintWriter(writer)); pErrorResp.put("stacktrace", writer.toString()); } if (pJmxReq != null && pJmxReq.getParameterAsBool(ConfigKey.SERIALIZE_EXCEPTION)) { pErrorResp.put("error_value", backendManager.convertExceptionToJson(pExp, pJmxReq)); } } }
private void sendResponse(HttpExchange pExchange, ParsedUri pParsedUri, JSONAware pJson) throws IOException { boolean streaming = configuration.getAsBoolean(ConfigKey.STREAMING); if (streaming) { JSONStreamAware jsonStream = (JSONStreamAware)pJson; sendStreamingResponse(pExchange, pParsedUri, jsonStream); } else { // Fallback, send as one object // TODO: Remove for 2.0 sendAllJSON(pExchange, pParsedUri, pJson); } }
jolokiaConfig.get(ConfigKey.AUTH_URL), jolokiaConfig.get(ConfigKey.AUTH_PRINCIPAL_SPEC), jolokiaConfig.getAsBoolean(ConfigKey.AUTH_IGNORE_CERTS))); } else { throw new IllegalArgumentException("No auth method '" + authMode + "' known. " +
allowDnsReverseLookup = config.getAsBoolean(ConfigKey.ALLOW_DNS_REVERSE_LOOKUP); streamingEnabled = config.getAsBoolean(ConfigKey.STREAMING);
private void initMBeans(Configuration pConfig) { int maxEntries = pConfig.getAsInt(HISTORY_MAX_ENTRIES); int maxDebugEntries = pConfig.getAsInt(DEBUG_MAX_ENTRIES); historyStore = new HistoryStore(maxEntries); debugStore = new DebugStore(maxDebugEntries, pConfig.getAsBoolean(DEBUG)); try { localDispatcher.initMBeans(historyStore, debugStore); } catch (NotCompliantMBeanException e) { intError("Error registering config MBean: " + e, e); } catch (MBeanRegistrationException e) { intError("Cannot register MBean: " + e, e); } catch (MalformedObjectNameException e) { intError("Invalid name for config MBean: " + e, e); } }
private boolean listenForDiscoveryMcRequests(Configuration pConfig) { // Check for system props, system env and agent config boolean sysProp = System.getProperty("jolokia." + ConfigKey.DISCOVERY_ENABLED.getKeyValue()) != null; boolean env = System.getenv("JOLOKIA_DISCOVERY") != null; boolean config = pConfig.getAsBoolean(ConfigKey.DISCOVERY_ENABLED); return sysProp || env || config; } /**
private boolean listenForDiscoveryMcRequests(Configuration pConfig) { // Check for system props, system env and agent config boolean sysProp = System.getProperty("jolokia." + ConfigKey.DISCOVERY_ENABLED.getKeyValue()) != null; boolean env = System.getenv("JOLOKIA_DISCOVERY") != null; boolean config = pConfig.getAsBoolean(ConfigKey.DISCOVERY_ENABLED); return sysProp || env || config; } /**
private void addErrorInfo(JSONObject pErrorResp, Throwable pExp, JmxRequest pJmxReq) { if (config.getAsBoolean(ConfigKey.ALLOW_ERROR_DETAILS)) { String includeStackTrace = pJmxReq != null ? pJmxReq.getParameter(ConfigKey.INCLUDE_STACKTRACE) : "true"; if (includeStackTrace.equalsIgnoreCase("true") || (includeStackTrace.equalsIgnoreCase("runtime") && pExp instanceof RuntimeException)) { StringWriter writer = new StringWriter(); pExp.printStackTrace(new PrintWriter(writer)); pErrorResp.put("stacktrace", writer.toString()); } if (pJmxReq != null && pJmxReq.getParameterAsBool(ConfigKey.SERIALIZE_EXCEPTION)) { pErrorResp.put("error_value", backendManager.convertExceptionToJson(pExp, pJmxReq)); } } }
private void addErrorInfo(JSONObject pErrorResp, Throwable pExp, JmxRequest pJmxReq) { if (config.getAsBoolean(ConfigKey.ALLOW_ERROR_DETAILS)) { String includeStackTrace = pJmxReq != null ? pJmxReq.getParameter(ConfigKey.INCLUDE_STACKTRACE) : "true"; if (includeStackTrace.equalsIgnoreCase("true") || (includeStackTrace.equalsIgnoreCase("runtime") && pExp instanceof RuntimeException)) { StringWriter writer = new StringWriter(); pExp.printStackTrace(new PrintWriter(writer)); pErrorResp.put("stacktrace", writer.toString()); } if (pJmxReq != null && pJmxReq.getParameterAsBool(ConfigKey.SERIALIZE_EXCEPTION)) { pErrorResp.put("error_value", backendManager.convertExceptionToJson(pExp, pJmxReq)); } } }
allowDnsReverseLookup = config.getAsBoolean(ConfigKey.ALLOW_DNS_REVERSE_LOOKUP); streamingEnabled = config.getAsBoolean(ConfigKey.STREAMING);
allowDnsReverseLookup = config.getAsBoolean(ConfigKey.ALLOW_DNS_REVERSE_LOOKUP); streamingEnabled = config.getAsBoolean(ConfigKey.STREAMING);
private void initMBeans(Configuration pConfig) { int maxEntries = pConfig.getAsInt(HISTORY_MAX_ENTRIES); int maxDebugEntries = pConfig.getAsInt(DEBUG_MAX_ENTRIES); historyStore = new HistoryStore(maxEntries); debugStore = new DebugStore(maxDebugEntries, pConfig.getAsBoolean(DEBUG)); try { localDispatcher.initMBeans(historyStore, debugStore); } catch (NotCompliantMBeanException e) { intError("Error registering config MBean: " + e, e); } catch (MBeanRegistrationException e) { intError("Cannot register MBean: " + e, e); } catch (MalformedObjectNameException e) { intError("Invalid name for config MBean: " + e, e); } }
private void initMBeans(Configuration pConfig) { int maxEntries = pConfig.getAsInt(HISTORY_MAX_ENTRIES); int maxDebugEntries = pConfig.getAsInt(DEBUG_MAX_ENTRIES); historyStore = new HistoryStore(maxEntries); debugStore = new DebugStore(maxDebugEntries, pConfig.getAsBoolean(DEBUG)); try { localDispatcher.initMBeans(historyStore, debugStore); } catch (NotCompliantMBeanException e) { intError("Error registering config MBean: " + e, e); } catch (MBeanRegistrationException e) { intError("Cannot register MBean: " + e, e); } catch (MalformedObjectNameException e) { intError("Invalid name for config MBean: " + e, e); } }