Get request URI from UIProviderEvent

Hi,

I wrote my own UIProvider and need a way to get the request URI from an UIProviderEvent.
Right now my code looks like this:

val request = event.request as VaadinServletRequest
val urlPattern = request.requestURI

I would like to avoid the explicit cast of the given VaadinRequest to a VaadinServletRequest, but I could not find any method in VaadinRequest to get the currently used URI.

Is there a way that I’m not aware of? Why is there no getRequestURI() method in VaadinRequest?

Any advice is highly appreciated.

Kind regards,
Thomas

Hi Adam,

thanks for your answer. I’m only using Servlets so I think i will stick with the aforementioned solution :slight_smile:

Hi, there is no such method in the interface because other implementations, such as VaadinPortletRequest doesn’t have a request URI as such. If you know that you are using servlets, don’t worry about casting the object.