Giter VIP home page Giter VIP logo

pluginexpress's Introduction

Build Status Build Status

waffle.io Stories in Ready

Plugin-Registry

RestExpress-specific plugins. Plus a registry of third-party (externally written) plugins for enhancing RestExpress functionality. Please see the README for each individual plugin for additional details. Or the PluginExpress wiki page.

General Maven Usage

Stable:

		<dependency>
			<groupId>com.strategicgains.plugin-express</groupId>
			<artifactId>* plugin name here *</artifactId>
			<version>0.3.3</version>
		</dependency>

Development:

		<dependency>
			<groupId>com.strategicgains.plugin-express</groupId>
			<artifactId>* plugin name here *</artifactId>
			<version>0.3.4-SNAPSHOT</version>
		</dependency>

Or download the jar directly from: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22plugin-express%22

Note that to use the SNAPSHOT versions, you must enable snapshots and a repository in your pom file as follows:

  <profiles>
    <profile>
       <id>allow-snapshots</id>
          <activation><activeByDefault>true</activeByDefault></activation>
       <repositories>
         <repository>
           <id>snapshots-repo</id>
           <url>https://oss.sonatype.org/content/repositories/snapshots</url>
           <releases><enabled>false</enabled></releases>
           <snapshots><enabled>true</enabled></snapshots>
         </repository>
       </repositories>
     </profile>
  </profiles>

pluginexpress's People

Contributors

cblaze22 avatar fa-at-pulsit avatar gli-pearson avatar gustavohenrique avatar mathewl avatar michaelholstine avatar notyalca avatar pbj23000 avatar ritzbitz01 avatar russtrotter avatar tfredrich avatar timjstewart avatar tschwecke avatar wes-williams avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pluginexpress's Issues

Incomplete CORS/OPTIONS responses when two identical URIs are registered

Here is some code that exhibits the error (this is a method from a controller):

public void registerRoutes(final RestExpress restExpress) {
   Objects.requireNonNull(restExpress, "restExpress cannot be null");

   final String collectiveRoute = "/codes.{format}";
   final String singleRoute     = "/codes/{codeId}.{format}";

   restExpress.uri(collectiveRoute, this)
      .action("createCode", HttpMethod.POST)
      .name("createCode");

   restExpress.uri(collectiveRoute, this)
      .action("listCodes", HttpMethod.GET)
      .name("listCodes");

   restExpress.uri(singleRoute, this)
      .action("deleteCode", HttpMethod.DELETE)
      .name("deleteCode");

   restExpress.uri(singleRoute, this)
      .action("getCode", HttpMethod.GET)
      .name("getCode");

   restExpress.uri(singleRoute, this)
      .action("updateCode", HttpMethod.PUT)
      .name("updateCode");
 }

With this code, performing an OPTIONS request against one of the routes returns only two methods: OPTIONS and one other method.

I believe it's because I've created multiple route builders that have the same URI and the following code in CorsHeaderPlugin.register():

methodsByPattern.put(pathPattern, methods);

overwrites the previously inserted value for the pathPattern key.

To make this clearer, I remember seeing the following calls:

methodsByPattern.put("/code", { OPTIONS, GET });
methodsByPattern.put("/code", { OPTIONS, PUT });
methodsByPattern.put("/code", { OPTIONS, DELETE });

The last one wins. Perhaps merging the methods in the map's value would be a good approach.

The workaround I found is to do the following:

public void registerRoutes(final RestExpress restExpress) {
    Objects.requireNonNull(restExpress, "restExpress cannot be null");

    final String collectiveRoute = "/codes.{format}";
    final String singleRoute     = "/codes/{codeId}.{format}";

    restExpress.uri(collectiveRoute, this)
            .action("createCode", HttpMethod.POST)
            .action("listCodes", HttpMethod.GET)
            .name("codes");

    restExpress.uri(singleRoute, this)
            .action("deleteCode", HttpMethod.DELETE)
            .action("updateCode", HttpMethod.PUT)
            .action("getCode", HttpMethod.GET)
            .name("code");
}

Now there is only one RouteBuilder per URI so the methodsByPattern map will never have the same key inserted twice.

If you think my approach of merging methods is the best way to go, I'd be happy to submit a pull request with those changes in it.

Thalassa Plugin

Write a plugin to ping Thalassa when the service is alive.

Correlation ID Plugin

Create a plugin that either uses an incoming Correlation-Id header or assigns one, so subsequent calls can all be correlated in logs.

Update Swagger Plugin to 2.0

I am not sure how much different 1.2 and 2.0 of Swagger is, but can the existing Swagger plugin be upgraded to 2.0 easily, or does this involve a complete overhaul. Trying to see how much work that is.

suggestion of replacing white space on nickname

According to Swagger RESTful API Documentation Specification, (refer : https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md) the nickname MUST be alphanumeric and may include underscores ,Whitespace characters are not allowed.

/swagger/src/main/java/com/strategicgains/restexpress/plugin/swagger/domain/ApiOperation.java :

this.nickname = method + (name == null ? "" : " " + name);

My suggestion is to replace the white space with "_".

If you think my suggestion of replacing white space is the best way to go, I'd be happy to submit a pull request with those changes in it.

Annotation Plugin Tests Fail

Annotation dependency, extcos, causes tests to hang. Hasn't be updated since 2012 and doesn't appear to run correctly on Java 1.8

Removed Annotation plugin from PluginExpress release 0.3.1

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.