|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.alfresco.bm.event.AbstractEventProcessor
org.alfresco.bm.http.AuthenticatedHttpEventProcessor
public abstract class AuthenticatedHttpEventProcessor
A base class used for 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 (default) and Ticket-based authentication. In case ticket-based authentication is used, the ticket value is stored on the user data-provider and a new ticket is fetched transparantly when the ticket is expired.
| Field Summary |
|---|
| Fields inherited from class org.alfresco.bm.event.AbstractEventProcessor |
|---|
DEFAULT_WARN_DELAY, logger |
| Constructor Summary | |
|---|---|
AuthenticatedHttpEventProcessor(org.alfresco.http.HttpClientProvider httpClientProvider,
org.alfresco.http.AuthenticationDetailsProvider authDetailProvider,
String baseUrl)
|
|
| Method Summary | ||
|---|---|---|
protected
|
executeHttpMethodAsAdmin(org.apache.http.client.methods.HttpRequestBase request,
org.alfresco.http.HttpRequestCallback<T> callback)
Execute the given method, authenticated as the Alfresco Administrator. |
|
protected
|
executeHttpMethodAsUser(org.apache.http.client.methods.HttpRequestBase request,
String username,
org.alfresco.http.HttpRequestCallback<T> callback)
Execute the given method, authenticated as the given user. |
|
org.alfresco.http.AuthenticationDetailsProvider |
getAuthDetailProvider()
|
|
String |
getFullUrlForPath(String path)
|
|
org.alfresco.http.HttpClientProvider |
getHttpProvider()
|
|
protected void |
releaseResources(org.apache.http.client.methods.HttpRequestBase request,
org.apache.http.HttpResponse response)
Release resources associated with an HTTP request. |
|
void |
setTicketBasedAuthentication(boolean ticketBasedAuthentication)
Enable ticket-based authentication. |
|
| Methods inherited from class org.alfresco.bm.event.AbstractEventProcessor |
|---|
getWarnDelay, register, setBeanName, setEventName, setEventNames, setRegistry, setWarnDelay |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.alfresco.bm.event.EventProcessor |
|---|
processEvent |
| Constructor Detail |
|---|
public AuthenticatedHttpEventProcessor(org.alfresco.http.HttpClientProvider httpClientProvider,
org.alfresco.http.AuthenticationDetailsProvider authDetailProvider,
String baseUrl)
httpClientProvider - provider class for http-clientauthDetailProvider - provider for authentication detailsbaseUrl - the URL to append to| Method Detail |
|---|
public void setTicketBasedAuthentication(boolean ticketBasedAuthentication)
ticketBasedAuthentication - whether or not to use ticket for
authenticationpublic org.alfresco.http.HttpClientProvider getHttpProvider()
HttpClientProvider used by this class.public org.alfresco.http.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,
org.alfresco.http.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,
org.alfresco.http.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)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||