Giter Club home page Giter Club logo

ning-service-skeleton's Introduction

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.utils.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.utils.filters.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.utils.providers.DBIProvider to create DBI objects for your dao. This provider will setup metrics and BoneCP for you.

ning-service-skeleton's People

Contributors

pierre avatar sbrossie avatar

Stargazers

Aleksandar Vidakovic avatar

Watchers

James Cloos avatar James Chang avatar  avatar

Forkers

strategist922

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.