Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec should declare a vendor-neutral way to start JAX-RS server in Java SE environment #509

Closed
glassfishrobot opened this issue Dec 23, 2014 · 21 comments
Assignees
Labels
api enhancement New feature or request
Milestone

Comments

@glassfishrobot
Copy link

JAX-RS declares Java SE as one of several possible environments. Unfortunately it does not declare how to start a JAX-RS server application in pure Java SE. As a consequence, all vendors provides different methods to do so, leading to vendor-locked-in applications.

To get rid of the vendor-lock-in I'd like to propose that the JAX-RS specification defines a vendor-neutral API how a JAX-RS server application can be started in a pure Java SE environment.

This does not imply any assumptions upon how a JAX-RS implementation reacts upon such an API invocation other than "the application is started on the specified endpoint defined by the root URI appended by @ApplicationPath (if existing)".

A proposed API could look like this and is up to further discussion among the expert group:

JAXRS.start(URI rootURI, Application application)

Affected Versions

[2.1]

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by mkarg

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAX_RS_SPEC-504

@glassfishrobot
Copy link
Author

@glassfishrobot glassfishrobot self-assigned this Feb 10, 2018
@mkarg mkarg self-assigned this Apr 8, 2018
@mkarg mkarg added this to the 2.2 milestone Apr 8, 2018
@mkarg mkarg added enhancement New feature or request api and removed Priority: Major enhancement New feature or request labels Apr 8, 2018
@mkarg
Copy link
Contributor

mkarg commented Apr 8, 2018

@jansupol @asoldano @andymc12 Vendors comments requested. :-)

@mkarg
Copy link
Contributor

mkarg commented Apr 8, 2018

@deki CXF comments requested. :-)

@deki
Copy link
Contributor

deki commented Apr 9, 2018

For me this is a minor enhancement because most setups that I know run inside a container like Tomcat or Spring Boot so there is no need for a start API.

From CXF point of view it's easy to delegate from the new API to the existing JAXRSServerFactoryBean that we already have in place.

@andymc12
Copy link
Contributor

andymc12 commented Apr 9, 2018

Is there a lot of user demand for this? I worked on the Embeddable EJB implementation back in Java EE 7 - similar idea with an EJBContainer ec = EJBContainer.createEJBContainer(properties);. It seemed like a good idea at the time, but I never saw much customer adoption.

And I agree with @deki that there are already a lot of setups that make it easy to deploy JAX-RS apps.

If we do this, I would propose that it be optional - i.e. that a JAX-RS implementation could still be compliant even if they do not provide an implementation of this API.

@jansupol
Copy link
Contributor

jansupol commented Apr 9, 2018

I can see a usage for such a declaration; microservices does not necessarily need full Servlet container to run JAX-RS application, microprofile defines JAX-RS but no Servlet.

JAX-RS standard was built on top of Servlet container from the beginning though, there can be consequences of what part of the implementation should be mandatory and what optional. The Async features for instance.

@ggam
Copy link
Contributor

ggam commented Apr 9, 2018 via email

@mkarg
Copy link
Contributor

mkarg commented Apr 9, 2018

Regarding user demand: Well, I wouldn't have reactivated this task if not!

@mkarg
Copy link
Contributor

mkarg commented Apr 9, 2018

@ggam The JAX-RS spec explicitly says that Servlets are NOT mandated, and JAX-RS MUST be able to run on pure Java SE, too.

@mkarg
Copy link
Contributor

mkarg commented Apr 9, 2018

@andymc12 The proposal is not that an implementation MUST support Java SE, but only that IF it supports Java SE it MUST support this particular API to boot it.

@jansupol
Copy link
Contributor

jansupol commented Apr 9, 2018

Well, see Section 2. For Java SE the Spec. says it may work:

An implementation MAY support zero or more endpoint types of any desired type ... How the resulting endpoint class instance is used to publish the application is outside the scope of this specification.

But the environment the implementation must work at is Servlet container.

@ggam
Copy link
Contributor

ggam commented Apr 9, 2018 via email

@jansupol
Copy link
Contributor

jansupol commented Apr 9, 2018

I am trying to say the implementation of async server operations is relied on Servlet 3.1, and without it, async should be optional.

@mkarg
Copy link
Contributor

mkarg commented Apr 9, 2018

I do not understand what we talk about here. All that this issue wants is in case an implementation supports Java SE it shall use a common API to boot it. Everything else is out of scope of this issue. So we now discussing async here?

@jansupol
Copy link
Contributor

jansupol commented Apr 9, 2018

Ah, we want just to specify a way to boot it, without defining what it should be capable of? Alright, it still can be useful for switching the implementations for JAXRS apps in microservices world... Sounds good.

@mkarg
Copy link
Contributor

mkarg commented Apr 9, 2018

Yes, @jansupol, the sole thing this issue tries to provide is a uniform API for possibly existing Java SE bootstrap, not anything more. And yes, the use case I had in mind actually is JAX-RS Microservices.

@mkarg
Copy link
Contributor

mkarg commented Apr 9, 2018

To better illustrate what I intend with this issue, I have set up a preliminary PR #619. Inline code comments welcome! :-)

@asoldano
Copy link

@mkarg I've commented on the PR

@mkarg
Copy link
Contributor

mkarg commented Apr 26, 2019

Closed by #619.

@mkarg mkarg closed this as completed Apr 26, 2019
@mkarg mkarg added the enhancement New feature or request label Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants