GithubHelp home page GithubHelp logo

codenvy / everrest Goto Github PK

View Code? Open in Web Editor NEW
25.0 21.0 16.0 5.23 MB

everREST project it is RESTful application framework along with complete JAX-RS (JSR-311) implementation

License: Eclipse Public License 2.0

Java 99.24% Groovy 0.66% XSLT 0.10%

everrest's Introduction

everrest's People

Contributors

aheritier avatar andrew00x avatar dependabot[bot] avatar mshaposhnik avatar skabashnyuk avatar tareksha avatar vitalka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

everrest's Issues

MultivaluedMapEntityProvider fail in case the request inputStream has already been consumed

Given:
https://github.com/codenvy/everrest/blob/master/everrest-core/src/main/java/org/everrest/core/impl/provider/MultivaluedMapEntityProvider.java#L75

For instance if you have a filter that calls request.getParameter("paramName") before in the filter chain the Provider will fail to map any POST parameter as the input stream is already consumed and any read() call will return -1.

The Provider should take it into account and add the request.getParameterMap() to its results.

Incomplete implementation of UriBuilder

Hi,

This issue relates to everrest's implementation of javax.ws.rs.core.UriBuilder, specifically the methods build(Object...) and build(Object..., boolean). The issue is based on the standard java specification for UriBuilder.build():
https://docs.oracle.com/javaee/7/api/javax/ws/rs/core/UriBuilder.html#build-java.lang.Object:A-boolean-

Encoding of URI template values
The specification requires both implementations of build() to fully encode the string values of template parameters so that they can be correctly re-parsed as valid URIs, e.g. UriBuilder.fromPath("/{p0}").build("aa{") should build the URI /aa%7B, substituting { with the escaped equivalent %7B. In everrest's implementation this requirement is broken and the builder substitutes the values without escaping, leading to URI syntax failures:

--> UriBuilder.fromPath("/{p1}").build("aa{");
javax.ws.rs.core.UriBuilderException: java.net.URISyntaxException: Illegal character in path at index 3: /aa{
    at org.everrest.core.impl.uri.UriBuilderImpl.build(UriBuilderImpl.java:126)
    ...
Caused by: java.net.URISyntaxException: Illegal character in path at index 3: /aa{
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3063)
    at java.net.URI.<init>(URI.java:588)
    at org.everrest.core.impl.uri.UriBuilderImpl.build(UriBuilderImpl.java:124)
    ...

Implementation of build(Object...,boolean)
The overload build(Object[],boolean) , which allows customizing whether / is escaped in the parameter values, is not implemented in everrest and returns null.

The current implementation of UriBuilder is lacking and fails on several cases if the target environment has everrest is the available JAX-RS runtime, e.g. Eclipse Che environment.

Certify this implementation

Are there any plans to keep this project active?
Now the TCKs for the JAX-RS are available and we can certify the implementation ourselves.

So as this project already implements a large portion of the spec, it would just require to implement the missing bits and certify this implementation.

I can help setting up the TCK if you will.

If this project is not active anymore, would you mind if I fork it and start implementing the missing features?

(PS: Now the main package is "jakarta" instead of "javax", so it would be needed to release a major version of this library)

Some links:

https://jakarta.ee/specifications/restful-ws/
https://www.agilejava.eu/2021/02/05/compatible-implementations/

Can't run the book-service with websocket

I've run the everrest-samples/book-service example:

mvn clean install
mvn package
mvn jetty:run

The api is working well: http://localhost:8080/book-service/books/101.

But if I visit it with "Advanced REST client" for the ws url: ws://localhost:8080/book-service/ws, it can't be connected. At meanwhile, the console of mvn prints error:

[WARNING]
java.lang.NoSuchMethodError: javax.websocket.Session.addMessageHandler(Ljava/lang/Class;Ljavax/websocket/MessageHandler$Whole;)V
    at org.everrest.websockets.WSConnectionImpl.onOpen(WSConnectionImpl.java:75)
    at org.eclipse.jetty.websocket.jsr356.endpoints.JsrEndpointEventDriver.onConnect(JsrEndpointEventDriver.java:140)
    at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.openSession(AbstractEventDriver.java:220)
    at org.eclipse.jetty.websocket.jsr356.endpoints.AbstractJsrEventDriver.openSession(AbstractJsrEventDriver.java:104)
    at org.eclipse.jetty.websocket.common.WebSocketSession.open(WebSocketSession.java:424)
    at org.eclipse.jetty.websocket.server.WebSocketServerConnection.onOpen(WebSocketServerConnection.java:76)
    at org.eclipse.jetty.io.AbstractEndPoint.upgrade(AbstractEndPoint.java:191)
    at org.eclipse.jetty.server.HttpConnection.onCompleted(HttpConnection.java:363)
    at org.eclipse.jetty.server.HttpChannel.onCompleted(HttpChannel.java:525)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:414)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:237)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:240)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:93)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.produceAndRun(ExecuteProduceRun.java:191)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.run(ExecuteProduceRun.java:126)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:641)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:559)
    at java.lang.Thread.run(Thread.java:745)
2016-02-26 13:08:20,235[qtp177389135-14]  [DEBUG] [o.e.w.WSConnectionContext 97]        - Close connection WSConnectionImpl{id=1, wsSession=websocket-1, channels=[]} with status 1011

I checked the dependencies of the project is:

$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EverRest :: Book Service 1.13.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ book-service ---
[INFO] org.everrest:book-service:war:1.13.0-SNAPSHOT
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- javax.websocket:javax.websocket-api:jar:1.1:provided
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.2:runtime
[INFO] |  +- ch.qos.logback:logback-core:jar:1.1.2:runtime
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.6:runtime
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.1:runtime
[INFO] +- javax.annotation:javax.annotation-api:jar:1.2:runtime
[INFO] +- javax.mail:mail:jar:1.4.4:runtime
[INFO] +- org.everrest:everrest-core:jar:1.13.0-SNAPSHOT:runtime
[INFO] |  +- com.google.guava:guava:jar:18.0:runtime
[INFO] |  \- commons-io:commons-io:jar:2.4:runtime
[INFO] \- org.everrest:everrest-websockets:jar:1.13.0-SNAPSHOT:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.359 s
[INFO] Finished at: 2016-02-26T13:13:11+08:00
[INFO] Final Memory: 17M/309M
[INFO] ------------------------------------------------------------------------

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.