PampaNet Web Shooters

Web Framework for Developing Java RESTful WebServices using RestEasy, Guice and Shiro

License

License

Categories

Categories

Net
GroupId

GroupId

com.pampanet
ArtifactId

ArtifactId

webshooters
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

PampaNet Web Shooters
Web Framework for Developing Java RESTful WebServices using RestEasy, Guice and Shiro
Project URL

Project URL

http://github.com/pabiagioli/webshooters
Source Code Management

Source Code Management

https://github.com/pabiagioli/webshooters

Download webshooters

How to add to project

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

Dependencies

compile (8)

Group / Artifact Type Version
org.apache.shiro : shiro-web jar 1.2.3
org.apache.shiro : shiro-guice jar 1.2.3
org.jboss.resteasy : resteasy-jaxrs jar 3.0.9.Final
org.jboss.resteasy : resteasy-guice jar 3.0.9.Final
org.jboss.resteasy : async-http-servlet-3.0 jar 3.0.9.Final
com.google.inject.extensions : guice-servlet jar 3.0
ch.qos.logback : logback-classic jar 1.1.2
org.slf4j : slf4j-ext jar 1.7.7

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0

test (4)

Group / Artifact Type Version
com.squareup.okhttp : okhttp jar 2.2.0
junit : junit jar 4.10
org.eclipse.jetty : jetty-webapp jar 9.2.6.v20141205
org.eclipse.jetty : jetty-servlet jar 9.2.6.v20141205

Project Modules

There are no modules declared in this project.

PampaNet Web Shooters

Build Status Coverage Status Maven Central

Web Framework for developing Secure Java Web Services

Dependencies included

Requirements

  • Java 8
  • Maven 3
  • Application Server (Tomcat 9(?), Jetty 9 Recommended)

##Features

  • Java 8 compliant
  • Servlet 3.x Asynchronous Requests and Filters
  • Google Guice Dependency Injection
  • Apache Shiro Security Context
  • JBoss RestEasy with JAX-RS 2.x compatibility

##Usage

  • Insert this dependency in your pom.xml:
<dependency>
  <groupId>com.pampanet</groupId>
  <artifactId>webshooters</artifactId>
  <version>0.1.1</version>
</dependency>

Example

Listener

public class MyContextListener extends com.pampanet.webshooters.config.DefaultServletContextListener{

	private XLogger logger = XLoggerFactory.getXLogger(MyContextListener.class);

	@Override
	protected List<? extends Module> getModules(ServletContext context) {
		logger.entry(context);
		return Arrays.asList(new BootstrapPropertiesModule("bootstrap.properties"), new RequestScopeModule(), new DefaultShiroModule(context), new ShiroAopModule(),new BootstrapRestPackagesModule("/bootstrap.properties","com.pampanet.webshooters.config.rest.pkgs"));
	}

bootstrap.properties

com.pampanet.webshooters.config.rest.pkgs=com.pampanet.sample.rest

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<display-name>Secure Async Webapp Project</display-name>
  <listener>
  	<listener-class>com.pampanet.sample.config.MyContextListener</listener-class>
  </listener>
  <filter>
    <filter-name>shiroFilter</filter-name>
    <filter-class>com.pampanet.webshooters.servlet.filter.GuiceRestEasyShiroFilter</filter-class>
    <async-supported>true</async-supported>
  </filter>
  <filter-mapping>
    <filter-name>shiroFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
   <filter-name>restEasyFilter</filter-name>
   <filter-class>com.pampanet.webshooters.servlet.filter.GuiceRestEasyFilterDispatcher</filter-class>
   <async-supported>true</async-supported>
  </filter>
  <filter-mapping>
   <filter-name>restEasyFilter</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>

##License

  • Apache 2.0 License

##Sample Server

  • See AppTest.java Integration Test for Jetty Server Reference

##Next Steps

  • More documentation
  • Customizable Default Values
  • More stuff...

Versions

Version
0.1.1
0.1.0