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

index.html (welcome page) now dynamic #37680

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

phillip-kruger
Copy link
Member

@phillip-kruger phillip-kruger commented Dec 12, 2023

The welcome page

The static index.html page that get generated with a quarkus app, is now replace with a dynamic page from Dev UI. This page will render on the naked domain if the user does not provide their own index.html (and only in Dev mode)

dynamic_welcome

The not found page

This PR also moves the Not Found page (that renders in Dev Mode) to Vertx-http, removing it from resteasy-reactive, resteasy-classic, spring-web, reactive-routes. Also, undertow should also now display this not found page.

The handler for Not found is last in the queue, so any user, or extension, can override this behavior, by adding their own handler for Not Found.

new_screens

@ia3andy ResumeOn404BuildItem should not be needed anymore. Please can you confirm (I might be wrong) and if so we can remove ResumeOn404BuildItem on another PR

The management interface is now also working. The links (for management interfaces) was omitted in the NotFoundPage (in the current version). I have now added them, and also added a Not Found Page for the management interface. So now if you enable management, and go to 0.0.0.0:9000/non-existing-resource, that will show the Not Found page, with the links correctly added

Breaking change (with a workaround if needed)

In the current version, if you have a JAX-RS Filter, that filter will run, even in the case that the requested resource was not a REST resource (in my opinion, that is wrong). This will not happen anymore. Filters for JAX-RS will now only run on JAX-RS resources. In the case that you want your Filters to also run on non JAX-RS resource, you need to add your own ExceptionMapper:

package io.quarkus.resteasy.reactive.server.test.customproviders;

import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

@Provider
public class NotFoundExeptionMapper implements ExceptionMapper<NotFoundException> {
    @Override
    public Response toResponse(NotFoundException exception) {
        return Response.status(404).build();
    }
}

Now, JAX-RS becomes responsible for the Not Found resources, and the Filter will run. In the current version where this always happens, it makes it impossible for other extensions to handle Not Found.

The routes page

This PR also includes a new tab in the Endpoints menu in Dev UI, that display the routes and their order. It's not perfect, but something we can build on, and it does help with debugging.

image

This also:

@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform area/vertx labels Dec 12, 2023
@quarkusio quarkusio deleted a comment from quarkus-bot bot Dec 12, 2023
@maxandersen
Copy link
Contributor

Wdym about the codestart info?

It's added in readme and index.html - now jt will just be in the readme or is it something different you refer to?

@cescoffier
Copy link
Member

I like the idea but what happen in test and prod mode?

@quarkus-bot

This comment has been minimized.

@phillip-kruger
Copy link
Member Author

phillip-kruger commented Dec 12, 2023

Wdym about the codestart info?

It's added in readme and index.html - now jt will just be in the readme or is it something different you refer to?

@maxandersen Yes, that is what I mean, it is not in the index.html anymore. I could probably still get it with some effort. (this is where I need @ia3andy to comment)

I like the idea but what happen in test and prod mode?

@cescoffier in test and prod the route that serve the index.html will not be created. This (I think) is more correct. At the moment the generated index.html will be served (in prod !) and it's highly unlikely that this is what the user want. The user can create their own index.html and then that will be served in dev, test and prod. However, we should probably guide the user to the UI options in Quarkus (Quinoa, Web Bundler, Renade etc) and a plain static file in META-INF resources has it's limits. Maybe we need a guide that starts with plain static resource, then Renade, then Web bundler then Quinoa ?

@cescoffier
Copy link
Member

@phillip-kruger ok, that's what I got. It is a change in behavior that I would consider to be a breaking change (aka need to be documented).

@phillip-kruger
Copy link
Member Author

Why is this build failing :(

@quarkus-bot

This comment has been minimized.

@phillip-kruger phillip-kruger force-pushed the index-html-to-dev-ui branch 2 times, most recently from 1a00876 to 676a0f0 Compare December 13, 2023 00:50
@phillip-kruger
Copy link
Member Author

@maxandersen @cescoffier I fixed the issues in the CI Build, please can you have a look. If you are happy as is we can maybe merge and then improve going forward ?

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@phillip-kruger
Copy link
Member Author

We have a chicken egg problem here... I need to spend some more time on this. Please ignore PR for now, I'll ping you when ready

@ia3andy
Copy link
Contributor

ia3andy commented Dec 18, 2023

The message should be something like "This page is served by the Quarkus Dev UI (only in dev mode ) until you provide your own Web UI or disable it."

Also when it's available we should point to the new guide (still not available yet) about creating Web apps with Quarkus: #37097 (comment)

@ia3andy
Copy link
Contributor

ia3andy commented Dec 18, 2023

For the data I get from the codestarts, now that this has moved, we should move this info to the extension descriptors and provide a way for the dev-ui to access it:
Example:
from here: https://github.com/quarkusio/quarkus/blob/main/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/funqy-http-codestart/codestart.yml#L6-L9
to here: https://github.com/quarkusio/quarkus/blob/main/extensions/funqy/funqy-http/runtime/src/main/resources/META-INF/quarkus-extension.yaml#L12

@phillip-kruger do you already have access to this descriptor data from the dev ui?

@phillip-kruger
Copy link
Member Author

Yes I have, but I don't think all extensions is up to date w.r.t those entries.

@maxandersen
Copy link
Contributor

maxandersen commented Dec 18, 2023

I don't think it makes sense to have this info in the extension descriptor available at runtime.
its a devtime possiblye buildtime only thing.

@ia3andy
Copy link
Contributor

ia3andy commented Dec 18, 2023

I don't think it makes sense to have this info in the extension descriptor available at runtime. its a devtime possiblye buildtime only thing.

I am not sure what you mean/imply?

@maxandersen
Copy link
Contributor

@ia3andy we shouldn't add wall of text into extensions.yaml that is part of runtime artifact that is only relevent for codestarts/dev page.

@geoand
Copy link
Contributor

geoand commented Mar 12, 2024

The Big Rename for REST is already in.

@phillip-kruger
Copy link
Member Author

Yes, I rebased this pr on that, had a few conflicts to resolve.

Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
@quarkus-bot

This comment has been minimized.

Copy link
Member

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this one in, we can always improve later.

@geoand geoand added triage/waiting-for-ci Ready to merge when CI successfully finishes release/noteworthy-feature and removed area/core area/maven area/resteasy area/undertow area/spring Issues relating to the Spring integration area/platform Issues related to definition and interaction with Quarkus Platform area/resteasy-reactive labels Mar 13, 2024
@gsmet gsmet merged commit a00ccdd into quarkusio:main Mar 13, 2024
49 of 50 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Mar 13, 2024
@quarkus-bot quarkus-bot bot added kind/enhancement New feature or request and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Mar 13, 2024
@phillip-kruger
Copy link
Member Author

Thanks everyone :)

@maxandersen
Copy link
Contributor

good stuff @phillip-kruger was about to comment same as clement: get it in an iterate.

what will be important is that we document how this works/breaks(?) when trying to add/update content.

One thing - i didn't check - does codestart generate with or without index.html in place?

@phillip-kruger
Copy link
Member Author

It should now generate without the index.html

@maxandersen
Copy link
Contributor

cool - and it still puts index.html when generating for 3.8 and older?

@phillip-kruger
Copy link
Member Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/vertx kind/enhancement New feature or request release/noteworthy-feature triage/flaky-test
Projects
None yet
6 participants