Giter Club home page Giter Club logo

bonita-connector-rest's Introduction

Rest Connector

Actions Status Sonarcloud Status GitHub release Maven Central License: GPL v2

Build

Clone or fork this repository, then at the root of the project run:

./mvnw

Release

In order to create a new release:

  • On the release branch, make sure to update the pom version (remove the -SNAPSHOT)
  • Run the action 'Create release', set the version to release as parameter
  • When the action is completed, do not forget to manage the release on the nexus (close and release)
  • Update the master with the next SNAPSHOT version.

Contributing

We would love you to contribute, pull requests are welcome! Please see the CONTRIBUTING.md for more information.

License

The sources and documentation in this project are released under the GPLv2 License

bonita-connector-rest's People

Contributors

baptistemesta avatar benjaminparisel avatar bonita-ci avatar cjundt avatar danila-m avatar dependabot[bot] avatar educhastenier avatar jjth avatar julienmege avatar laurentleseigneur avatar mbource avatar nathaliec avatar nchabanoles avatar rbioteau avatar tbouffard avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bonita-connector-rest's Issues

If HTTP code is not OK, outputs are not filled (so the process cannot access error message)

We use the REST connector configured to "Ignore error and continue process" so the process can check the HTTP response code itself, get the error response body, and report it gracefully to the user.

However, the connector does not fill any outputs if the connector sees the HTTP error code is not 2xx or 3xx, as you can see in RESTConnector.execute():

            if (!statusSuccessful(statusCode)) {
                throw new ConnectorException(
                        String.format("%s response status is not successful: %s - %s", request, statusCode, httpResponse.getStatusLine().getReasonPhrase()));
            }
            setOutputs(httpResponse, request);

The fix would be to move setOutputs() before the exception is thrown (above if), so outputs are always set for the process to analyze.

I can't build the project at it's root level as said in the Readme.md

Hello please can'i have your support on building the project ? Here is the process i followed.

$ git clone https://github.com/bonitasoft/bonita-connector-rest.git
$ cd bonita-connector-rest/
$ mvn clean verify

But i'm facing this issue :


[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.bonitasoft.connectors:bonita-connector-rest:1.0.5-SNAPSHOT: Failure to find org.bonitasoft.connectors:bonita-connectors:pom:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 4, column 13


What i'm doing wrong ?

RESTConnector loses header values.

For example, Bonitasoft BPM server returns this from a login request:

Server: Apache-Coyote/1.1
Set-Cookie: bonita.tenant=1
Set-Cookie: JSESSIONID=FDFB2C8CD28C6C13222FE49E2C1DC32F; Path=/bonita; HttpOnly
Set-Cookie: X-Bonita-API-Token=6c4698ce-3e25-407d-8c40-cdab15a63aad; Path=/
Content-Length: 0
Date: Thu, 26 Oct 2017 10:25:55 GMT

Here, the "Set-Cookie" header is repeated 3 times. The RESTConnector.java file will convert Header[] to a Map, but one key maps to one value, and so only one "Set-Cookie" header will remain.

The problem code is here (below). My recommendation would be to return an array of values, if there are multiple.

private Map<String, String> asMap(Header[] headers) {
final Map<String, String> result = new HashMap<>();
if (headers != null) {
for (final Header header : headers) {
result.put(header.getName(), header.getValue());
}
}
return result;
}

Json simple values causes exception

We have a web service that returns a numeric value as a response.
The REST connector assumes that the response is either an array of objets or an object, in this case trying to deserialize json into a Map which is resulting in an exception.

The connector should not raise an exception when the response is a simple value (string, number, null, true, false, date).

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.