public class RestListener extends PushingListenerAdapter implements HasPhysicalDestination, HasSpecialDefaultValues
Receiver
to receive messages as a REST webservice.
Prepends the configured URI pattern with rest/
. When you are writing a new Frank config, you are recommended
to use an ApiListener
instead. You can find all serviced URI patterns
in the Frank!Console: main menu item Webservice, heading Available REST Services.
Note:
Servlets' multipart configuration expects a Content-Type of multipart/form-data
(see http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/MultipartConfig.html).
So do not use other multipart content types like multipart/related
Modifier and Type | Class and Description |
---|---|
static class |
RestListener.MediaTypes |
log
Constructor and Description |
---|
RestListener() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close all resources used for listening.
|
void |
configure()
initialize listener and register
this to the JNDI |
String |
getPhysicalDestinationName() |
String |
getRestUriPattern() |
Object |
getSpecialDefaultValue(String attributeName,
Object defaultValue,
Map<String,String> attributes) |
boolean |
isView() |
void |
open()
Prepares the listener for receiving messages.
|
Message |
processRequest(Message message,
PipeLineSession session)
Method to implement for processing a request.
|
void |
setAuthRoles(String string)
Comma separated list of authorization roles which are granted for this rest service
|
void |
setConsumes(RestListener.MediaTypes consumes)
Mediatype (e.g.
|
void |
setContentTypeSessionKey(String contentTypeSessionKey)
Key of Session variable that determines requested content type, overrides
produces |
void |
setEtagSessionKey(String etagSessionKey)
Key of session variable to store etag
|
void |
setGenerateEtag(boolean b)
If set to true the ibis will automatically create an etag
|
void |
setMethod(String method)
Method (e.g.
|
void |
setProduces(RestListener.MediaTypes produces)
Mediatype (e.g.
|
void |
setRestPath(String restPath)
Can be either
/rest or /rest-public and must correspond with the available RestListenerServlet path(s). |
void |
setRetrieveMultipart(boolean b)
Indicates whether the parts of a multipart entity should be retrieved and put in session keys.
|
void |
setUriPattern(String uriPattern)
Uri pattern to match, the {uri} part in https://mydomain.com/ibis4something/rest/{uri}, where mydomain.com and ibis4something refer to 'your ibis'.
|
void |
setValidateEtag(boolean b)
If set to true the ibis will automatically validate and process etags
|
void |
setView(boolean b)
Indicates whether this listener supports a view (and a link should be put in the ibis console)
|
void |
setWriteSecLogMessage(boolean b) |
void |
setWriteToSecLog(boolean b) |
Message |
transformToJson(Message message) |
Message |
transformToXml(Message message) |
afterMessageProcessed, extractMessage, setApplicationFaultsAsExceptions, setExceptionListener, setHandler, setName, setRunning, toString, wrapRawMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDomain
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 Message transformToJson(Message message) throws PipeRunException
PipeRunException
public Message transformToXml(Message message) throws PipeRunException
PipeRunException
public Object getSpecialDefaultValue(String attributeName, Object defaultValue, Map<String,String> attributes)
getSpecialDefaultValue
in interface HasSpecialDefaultValues
public String getPhysicalDestinationName()
getPhysicalDestinationName
in interface HasPhysicalDestination
public String getRestUriPattern()
public void setUriPattern(String uriPattern)
public void setMethod(String method)
public void setEtagSessionKey(String etagSessionKey)
public void setContentTypeSessionKey(String contentTypeSessionKey)
produces
public void setRestPath(String restPath)
/rest
or /rest-public
and must correspond with the available RestListenerServlet path(s).public void setView(boolean b)
method=get
then true
, else false
public boolean isView()
public void setAuthRoles(String string)
public void setWriteToSecLog(boolean b)
public void setWriteSecLogMessage(boolean b)
public void setRetrieveMultipart(boolean b)
public void setConsumes(RestListener.MediaTypes consumes)
RestServiceDispatcher
receives as inputpublic void setProduces(RestListener.MediaTypes produces)
RestServiceDispatcher
sends as output, if set to json the ibis will automatically try to convert the xml messagepublic void setValidateEtag(boolean b)
public void setGenerateEtag(boolean b)
Copyright © 2023 Frank!Framework. All rights reserved.