jersey-fastinfoset-provider

Jersey 2 FastInfoset Provider

License

License

Categories

Categories

IDE Development Tools Jersey Program Interface REST Frameworks
GroupId

GroupId

com.jecklgamis
ArtifactId

ArtifactId

jersey-fastinfoset-provider
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

jersey-fastinfoset-provider
Jersey 2 FastInfoset Provider
Project URL

Project URL

http://github.com/jecklgamis/jersey-fastinfoset-provider
Source Code Management

Source Code Management

http://github.com/jecklgamis/jersey-fastinfoset-provider/tree/master

Download jersey-fastinfoset-provider

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
org.glassfish.jersey.core : jersey-common jar 2.25.1
org.glassfish.jersey.core : jersey-client jar 2.25.1
org.glassfish.jersey.media : jersey-media-jaxb jar 2.25.1
com.sun.xml.fastinfoset : FastInfoset jar 1.2.13

test (3)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar 1.0.0
io.dropwizard : dropwizard-testing jar 1.0.0
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Jersey 2 Fastinfoset Provider Build Status

Maven dependency

<dependency>
    <groupId>com.jecklgamis</groupId>
    <artifactId>jersey-fastinfoset-provider</artifactId>
    <version>1.0</version>
</dependency>

Example Server Configuration (Dropwizard)

Run the file ExampleApp.java with arguments server src/test/resources/config.yml

ExampleApp.java
package com.jecklgamis.fastinfoset;

import com.codahale.metrics.health.HealthCheck;
import io.dropwizard.setup.Environment;

import org.glassfish.jersey.filter.LoggingFilter;

public class ExampleApp extends io.dropwizard.Application<ExampleAppConfig> {
    @Override
    public void run(ExampleAppConfig config, Environment env) throws Exception {
        env.jersey().register(new ExampleResource());
        env.healthChecks().register("default", new HealthCheck() {
            @Override
            protected Result check() throws Exception {
                return Result.healthy();
            }
        });
        env.jersey().register(LoggingFilter.class);
        env.jersey().register(FastInfosetJaxbElementProvider.class);
        env.jersey().register(FastInfosetRootElementProvider.class);
    }

    public static void main(String[] args) throws Exception {
        new ExampleApp().run(args);
    }
}

Example Client Configuration (Jersey 2 Client)

Run the ExampleClient.java (ensure ExampleApp is running)

ExampleClient.java
package com.jecklgamis.fastinfoset;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.JerseyClientBuilder;
import org.glassfish.jersey.filter.LoggingFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.client.Client;
import javax.ws.rs.core.Response;

import static java.lang.String.format;

public class ExampleClient {
    private static final Logger logger = LoggerFactory.getLogger(ExampleClient.class);

    public static void main(String[] args) throws Exception {
        Response response = client().target("http://127.0.0.1:5050").request()
                .accept("application/fastinfoset").get(Response.class);
        User user = response.readEntity(User.class);
        logger.info(format("%s %s", user.getUsername(), user.getEmail()));
    }

    private static Client client() {
        ClientConfig config = new ClientConfig();
        config.register(LoggingFilter.class);
        config.register(FastInfosetJaxbElementProvider.class);
        config.register(FastInfosetRootElementProvider.class);
        return JerseyClientBuilder.createClient(config);
    }
}

Versions

Version
1.0