public class ApiListener extends PushingListenerAdapter implements HasPhysicalDestination, ReceiverAware<String>
Receiver
to receive messages as a REST webservice.
Prepends the configured URI pattern with api/
. The structure of REST messages is described
by OpenAPI specifications. The Frank!Framework generates an OpenAPI specification for each ApiListener and
also an OpenAPI specification for all ApiListeners in all configurations. You can
find them in the Frank!Console under main menu item Webservices, heading Available ApiListeners.
The generated OpenAPI specifications have servers
and paths
objects and
therefore they document the full URLs of the provided services.Modifier and Type | Class and Description |
---|---|
static class |
ApiListener.AuthenticationMethods |
static class |
ApiListener.HttpMethod |
log
Constructor and Description |
---|
ApiListener() |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(String acceptHeader)
Match request 'Accept' header to produces enum to see if the client accepts the message
|
void |
close()
Close all resources used for listening.
|
void |
configure()
initialize listener and register
this to the JNDI |
List<String> |
getAuthenticationRoleList() |
String |
getCleanPattern()
returns the clear pattern, replaces everything between
{} to * |
String |
getMultipartBodyName() |
boolean |
isConsumable(String contentType)
Match request 'Content-Type' (eg.
|
void |
open()
Prepares the listener for receiving messages.
|
Message |
processRequest(Message message,
PipeLineSession session)
Method to implement for processing a request.
|
void |
setAuthenticationMethod(ApiListener.AuthenticationMethods authenticationMethod)
Enables security for this listener.
|
void |
setAuthenticationRoles(String authRoles)
Only active when AuthenticationMethod=AUTHROLE.
|
void |
setCharacterEncoding(String charset)
The specified character encoding on the response contentType header.
|
void |
setConsumes(MediaTypes value)
The required contentType on requests, if it doesn't match the request will fail
|
void |
setContentDispositionHeaderSessionKey(String key)
Session key that provides the Content-Disposition header in the response
|
void |
setCorrelationIdHeader(String correlationIdHeader)
Name of the header which contains the Correlation-Id.
|
void |
setExactMatchClaims(String string)
Comma separated key value pairs to match with JWT payload.
|
void |
setHeaderParams(String headerParams)
Comma separated list of parameters passed as http header.
|
void |
setJwksURL(String string)
Keysource URL to validate JWT
|
void |
setJwtHeader(String string)
Header to extract JWT from
|
void |
setMessageIdHeader(String messageIdHeader)
Name of the header which contains the Message-Id.
|
void |
setMethod(ApiListener.HttpMethod method)
HTTP method to listen to
|
void |
setMultipartBodyName(String multipartBodyName)
Specify the form-part you wish to enter the pipeline
|
void |
setOperationId(String operationId)
Unique string used to identify the operation.
|
void |
setPrincipalNameClaim(String principalNameClaim)
Claim name which specifies the principal name (maps to GetPrincipalPipe)
|
void |
setProduces(MediaTypes value)
The specified contentType on response.
|
void |
setRequiredClaims(String string)
Comma separated list of required claims
|
void |
setRequiredIssuer(String issuer)
Issuer to validate JWT
|
void |
setRoleClaim(String roleClaim)
Claim name which specifies the role
|
void |
setUpdateEtag(boolean updateEtag)
Automatically generate and validate etags
|
void |
setUriPattern(String uriPattern)
URI pattern to register this listener on, eq.
|
String |
toString() |
afterMessageProcessed, extractMessage, setApplicationFaultsAsExceptions, setExceptionListener, setHandler, setName, setRunning, wrapRawMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDomain, getPhysicalDestinationName
getReceiver, setReceiver
getName
getApplicationContext, getName
getConfigurationClassLoader
public void configure() throws ConfigurationException
this
to the JNDIconfigure
in interface IConfigurable
configure
in interface IListener<Message>
configure
in class PushingListenerAdapter
ConfigurationException
public void open() throws ListenerException
IListener
open()
is called once each time the listener is started.open
in interface IListener<Message>
open
in class PushingListenerAdapter
ListenerException
public void close()
IListener
close
in interface IListener<Message>
close
in class PushingListenerAdapter
public Message processRequest(Message message, PipeLineSession session) throws ListenerException
ServiceClient
IListener
implementation.
processRequest
in interface ServiceClient
processRequest
in class PushingListenerAdapter
message
- Message
to processsession
- PipeLineSession
of the request. If the request has a correlation ID, it should be put into this session.Message
.ListenerException
- Thrown if an exception occurs.public String getCleanPattern()
{}
to *
public boolean isConsumable(@Nullable String contentType)
public boolean accepts(@Nullable String acceptHeader)
public void setMethod(ApiListener.HttpMethod method)
public void setUriPattern(String uriPattern)
public void setConsumes(@Nonnull MediaTypes value)
public void setProduces(@Nonnull MediaTypes value)
ANY
the response will determine the content type based on the return data.public void setCharacterEncoding(String charset)
public void setUpdateEtag(boolean updateEtag)
false
, can be changed by setting the property api.etag.enabled
.public void setAuthenticationMethod(ApiListener.AuthenticationMethods authenticationMethod)
NONE
public void setAuthenticationRoles(String authRoles)
public void setMultipartBodyName(String multipartBodyName)
public String getMultipartBodyName()
@Default(value="Message-Id") public void setMessageIdHeader(String messageIdHeader)
@Default(value="Correlation-Id") public void setCorrelationIdHeader(String correlationIdHeader)
public void setOperationId(String operationId)
public void setHeaderParams(String headerParams)
public void setContentDispositionHeaderSessionKey(String key)
public void setRequiredIssuer(String issuer)
public void setJwksURL(String string)
public void setJwtHeader(String string)
public void setRequiredClaims(String string)
public void setExactMatchClaims(String string)
public void setRoleClaim(String roleClaim)
public void setPrincipalNameClaim(String principalNameClaim)
public String toString()
toString
in class PushingListenerAdapter
Copyright © 2023 Frank!Framework. All rights reserved.