public abstract class AuthenticatedHttpEventProcessor
extends org.alfresco.bm.driver.event.AbstractEventProcessor
EventProcessors that makes use of HTTP-calls
that should be done when authenticated against Alfresco. Subclasses can just
do the HTTP-call(s) without having to worry about authentication. Use
#executeHttpMethodAuthenticated(HttpRequestBase, String) instead of
using HttpClient manually or
#executeHttpMethodAsAdmin(HttpRequestBase) to run as Alfresco
Administrator.
Supports both BASIC Authentication only.| Constructor and Description |
|---|
AuthenticatedHttpEventProcessor(HttpClientProvider httpClientProvider,
AuthenticationDetailsProvider authDetailProvider,
String baseUrl) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> T |
executeHttpMethodAsAdmin(org.apache.http.client.methods.HttpRequestBase request,
HttpRequestCallback<T> callback)
Execute the given method, authenticated as the Alfresco Administrator.
|
protected <T> T |
executeHttpMethodAsUser(org.apache.http.client.methods.HttpRequestBase request,
String username,
HttpRequestCallback<T> callback)
Execute the given method, authenticated as the given user.
|
AuthenticationDetailsProvider |
getAuthDetailProvider() |
String |
getFullUrlForPath(String path) |
HttpClientProvider |
getHttpProvider() |
protected void |
releaseResources(org.apache.http.client.methods.HttpRequestBase request,
org.apache.http.HttpResponse response)
Release resources associated with an HTTP request.
|
getName, getWarnDelay, isAutoCloseSessionId, isAutoPropagateSessionId, isChart, processEvent, processEvent, register, resumeTimer, setAutoCloseSessionId, setAutoPropagateSessionId, setBeanName, setChart, setEventName, setEventNames, setRegistry, setWarnDelay, stopTimer, suspendTimer, toStringpublic AuthenticatedHttpEventProcessor(HttpClientProvider httpClientProvider, AuthenticationDetailsProvider authDetailProvider, String baseUrl)
httpClientProvider - provider class for http-clientauthDetailProvider - provider for authentication detailsbaseUrl - the URL to append topublic HttpClientProvider getHttpProvider()
HttpClientProvider used by this class.public AuthenticationDetailsProvider getAuthDetailProvider()
AuthenticationDetailsProvider used by this class.public String getFullUrlForPath(String path)
path - relative path of the URL from alfresco host.protected <T> T executeHttpMethodAsUser(org.apache.http.client.methods.HttpRequestBase request,
String username,
HttpRequestCallback<T> callback)
HttpRequestCallback.request - request to executeusername - name of user to authenticate ascallback - called after http-call is executed. When callback
returns, the response stream is closed, so all respose-related
operations should be done in the callback. Can be null.protected <T> T executeHttpMethodAsAdmin(org.apache.http.client.methods.HttpRequestBase request,
HttpRequestCallback<T> callback)
request - request to executecallback - called after http-call is executed. When callback
returns, the response stream is closed, so all respose-related
operations should be done in the callback. Can be null.protected void releaseResources(org.apache.http.client.methods.HttpRequestBase request,
org.apache.http.HttpResponse response)
request - the HTTP request that might have open resources (null allowed)Copyright © 2005–2018 Alfresco Software. All rights reserved.