ning-service-skeleton-core

Jetty-based service skeleton

License

License

Categories

Categories

Jetty Container Application Servers
GroupId

GroupId

com.ning.jetty
ArtifactId

ArtifactId

ning-service-skeleton-core
Last Version

Last Version

0.1.7
Release Date

Release Date

Type

Type

jar
Description

Description

ning-service-skeleton-core
Jetty-based service skeleton
Project Organization

Project Organization

Ning, Inc.

Download ning-service-skeleton-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.ning.jetty/ning-service-skeleton-core/ -->
<dependency>
    <groupId>com.ning.jetty</groupId>
    <artifactId>ning-service-skeleton-core</artifactId>
    <version>0.1.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.ning.jetty/ning-service-skeleton-core/
implementation 'com.ning.jetty:ning-service-skeleton-core:0.1.7'
// https://jarcasting.com/artifacts/com.ning.jetty/ning-service-skeleton-core/
implementation ("com.ning.jetty:ning-service-skeleton-core:0.1.7")
'com.ning.jetty:ning-service-skeleton-core:jar:0.1.7'
<dependency org="com.ning.jetty" name="ning-service-skeleton-core" rev="0.1.7">
  <artifact name="ning-service-skeleton-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ning.jetty', module='ning-service-skeleton-core', version='0.1.7')
)
libraryDependencies += "com.ning.jetty" % "ning-service-skeleton-core" % "0.1.7"
[com.ning.jetty/ning-service-skeleton-core "0.1.7"]

Dependencies

compile (13)

Group / Artifact Type Version
com.ning.jaxrs : jaxrs-metrics jar 2.0.0
com.yammer.metrics : metrics-core jar 2.1.2
com.yammer.metrics : metrics-guice jar 2.1.2
com.yammer.metrics : metrics-servlet jar 2.1.2
commons-lang : commons-lang jar 2.6
com.fasterxml.jackson.core : jackson-core jar 2.0.0
com.fasterxml.jackson.core : jackson-databind jar 2.0.0
com.fasterxml.jackson.datatype : jackson-datatype-joda jar 2.0.1
com.fasterxml.jackson.jaxrs : jackson-jaxrs-json-provider jar 2.0.0
org.weakref : jmxutils jar 1.12
org.skife.config : config-magic jar 0.13
org.slf4j : slf4j-api jar 1.6.4
org.slf4j : jul-to-slf4j jar 1.6.4

provided (11)

Group / Artifact Type Version
com.google.guava : guava jar 11.0.2
com.google.inject : guice jar 3.0
com.google.inject.extensions : guice-servlet jar 3.0
com.google.inject.extensions : guice-multibindings jar 3.0
javax.servlet : javax.servlet-api jar 3.0.1
javax.ws.rs : jsr311-api jar 1.1.1
org.eclipse.jetty : jetty-jmx jar 8.1.3.v20120416
org.eclipse.jetty : jetty-server jar 8.1.3.v20120416
org.eclipse.jetty : jetty-servlet jar 8.1.3.v20120416
org.eclipse.jetty : jetty-util jar 8.1.3.v20120416
org.eclipse.jetty : jetty-xml jar 8.1.3.v20120416

runtime (1)

Group / Artifact Type Version
org.slf4j : jcl-over-slf4j jar 1.6.4

test (3)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.6.4
org.testng : testng jar 6.3.1
joda-time : joda-time jar 2.0

Project Modules

There are no modules declared in this project.

Build Status

To see an example of an application using this skeleton, see how the maven-jetty-plugin is configured (relevant files under src/test/).

Guice

As a bare minimum, you should install and/or extend com.ning.jetty.core.modules.ServerModule, and add the following dependency:

    <dependency>
        <groupId>com.ning.jetty</groupId>
        <artifactId>ning-service-skeleton-core</artifactId>
    </dependency>

Filters

  1. Request and Response utilities

    com.ning.jetty.utils.filters.PeepingTomRequestWrapper and com.ning.jetty.utils.filters.PeepingTomResponseWrapper wrap HttpServletRequestWrapper and ServletResponseWrapper respectfully and cache certain attributes. You can use these classes in your filters to look into the request and/or response streams and various attributes (e.g. response code or headers).

    See com.ning.jetty.eventtracker.filters.TrackerFilter for an example on how to use them.

  2. TrackerFilter

    You can use the provided TrackerFilter to send request logs to your log aggregating system. A default implementation is provided for the collector via the eventtracker library. See com.ning.jetty.eventtracker.CollectorTracker.

    In addition to the eventtracker system properties, you can set the name of the event via com.ning.core.eventtracker.requestLogEventName (RequestLogEvent by default).

Servlets

  1. LogInvalidResourcesServlet

    The com.ning.jetty.core.servlets.LogInvalidResourcesServlet will log any request and return a 404 to the client. This is useful as a back-end servlet for Guice for example (the Guice filter requires a back-end servlet).

  2. HttpProxyServlet

    The com.ning.jetty.utils.servlets.HttpProxyServlet can be used to proxy request to a remote host. The remote host needs to be provided by implementing the ServiceFinder interface.

Log4j

  1. LogLevelCounterAppender

    The com.ning.jetty.log4j.LogLevelCounterAppender log4j appender can be used to gather statistics on a per logger and level basis (via JMX).

    To use it, configure your log4j.xml:

    <appender name="LOG_LEVEL_COUNTER" class="com.ning.jetty.log4j.LogLevelCounterAppender"/>
    <root>
        <priority value="WARN"/>
        <appender-ref ref="LOG_LEVEL_COUNTER"/>
    </root>
    

Misc.

  1. Adding healthchecks

To add healthchecks, you need to extend com.yammer.metrics.core.HealthCheck and register them.

  1. Available providers

You can use com.ning.jetty.jdbi.guice.providers.DBIProvider to create DBI objects for your dao. This provider will setup metrics and BoneCP for you.

Versions

Version
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.14
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1