Jaxrs Server

Provide JAX-RS server to expose your RESTful API.

License

License

GroupId

GroupId

com.bekioui.jaxrs
ArtifactId

ArtifactId

jaxrs-server
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Jaxrs Server
Provide JAX-RS server to expose your RESTful API.
Project URL

Project URL

https://github.com/MehdiBekioui/jaxrs-server
Source Code Management

Source Code Management

https://github.com/MehdiBekioui/jaxrs-server

Download jaxrs-server

How to add to project

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

Dependencies

compile (7)

Group / Artifact Type Version
com.bekioui.jaxrs : jaxrs-security jar 1.1.0
org.springframework : spring-context jar 4.2.5.RELEASE
io.netty : netty-all jar 4.0.36.Final
org.jboss.resteasy : resteasy-netty4 jar 3.0.16.Final
io.swagger : swagger-jaxrs jar 1.5.7
com.excilys.ebi.utils : spring-log jar 1.0.4
ch.qos.logback : logback-classic jar 1.1.3

Project Modules

There are no modules declared in this project.

Jaxrs Server

Jaxrs Server provides a server based on Netty framework to expose your RESTful API.

Contents

Features

Get it

Add the following to your Maven configuration:

<dependency>
	<groupId>com.bekioui.jaxrs</groupId>
	<artifactId>jaxrs-server</artifactId>
	<version>1.1.0</version>
</dependency>

Use it

Default case example

Add the following to your Spring configuration file:

@Configuration
@Import({ JaxrsServerConfig.class })
public class SpringConfig {

  @Bean
  public DeploymentResourceDescriptor getDeploymentResourceDescriptor() {
    return () -> MyResource.class.getPackage();
  }
  
}
  • This bean is required.
  • You can define many descriptors.
  • If you want to deploy all of your resources, return the highest package level.

Swagger management example

You need to enable CORS and Swagger first (look Configuration).

Add the following to your Spring configuration file:

@Bean
public SwaggerResourceDescriptor getSwaggerResourceDescriptor() {
  return () -> MyOtherResource.class.getPackage();
}
  • This bean is not required.
  • You can define many descriptors.
  • DeploymentResourceDescriptor is used by default if this bean is not defined with swagger enabled.
  • If you want to expose a part of your API, return the selected package.

Security

You need to enable security first (look Configuration).

Look jaxrs-security library for more informations.

Configuration

General

Property
jaxrs.server.rootResourcePath
jaxrs.server.port default: 8080
jaxrs.server.maxRequestSize default: 10 485 760 (1024 * 1024 * 10)
jaxrs.server.security.enabled default: false

CORS

Property
jaxrs.server.cors.enabled default: false
jaxrs.server.cors.allowCredentials
jaxrs.server.cors.allowedHeaders
jaxrs.server.cors.allowedMethods
jaxrs.server.cors.maxAge
jaxrs.server.cors.exposedHeaders
jaxrs.server.cors.allowedOrigins

Swagger

Property
jaxrs.server.swagger.enabled default: false
jaxrs.server.swagger.host default: localhost:8080
jaxrs.server.swagger.info.contact.email
jaxrs.server.swagger.info.contact.name
jaxrs.server.swagger.info.contact.url
jaxrs.server.swagger.info.description
jaxrs.server.swagger.info.license.name
jaxrs.server.swagger.info.license.url
jaxrs.server.swagger.info.license.vendorExtensions.name
jaxrs.server.swagger.info.license.vendorExtensions.object
jaxrs.server.swagger.info.termsOfService
jaxrs.server.swagger.info.title
jaxrs.server.swagger.info.vendorExtensions.name
jaxrs.server.swagger.info.vendorExtensions.object
jaxrs.server.swagger.info.version

Credits

Romain Sertelon

License

Copyright (C) 2016 Mehdi Bekioui ([email protected])

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.	

Versions

Version
1.1.0
1.0.1
1.0.0