hilla
hilla copied to clipboard
The handling of "namesake" Endpoints in Flow 4
In Vaadin 17 preview, with flow version 4.0.0.alpha3
If you have class Endpoint1 (in package A) as...
@Endpoint
@AnonymousAllowed
@Component("notEndpoint")
public class Endpoint1 {
public String meriKreikan2() {
return "Kreikan Meri 2!";;
}
}
And then another Endpoint1 class in package B as...
@Endpoint
@AnonymousAllowed
public class Endpoint1 {
public String meriKreikan1() {
return "Kreikan Meri 1!";
}
}
Outcome is that generated typescrypt Endpoint1 class will look something like this...
import client from './connect-client.default';
function _meriKreikan1(): Promise<string> {
return client.call('Endpoint1', 'meriKreikan1');
}
export {_meriKreikan1 as meriKreikan1};
function _meriKreikan2(): Promise<string> {
return client.call('Endpoint1', 'meriKreikan2');
}
export {_meriKreikan2 as meriKreikan2};
I assume there should be some duplicate endpoint checks somewhere? I didn't notice even warning when these generated classes were made. Also it was even happy to that two endpoints shared identical public methods. Spring is only thing that noticed duplicates, that's why spring name had to be renamed in Component annotation.
Assuming you try to call both meriKreikan1 and meriKreikan2 from the client side, one of those will work, and another will give 404. No good errors shown anywhere to give a hint that it was caused by duplicate endpoints.