Package org.apache.camel.component.http
Class LoggingHttpActivityListener
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.component.http.LoggingHttpActivityListener
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,HttpActivityListener,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@Metadata(label="bean",
description="Logs HTTP requests and responses for the camel-http component.",
annotations="interfaceName=org.apache.camel.component.http.HttpActivityListener")
@Configurer(metadataOnly=true)
public class LoggingHttpActivityListener
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.CamelContextAware, HttpActivityListener
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoInit()org.apache.camel.CamelContextintprotected booleanisBinaryData(org.apache.hc.core5.http.ContentType ct) Determine whether the content type is binary or notbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanprotected voidonActivity(org.apache.camel.spi.CamelLogger logger, org.apache.camel.Exchange exchange, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.HttpEntity entity, long elapsed) voidonRequestSubmitted(Object source, org.apache.camel.Exchange exchange, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpEntity entity) HTTP request is about to be sentvoidonResponseReceived(Object source, org.apache.camel.Exchange exchange, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.HttpEntity entity, long elapsed) HTTP response receivedvoidsetCamelContext(org.apache.camel.CamelContext camelContext) voidsetLoggingLevel(String loggingLevel) voidsetLogMask(Boolean logMask) voidsetMaxChars(int maxChars) voidsetMultiline(boolean multiline) voidsetShowBinary(boolean showBinary) voidsetShowBody(boolean showBody) voidsetShowExchangeId(boolean showExchangeId) voidsetShowHeaders(boolean showHeaders) voidsetShowRouteGroup(boolean showRouteGroup) voidsetShowRouteId(boolean showRouteId) voidsetShowStreams(boolean showStreams) voidsetSourceLocationLoggerName(boolean sourceLocationLoggerName) Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
LoggingHttpActivityListener
public LoggingHttpActivityListener()
-
-
Method Details
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
onRequestSubmitted
public void onRequestSubmitted(Object source, org.apache.camel.Exchange exchange, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpEntity entity) Description copied from interface:HttpActivityListenerHTTP request is about to be sent- Specified by:
onRequestSubmittedin interfaceHttpActivityListener- Parameters:
source- the http producer that are usedexchange- the current exchangehost- the host where the request is sent torequest- the http requestentity- the http data
-
onResponseReceived
public void onResponseReceived(Object source, org.apache.camel.Exchange exchange, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.HttpEntity entity, long elapsed) Description copied from interface:HttpActivityListenerHTTP response received- Specified by:
onResponseReceivedin interfaceHttpActivityListener- Parameters:
source- the http producer that are usedexchange- the current exchangehost- the host where the response was received fromresponse- the http responseentity- the http dataelapsed- time in millis before the response was received after sending
-
onActivity
protected void onActivity(org.apache.camel.spi.CamelLogger logger, org.apache.camel.Exchange exchange, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.HttpEntity entity, long elapsed) -
isBinaryData
protected boolean isBinaryData(org.apache.hc.core5.http.ContentType ct) Determine whether the content type is binary or not -
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getLoggingLevel
-
setLoggingLevel
-
isShowRouteId
public boolean isShowRouteId() -
setShowRouteId
public void setShowRouteId(boolean showRouteId) -
isShowRouteGroup
public boolean isShowRouteGroup() -
setShowRouteGroup
public void setShowRouteGroup(boolean showRouteGroup) -
isShowExchangeId
public boolean isShowExchangeId() -
setShowExchangeId
public void setShowExchangeId(boolean showExchangeId) -
isShowBody
public boolean isShowBody() -
setShowBody
public void setShowBody(boolean showBody) -
isShowStreams
public boolean isShowStreams() -
setShowStreams
public void setShowStreams(boolean showStreams) -
isShowBinary
public boolean isShowBinary() -
setShowBinary
public void setShowBinary(boolean showBinary) -
isShowHeaders
public boolean isShowHeaders() -
setShowHeaders
public void setShowHeaders(boolean showHeaders) -
getLogMask
-
setLogMask
-
getMaxChars
public int getMaxChars() -
setMaxChars
public void setMaxChars(int maxChars) -
isMultiline
public boolean isMultiline() -
setMultiline
public void setMultiline(boolean multiline) -
isSourceLocationLoggerName
public boolean isSourceLocationLoggerName() -
setSourceLocationLoggerName
public void setSourceLocationLoggerName(boolean sourceLocationLoggerName)
-