migrate URL generation in Views and Controllers to UrlGenerator

Issue #7 open
Robert Jäschke created an issue

Currently, almost all Views (JSPs) generate URLs on their own. This shall be migrated to the central class org.bibsonomy.services.UrlGenerator which already contains methods for some of the required URLs. Similarly, all URLs generated in Controllers should be generated by the UrlGenerator (look at the call hierarchy of the already existing methods to see where this already happens).

Before you can start, you need to solve a crucial challenge: The UrlGenerator shall be configured as a Spring bean but must be made available for the JSPs. Unfortunately, to the best of my knowledge, JSPs can only call static class methods. Hence, it is not trivial to expose the UrlGenerator. IIRC Daniel had some idea how to do this. Thus, please discuss this issue with Daniel and propose a solution.

Comments (18)

  1. Former user Account Deleted

    As you know, Tomcat 7 supports Servlet 3.0 and EL 2.2. Thus we may invoke methods from JSP files.

    The problem is that we are using a dependency called shindig, which provides another implementation of the expression language : JUEL. Currently we are using shindig 2.02 which in return uses JUEL 2.1.3, but EL 2.2 can only be used from JUEL 2.2 onwards.

    Hence i suggest updating shindig to support JUEL/EL 2.2. I hope that works.

  2. Daniel Zoller

    Shindig 2.5.1 has a dependency to JUEL 2.2.5, please update the shindig dependency and adapt our code to the new version.

  3. Former user Account Deleted

    Method invocation works now.

    The URLGenerator class has several overloaded methods, which poses a problem: The Expression language does not support method overloading, but will always use the first method from Class#getMethods() whose name and number of arguments match.

    The methods returned by getMethods() are in no particular order, so I think renaming the overloaded method is the only solution.

    Maybe we could rename methods like 'getUserUrl(String)' to 'getUserUrlByString(String)' or something?

  4. Robert Jäschke reporter

    Will/Should the URLGenerator also generate the URLs to external pages (e.g., for bookmarks)? If so, care should be taken to incorporate the nofollow attribute and possible schema.org annotations (@sdoerfel knows more about that).

  5. Daniel Zoller

    The following pages are missing:

    • search
    • popular tags, concepts, posts
    • post*
    • buttons
    • gettingStarted
    • join_group
    • buttons
    • editTags
    • import/jabref
    • settings
  6. Log in to comment