Ticket #1187 (closed enhancement: fixed)

Opened 14 months ago

Last modified 8 months ago

Application resource requests passed to URIHandler

Reported by: Marko Gronroos Owned by: Marko Gronroos
Priority: undefined Milestone: User Interface Library 5.2.0 RC4
Component: Documentation Version: 5.0.0-pre
Keywords: Cc:
Known Issue description:
Hours estimate: 1 Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: yes
Known Issue workaround:
Affects release notes: yes Contract:

Description

If I have a class resource (or some other application resource type), there will be a request for an APP/ object. This is passed to URIHandler of Application. It can be handled somewhat easily, but may be very unexpected and it would probably be best to handle it before the URIHandler.

Below is a workaround:

   public DownloadStream handleURI(URL context, String relativeUri) {
        if (relativeUri.startsWith("APP"))
            return super.handleURI(context, relativeUri);

Change History

Changed 14 months ago by Jani Laakso

  • priority changed from minor to trivial

I'd keep it this simple, developer might want to do some processing for class resources and this is the way to do it.

Unless, there already is a better way to handle these?

We could of course make our API better by adding handleResourceURI which typically developers would not override but I would not enlarge our API for now.

Changed 12 months ago by Joonas Lehtinen

  • milestone set to User Interface Library 5.1.0 RC

Changed 11 months ago by Joonas Lehtinen

  • priority changed from trivial to undefined

Changed 10 months ago by Jani Laakso

  • owner changed from Matti Tahvonen to Jani Laakso
  • status changed from new to assigned

Yes, Toolkit Resource objects should not fall down for handleURI.

If someone wishes to handle resources dynamically they should override handleURI and use own "proprietary" means without use of Toolkit Resource objects because these resources are mapped to special reserved URI */APP/*.

Another solution would be to extend Toolkit resource class and add custom resource handling stream code there..

Changed 10 months ago by Jani Laakso

  • status changed from assigned to new

Changed 10 months ago by Jani Laakso

  • owner changed from Jani Laakso to Marko Gronroos
  • milestone changed from User Interface Library 5.1.2 to Sprint 4 backlog

Ahh, this is but a documentation issue. You should not extend Application, you should do this instead:

 public void init() {

        final Window main = new Window("Hello window");
        setMainWindow(main);

        URIHandler uriHandler = new URIHandler() {
            public DownloadStream handleURI(URL context, String relativeUri) {
                System.out.println("handleURI=" + relativeUri);
                // TODO Auto-generated method stub
                return null;
            }
        };
        main.addURIHandler(uriHandler);

    }

Above code does not receive calls from Toolkit resources, they are handled earlier.

If you do extend Application and override handleURI method then you should understand that your custom application is responsible of handling of Toolkit resources aswell (such as APP resources, native window resources).

Add this to documentation..

Changed 10 months ago by Jani Laakso

The reason why handleURI method is public is because ApplicationServlet? requires it.

Changed 10 months ago by Joonas Lehtinen

  • milestone changed from Sprint 4 backlog to User Interface Library 5.1.2

Milestone Sprint 4 backlog deleted

Changed 10 months ago by Jani Laakso

  • type changed from defect to enhancement
  • component changed from Server-side framework to Documentation

Changed 9 months ago by Joonas Lehtinen

  • milestone changed from User Interface Library 5.1.2 to User Interface Library 5.2.0

Milestone User Interface Library 5.1.2 deleted

Changed 8 months ago by Matti Tahvonen

  • status changed from new to closed
  • resolution set to fixed

in [4528] to Application.handleUri() javadocs. Magi, it is up to you to consider if the case needs something into manual also.

Changed 8 months ago by Marko Gronroos

Some documentation in [4530], may need some further work, the example is a bit limited.

Note: See TracTickets for help on using tickets.