/** * Format XML content in a MemoryStream for message. * * @param traceTypeStr Kind of the entry. * @param stream The memory stream. * @return XML log entry as a string. */ public static String formatLogMessageWithXmlContent(String traceTypeStr, ByteArrayOutputStream stream) { try { return formatLogMessage(traceTypeStr, stream.toString()); } catch (Exception e) { return stream.toString(); } }
/** * Logs the specified string to the TraceListener if tracing is enabled. * * @param traceType kind of trace entry * @param logEntry the entry to log * @throws XMLStreamException the XML stream exception * @throws IOException signals that an I/O exception has occurred */ public void traceMessage(TraceFlags traceType, String logEntry) throws XMLStreamException, IOException { if (this.isTraceEnabledFor(traceType)) { String traceTypeStr = traceType.toString(); String logMessage = EwsUtilities.formatLogMessage(traceTypeStr, logEntry); this.traceListener.trace(traceTypeStr, logMessage); } }
/** * Traces the HTTP response headers. * * @param traceType kind of trace entry * @param request the HttpRequest object * @throws XMLStreamException the XML stream exception * @throws IOException signals that an I/O exception has occurred * @throws EWSHttpException the EWS http exception */ private void traceHttpResponseHeaders(TraceFlags traceType, HttpWebRequest request) throws XMLStreamException, IOException, EWSHttpException { if (this.isTraceEnabledFor(traceType)) { String traceTypeStr = traceType.toString(); String headersAsString = EwsUtilities.formatHttpResponseHeaders(request); String logMessage = EwsUtilities.formatLogMessage(traceTypeStr, headersAsString); this.traceListener.trace(traceTypeStr, logMessage); } }
/** * Traces the HTTP request headers. * * @param traceType Kind of trace entry. * @param request The request * @throws EWSHttpException EWS http exception * @throws URISyntaxException URI syntax error * @throws IOException signals that an I/O exception has occurred * @throws XMLStreamException the XML stream exception */ public void traceHttpRequestHeaders(TraceFlags traceType, HttpWebRequest request) throws URISyntaxException, EWSHttpException, XMLStreamException, IOException { if (this.isTraceEnabledFor(traceType)) { String traceTypeStr = traceType.toString(); String headersAsString = EwsUtilities.formatHttpRequestHeaders(request); String logMessage = EwsUtilities.formatLogMessage(traceTypeStr, headersAsString); this.traceListener.trace(traceTypeStr, logMessage); } }
/** * Format XML content in a MemoryStream for message. * * @param traceTypeStr Kind of the entry. * @param stream The memory stream. * @return XML log entry as a string. */ public static String formatLogMessageWithXmlContent(String traceTypeStr, ByteArrayOutputStream stream) { try { return formatLogMessage(traceTypeStr, stream.toString()); } catch (Exception e) { return stream.toString(); } }
/** * Logs the specified string to the TraceListener if tracing is enabled. * * @param traceType kind of trace entry * @param logEntry the entry to log * @throws XMLStreamException the XML stream exception * @throws IOException signals that an I/O exception has occurred */ public void traceMessage(TraceFlags traceType, String logEntry) throws XMLStreamException, IOException { if (this.isTraceEnabledFor(traceType)) { String traceTypeStr = traceType.toString(); String logMessage = EwsUtilities.formatLogMessage(traceTypeStr, logEntry); this.traceListener.trace(traceTypeStr, logMessage); } }
/** * Traces the HTTP response headers. * * @param traceType kind of trace entry * @param request the HttpRequest object * @throws XMLStreamException the XML stream exception * @throws IOException signals that an I/O exception has occurred * @throws EWSHttpException the EWS http exception */ private void traceHttpResponseHeaders(TraceFlags traceType, HttpWebRequest request) throws XMLStreamException, IOException, EWSHttpException { if (this.isTraceEnabledFor(traceType)) { String traceTypeStr = traceType.toString(); String headersAsString = EwsUtilities.formatHttpResponseHeaders(request); String logMessage = EwsUtilities.formatLogMessage(traceTypeStr, headersAsString); this.traceListener.trace(traceTypeStr, logMessage); } }
/** * Traces the HTTP request headers. * * @param traceType Kind of trace entry. * @param request The request * @throws EWSHttpException EWS http exception * @throws URISyntaxException URI syntax error * @throws IOException signals that an I/O exception has occurred * @throws XMLStreamException the XML stream exception */ public void traceHttpRequestHeaders(TraceFlags traceType, HttpWebRequest request) throws URISyntaxException, EWSHttpException, XMLStreamException, IOException { if (this.isTraceEnabledFor(traceType)) { String traceTypeStr = traceType.toString(); String headersAsString = EwsUtilities.formatHttpRequestHeaders(request); String logMessage = EwsUtilities.formatLogMessage(traceTypeStr, headersAsString); this.traceListener.trace(traceTypeStr, logMessage); } }