Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Custom HTTP Headers - Resource Seeking

Bryson Dunn
8 years ago Mar 14, 2015 4:02pm
Bryson Dunn
8 years ago Mar 25, 2015 5:01am
Bryson Dunn
7 years ago May 14, 2015 12:10am

After a closer look at the methods exposed by `AbstractJavaScriptComponent` I found the best solution is to override `handleConnectorRequest`. Wish I would have found this sonner!

public boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, String path) {
    try {
        if (path.startsWith("0")) {
            response.setHeader("Accept-Ranges", "bytes");
        return super.handleConnectorRequest(request, response, path);
    } catch (IOException e) {
        return true;

You can obviously target specific connector resources with this. In my implementation I also catch IOExceptions which occur  when the client aborts connections to a resource - these were thrown each time the source of the player changed. Hope this helps someone.


ayush kaushik
4 years ago Mar 04, 2019 5:39am