Skip to content

Latest commit

 

History

History
103 lines (89 loc) · 4.28 KB

README.md

File metadata and controls

103 lines (89 loc) · 4.28 KB

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...