Zandero

REST easy events

License

License

GroupId

GroupId

com.zandero
ArtifactId

ArtifactId

rest.events
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Zandero
REST easy events
Source Code Management

Source Code Management

https://github.com/Zandero/rest

Download rest.events

How to add to project

<!-- https://jarcasting.com/artifacts/com.zandero/rest.events/ -->
<dependency>
    <groupId>com.zandero</groupId>
    <artifactId>rest.events</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.zandero/rest.events/
implementation 'com.zandero:rest.events:1.2'
// https://jarcasting.com/artifacts/com.zandero/rest.events/
implementation ("com.zandero:rest.events:1.2")
'com.zandero:rest.events:jar:1.2'
<dependency org="com.zandero" name="rest.events" rev="1.2">
  <artifact name="rest.events" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.zandero', module='rest.events', version='1.2')
)
libraryDependencies += "com.zandero" % "rest.events" % "1.2"
[com.zandero/rest.events "1.2"]

Dependencies

compile (11)

Group / Artifact Type Version
com.zandero : utils jar [1.2,)
com.zandero : utils.extra jar [1.2,)
org.jboss.resteasy : resteasy-jaxrs jar [3.1.1.Final,)
ch.qos.logback : logback-classic jar [1.1.7,)
com.google.inject : guice jar 4.1.0
com.google.inject.extensions : guice-servlet jar 4.1.0
com.google.inject.extensions : guice-multibindings jar 4.1.0
com.fasterxml.jackson.core : jackson-core jar [2.7.3,)
com.fasterxml.jackson.core : jackson-annotations jar [2.7.3,)
com.fasterxml.jackson.core : jackson-databind jar [2.7.3,)
javax.servlet : javax.servlet-api jar [3.1.0,)

test (9)

Group / Artifact Type Version
com.fasterxml.jackson.jaxrs : jackson-jaxrs-json-provider jar [2.7.3,)
org.jboss.resteasy : resteasy-jackson2-provider jar [3.1.1.Final,)
junit : junit jar [4.12,)
net.trajano.commons : commons-testing jar [2.1.0,)
org.mockito : mockito-all jar [1.10.19,)
com.google.inject.extensions : guice-assistedinject jar 4.1.0
org.jboss.resteasy : resteasy-guice jar [3.1.1.Final,)
org.eclipse.jetty : jetty-server jar [9.3.7.v20160115,)
org.eclipse.jetty : jetty-servlet jar [9.3.7.v20160115,)

Project Modules

There are no modules declared in this project.

Events for RestEasy

Sometime we need to do a little bit more when a REST API is called, but in doing so we slow down the REST API itself.
Events for RestEasy is a simple library that enables triggering of custom events when a REST API is called.

Event triggering supports:

  • asynchronous event execution
  • events on specific response codes
  • exception based event triggers
  • exception handling and wrapping to JSON response
  • Guice for dependency injection

Setup

 <dependency>      
      <groupId>com.zandero</groupId>      
      <artifactId>rest.events</artifactId>      
      <version>1.2</version>      
 </dependency>

Example

Simple event triggered on every call to /ping

@GET
@Path("/ping")
@RestEvent(processor = PingEvent.class)
@Produces(MediaType.APPLICATION_JSON)
public String ping() {

    return "ping";
}
public class PingEvent implements RestEventProcessor {
    @Override
    public RestEventResult execute(Serializable entity, RestEventContext context) throws Exception {
        // magic happens here
        return RestEventResult.ok();
    }
}

Additional info

com.zandero

Zandero

A collection of useful utilities, extensions and wrappers

Versions

Version
1.2
1.0