Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365633

Summary: Register entrypoints by path instead of name
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 1.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Ralf Sternberg CLA 2011-12-05 11:58:05 EST
Usually, application entrypoints should be available at a certain path. Currently, for an entrypoint to be available at the path "/context/dashboard" (with "/context" being the application's path), it has to be registered like this:

  public void configure( ApplicationConfiguration configuration ) {
    configuration.addEntryPoint( "default", EntryPoint.class );
    configuration.addBranding( new AbstractBranding() {
      public String getServletName() {
        return "dashboard";
      }
    } );
  }

I think that the registration path is more a matter of the entrypoint registration than of the branding. Therefore, I would propose to change the semantics of the addEntryPoint methods to accept the path as their first parameter:

  void addEntryPoint( String path, Class<? extends IEntryPoint> entryPointType );
  void addEntryPoint( String path, IEntryPointFactory entryPointFactory );

This would reduce the above code to:

  public void configure( ApplicationConfiguration configuration ) {
    configuration.addEntryPoint( "dashboard", EntryPoint.class );
  }

If we follow this proposal, this would render some methods in AbstractBranding obsolete. I'd suggest to address this in a separate bug.
Comment 1 Ralf Sternberg CLA 2012-02-18 15:04:56 EST
Changed ApplicationConfiguration to accept *paths instead of names* in registerEntryPoint().  The paths must follow the same pattern as used in HttpService's register methods. They must begin with a slash, but not end with a slash. Currently, neither the root path ("/") nor nested paths are supported. Here's an example of registering an entry point to be accessible at http://host/dashboard :

public void configure( ApplicationConfiguration configuration ) {
  configuration.addEntryPoint( "/dashboard", DashboardEntryPoint.class );
}

Added a "path" attribute to the entrypoint extension point and deprecated the old "parameter" attribute.

With these changes in place, entry points should not be registered by name anymore (see also bug 371935).