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
CCDM: Adding a JsInit Handler for JS bootstrapper #6127
Conversation
435c017
to
de6213d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 5 files at r1, 6 of 6 files at r2.
Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained (waiting on @manolo)
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 202 at r2 (raw file):
@Override public boolean synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (session.getService().getDeploymentConfiguration().isCompatibilityMode()) {
Do you think we should also put this condition in canHandleRequest
?
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 296 at r2 (raw file):
} private JsonObject getInitialUidl(UI ui) {
This method and others around here are duplicated with those in com.vaadin.flow.server.BootstrapHandler.BootstrapPageBuilder
because of the way they were implemented. Do you think that we should worry about it or just accept it for now and refactor them later?
flow-server/src/test/java/com/vaadin/flow/server/MockVaadinServletService.java, line 19 at r2 (raw file):
import javax.servlet.ServletException;
This change seems unrelated but it's up to you
flow-server/src/test/java/com/vaadin/flow/server/MockVaadinSession.java, line 21 at r2 (raw file):
import java.util.concurrent.locks.ReentrantLock; import com.vaadin.flow.server.VaadinService;
This change seems unrelated but it's up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained (waiting on @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 202 at r2 (raw file):
Previously, qtdzz (Tien Nguyen) wrote…
Do you think we should also put this condition in
canHandleRequest
?
Done.
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 296 at r2 (raw file):
Previously, qtdzz (Tien Nguyen) wrote…
This method and others around here are duplicated with those in
com.vaadin.flow.server.BootstrapHandler.BootstrapPageBuilder
because of the way they were implemented. Do you think that we should worry about it or just accept it for now and refactor them later?
Refactored. There were not part of the public API.
b1356d3
to
7caa295
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @vaadin-bot from a discussion.
Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained (waiting on @manolo and @qtdzz)
7d6b40c
to
ec2ca61
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 4 files at r3, 2 of 2 files at r4.
Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained (waiting on @caalador)
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 136 at r4 (raw file):
!VaadinSession.getCurrent().getService()
Minor: is it safer to use request.getService()
instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r5.
Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained (waiting on @caalador)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @vaadin-bot from a discussion.
Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained (waiting on @caalador)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 5 files at r1, 2 of 6 files at r2, 3 of 4 files at r3, 1 of 2 files at r4, 2 of 2 files at r5.
Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
} /**
Moving these around makes no sense for the actual ticket. Please revert this
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 54 at r5 (raw file):
given for
needed to
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 57 at r5 (raw file):
is thought for CCDM projects whose `index.html` response does not have any bootstrap code
is for client driven projects where index.html
does not contain bootstrap data.
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 58 at r5 (raw file):
but it's responsability of the `@vaadin/flow` client
Bootstrapping is the responsibility of @vaadin/flow
client code
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 63 at r5 (raw file):
JsInitHandler
Would be good to have the info about what this is in the name so JsInitBootstrapHandler
or JavaScriptBootsrtapHandler
as we have for WebComponentBootstrapHandler
Also if JsInit correct or should it be more like ClientJsonBootstrapHandler
as from the server we don't handle JS in the handler, but do return json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
Previously, caalador wrote…
Moving these around makes no sense for the actual ticket. Please revert this
Otherwise we need to copy this code in the other class, @qtdzz suggested not to repeat code which is a good practice.
This is private API and does not break anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
Previously, manolo (Manuel Carrasco Moñino) wrote…
Otherwise we need to copy this code in the other class, @qtdzz suggested not to repeat code which is a good practice.
This is private API and does not break anything
Take a look to first change in the PR, it was not modifiying this class, but repeated code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
Previously, manolo (Manuel Carrasco Moñino) wrote…
Take a look to first change in the PR, it was not modifiying this class, but repeated code
I see only one change and that just moves the methods to another position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
Previously, caalador wrote…
I see only one change and that just moves the methods to another position.
It's moving from one class to another in the same file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo and @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
Previously, manolo (Manuel Carrasco Moñino) wrote…
It's moving from one class to another in the same file
I meant BootstrapPageBuilder -> BootstrapHandler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @manolo)
flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java, line 723 at r5 (raw file):
Previously, manolo (Manuel Carrasco Moñino) wrote…
I meant BootstrapPageBuilder -> BootstrapHandler
800 line internal class is not ok... The internal classes should really be broken out at some point for less sanity loss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @caalador and @qtdzz)
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 54 at r5 (raw file):
Previously, caalador wrote…
given for
needed to
Done.
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 57 at r5 (raw file):
Previously, caalador wrote…
is thought for CCDM projects whose `index.html` response does not have any bootstrap code
is for client driven projects where
index.html
does not contain bootstrap data.
Done.
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 58 at r5 (raw file):
Previously, caalador wrote…
but it's responsability of the `@vaadin/flow` client
Bootstrapping is the responsibility of
@vaadin/flow
client code
Done.
flow-server/src/main/java/com/vaadin/flow/server/communication/JsInitHandler.java, line 63 at r5 (raw file):
Previously, caalador wrote…
JsInitHandler
Would be good to have the info about what this is in the name so
JsInitBootstrapHandler
orJavaScriptBootsrtapHandler
as we have forWebComponentBootstrapHandler
Also if JsInit correct or should it be more likeClientJsonBootstrapHandler
as from the server we don't handle JS in the handler, but do return json.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r6.
Reviewable status: complete! all discussions resolved, 1 of 1 LGTMs obtained
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all discussions resolved, 2 of 1 LGTMs obtained
|
||
config.put(ApplicationConstants.SERVICE_URL, serviceUrl); | ||
|
||
// TODO(manolo) this comment is left intentionally because we |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @vaadin-bot from a discussion.
Reviewable status: complete! all discussions resolved, 2 of 1 LGTMs obtained
Part of the #6133 this change adds a bootstrap-handler to be called from the flow-client javascript.
The handler creates the user session, and the flow UI, returning a JSON that is used in the browser to run the bootstrap script that configures the hosted page and loads the flow-client module.
This handler is required in CCDM projects because flow does not need to be initialized until the user actually navigates to a view provided by flow instead of a pure client view.
This change is