Skip to content

Improved: Move REST-API plugin into framework OFBIZ-13415#1325

Open
Lukas-Finster wants to merge 53 commits into
apache:trunkfrom
ecomify:OFBIZ-13415-move-REST-API-plugin-into-framework-with-history
Open

Improved: Move REST-API plugin into framework OFBIZ-13415#1325
Lukas-Finster wants to merge 53 commits into
apache:trunkfrom
ecomify:OFBIZ-13415-move-REST-API-plugin-into-framework-with-history

Conversation

@Lukas-Finster
Copy link
Copy Markdown
Contributor

Moves the rest-api plugin into the ofbiz-framework repository while preserving commit history.

Thanks: Deepak Dixit and Ashish Vijaywargiya

Michael Brohl and others added 30 commits March 27, 2021 10:45
for embedding external redoc javascript file (OFBIZ-12197)
(OFBIZ-12207)

The reference was chanegd from cdn-hosted version to a locally saved
version to avoid integrity check mechanism and making it possible to
track the used version in the README.
Thanks Alexander Gepting for the contribution.
Thanks Alexander Gepting for the contribution.
…590)

This prevented to run the stable demo, hence the next, weirdly the trunk had
not this problem. Anyway better safe than sorry... Maybe related to Gradle
version or rather libs loaded?

The reason why the stable (and old) demos were not running is because the
EntitySaxReaderTests did not pass
The tests fails locally but it makes no sense, trying w/ BUilbot...
documentation (OFBIZ-12426)

This fixes the following errors and warnings which are displayed by the
Swagger Editor (editor.swagger.io) when reading the generated openapi
documentation:

Errors fixed
* "Header parameters named "Authorization" are ignored. Use the
`securitySchemes` and `security` sections instead to define
authorization."
* "Structural error at paths./....parameters.0 should have either a
`schema` or `content` property"
the generated parameters from the service definition now have schema
entries generated
* the same applies to the WWW-Authenticate header in the responses

Warnings fixed

* "Header parameters named "Accept" are ignored. The values for the
"Accept" header are defined by `responses.<code>.content.<media-type>`."
Renames BirtEngineServlet class to OfbizBirtEngineServlet, because it shadowed
the simple name of it superclass.
It can be exceptionally confusing, create lots of situations in which you have
to look at import statements to resolve references and creates many
opportunities to accidentally define methods that do not override methods
in their superclasses.

Also remove trailing spaces in OpenApiUtil class
In PricatParseExcelHtmlThread::storePricatFile try to fixes a possible null
dereferencement but does not work (weird).
The error is NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

In OpenApiUtil::getSchemaForEntity fixes a possible null dereferencement
We don't fear collisions for "servletContext". It's only initialised by
contextInitialized() and then only read before being destroyed by
contextDestroyed()

Also initialises servletContextto null
…::newInstance

Class.newInstance() has a flaw, in which any Throwable from the constructor is
thrown unchecked. It was deprecated in Java 9, but not marked for removal.
It shows as a deprecation warning when compiling OfBiz with Java 11.

Thanks: Heinz Kabutz for reporting and initially committing 0e6732b. This
completes in plugins and all will we backported
I handled <<addProperties(String,Schema) in Schema has been deprecated>>
Just needed to replace by addProperty(String,Schema) for each case
I now directly use the umbrella task, no need to create a sub-task each time,
the documentation is in the source (build.gradle) anyway
> java.lang.IllegalArgumentException: Unsupported class file major version 61

This might require a version upgrade for Jersey to a version that supports Java 17 .
Jersey seems to repackage ASM for bytecode transformations.

The bundled version does not support Java 17 .
An upgrade to jersey 2.37 should do the trick
https://github.com/eclipse-ee4j/jersey/releases/tag/2.37 .

Thanks: Ioan Eugen Stan
Plugin REST API was no longer working because of the old version being
incompatible with Java 17.

jleroux: Actually 2.37 (in trunk) was compatible, but better upgrade anyway

Thanks: originalnichtskoenner
I did the last update with OFBIZ-12658 in June 2022.
IIRW I did not speak about the reason I did not update since.

It's simple. We encounter more and more conflicts when upgrading.
Often it's hard work to resolve these conflicts for a disputable benefit.

After all, it's working why upgrading?
As the famous meme "if it ain’t broke, don’t fix it" says.

So I decided to only upgrade dependencies when security issues make it necessary.
Few weeks ago I finally decided to though have a look at the situation.

Clearly it confirms what I thought. If it's not a trivial upgrade that does not
bring much, most of the time it's conflicts.

So I'll now rather upgrade only in case of security necessity.
Of course you are welcome to continue to upgrade as much as possible.
Maybe sometimes issues crossed with previous versions will resolved with newer
libraries, but that must be very rare...if ever...
Puts rest-api.adoc into the right place

Adds a README.md to replace README.old in the old place.

Updates plugins-user-manual.adoc
Migrate all plugins from javax to jakarta for Tomcat 10 migration.
Thanks to Gaëtan Chaboussie to realize this work
…Z-13212) (PR-135)

- Modified plugins/rest-api to support refresh token.
- Get refresh token while login.
- Get access token by providing refresh token.

* Documentation updated for refresh token mechanism.

---------

Co-authored-by: ArashPreet Singh <arash@insonix.com>
Enhance the documentation in sake of security.

Note that there is no specific implementation, only advice.

Few trailing spaces are removed as well (Eclipse automation).
…st suite file. (apache#138)

Since there are no tests defined for the rest-api component, the system complained
that the test file definition is not valid.
dixitdeepak and others added 23 commits August 21, 2025 00:36
…pache#140)

- Updated imports from javax.ws.* to jakarta.ws.rs.* for Jersey 3.x/Jakarta EE 9+
- Changed web.xml to use jakarta.ws.rs.Application instead of javax.ws.rs.Application
- Ensured compatibility with Tomcat 10 by aligning with jakarta.servlet.* APIs
- Fixed rest-api plugin to work with Jersey 3.1.3 and Tomcat 10.1.x
…ror (apache#139)

Co-authored-by: ArashPreet Singh <arash@insonix.com>
Co-authored-by: Deepak Dixit <deepak@apache.org>
* Added support for multiple rest.xml files per component
(OFBIZ-13288)

- Enhanced loadApiDefinitions to scan and load all rest.xml files from the component's api folder, instead of being restricted to a single file
- Introduced duplicate path handling: when multiple rest.xml files define the same endpoint path, the most recently loaded definition takes precedence
- Added a new path attribute in ModelApi class (with getter/setter methods) to capture the API entry path and improve flexibility in routing
- Refactored OFBizOpenApiReader to build nested URLs using the ModelApi path, ensuring consistency between swagger documentation and runtime endpoints

* Use ServiceNameContextHolder to set the service name in ServiceRequestHandler

* Adds example-product.rest.xml showcasing multiple rest.xml files per component
…n for the rest-api plugin.

Simplified error and response handling.
Simplified internal class structure by leveraging @context annotation for ServletContext.
Fixed and cleaned up various classes in order to properly use annotations.
Grouped together all custom annotations under the same custom package.
Various code cleanups.

Thanks: to Deepak Dixit for the help with the review and update to the latest version of the plugin.
Bumps 1 update in the /example directory: org.apache.tomcat.embed:tomcat-embed-websocket.
Bumps 1 update in the /ldap directory: [org.apereo.cas:cas-server-support-ldap-core](https://github.com/apereo/cas).
Bumps 1 update in the /lucene directory: org.apache.lucene:lucene-core.
Bumps 4 updates in the /rest-api directory: org.glassfish.jersey.containers:jersey-container-servlet, org.glassfish.jersey.inject:jersey-hk2, org.glassfish.jersey.media:jersey-media-multipart and io.swagger.core.v3:swagger-jaxrs2.
Bumps 2 updates in the /solr directory: org.apache.solr:solr-core and [com.google.guava:guava](https://github.com/google/guava).

Updates `org.apache.tomcat.embed:tomcat-embed-websocket` from 9.0.110 to 9.0.116

Updates `org.apereo.cas:cas-server-support-ldap-core` from 6.6.15 to 6.6.15.2
- [Release notes](https://github.com/apereo/cas/releases)
- [Commits](apereo/cas@v6.6.15...v6.6.15.2)

Updates `org.apache.lucene:lucene-core` from 9.8.0 to 9.12.3

Updates `org.apache.lucene:lucene-queryparser` from 9.8.0 to 9.12.3

Updates `org.apache.lucene:lucene-analysis-common` from 9.8.0 to 9.12.3

Updates `org.glassfish.jersey.containers:jersey-container-servlet` from 3.1.3 to 3.1.11

Updates `org.glassfish.jersey.inject:jersey-hk2` from 3.1.3 to 3.1.11

Updates `org.glassfish.jersey.media:jersey-media-multipart` from 3.1.3 to 3.1.11

Updates `org.glassfish.jersey.media:jersey-media-json-jackson` from 3.1.3 to 3.1.11

Updates `io.swagger.core.v3:swagger-jaxrs2` from 2.2.20 to 2.2.45

Updates `io.swagger.core.v3:swagger-jaxrs2-servlet-initializer` from 2.2.20 to 2.2.45

Updates `io.swagger.core.v3:swagger-annotations` from 2.2.20 to 2.2.45

Updates `org.apache.solr:solr-core` from 9.8.0 to 9.10.1

Updates `com.google.guava:guava` from 28.0-jre to 28.2-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: org.apache.tomcat.embed:tomcat-embed-websocket
  dependency-version: 9.0.116
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: org.apereo.cas:cas-server-support-ldap-core
  dependency-version: 6.6.15.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: org.apache.lucene:lucene-core
  dependency-version: 9.12.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-dependencies
- dependency-name: org.apache.lucene:lucene-queryparser
  dependency-version: 9.12.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-dependencies
- dependency-name: org.apache.lucene:lucene-analysis-common
  dependency-version: 9.12.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-dependencies
- dependency-name: org.glassfish.jersey.containers:jersey-container-servlet
  dependency-version: 3.1.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: org.glassfish.jersey.inject:jersey-hk2
  dependency-version: 3.1.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: org.glassfish.jersey.media:jersey-media-multipart
  dependency-version: 3.1.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: org.glassfish.jersey.media:jersey-media-json-jackson
  dependency-version: 3.1.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: io.swagger.core.v3:swagger-jaxrs2
  dependency-version: 2.2.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: io.swagger.core.v3:swagger-jaxrs2-servlet-initializer
  dependency-version: 2.2.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: io.swagger.core.v3:swagger-annotations
  dependency-version: 2.2.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
- dependency-name: org.apache.solr:solr-core
  dependency-version: 9.10.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 28.2-jre
  dependency-type: direct:production
  dependency-group: all-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps io.swagger.core.v3:swagger-jaxrs2-servlet-initializer from 2.2.45 to 2.2.48.

---
updated-dependencies:
- dependency-name: io.swagger.core.v3:swagger-jaxrs2-servlet-initializer
  dependency-version: 2.2.48
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps io.swagger.core.v3:swagger-jaxrs2 from 2.2.48 to 2.2.49.

---
updated-dependencies:
- dependency-name: io.swagger.core.v3:swagger-jaxrs2
  dependency-version: 2.2.49
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps io.swagger.core.v3:swagger-jaxrs2-servlet-initializer from 2.2.49 to 2.2.50.

---
updated-dependencies:
- dependency-name: io.swagger.core.v3:swagger-jaxrs2-servlet-initializer
  dependency-version: 2.2.50
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@Lukas-Finster Lukas-Finster force-pushed the OFBIZ-13415-move-REST-API-plugin-into-framework-with-history branch from 2407676 to fc86bb2 Compare June 3, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants