Abdera
  1. Abdera
  2. ABDERA-146

Bad entry edit link created in my server when using a provider base path

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.4.0
    • Fix Version/s: 1.0
    • Labels:
      None

      Description

      My Abdera servlet is not mapped to the root of my application context. It is mapped to /atom/*, so that my application context can host multiple servlets and a static HTML site at the root path.

      Thus, I create my provider with a base of /atom/. This in turn creates the following route: /atom/:collection/:entry

      When I GET an entry, the resolving part goes well. However, the generated edit link for this entry duplicates the base part of the URI.

      RouteManager.urlFor(RequestContext, Object, Object) line: 158
      SpringProvider(AbstractProvider).urlFor(RequestContext, Object, Object) line: 102
      ServletRequestContext(AbstractRequestContext).urlFor(Object, Object) line: 184
      MovieAdapter(AbstractCollectionAdapter).getHref(RequestContext) line: 82
      MovieAdapter(AbstractEntityCollectionAdapter<T>).getFeedIriForEntry(T, RequestContext) line: 548
      MovieAdapter(AbstractEntityCollectionAdapter<T>).getEntryFromCollectionProvider(RequestContext) line: 721
      MovieAdapter(AbstractEntityCollectionAdapter<T>).getEntry(RequestContext) line: 316
      SpringProvider(AbstractProvider).process(RequestContext) line: 155

      The last stack frame (urlFor) is where I believe the error is. The route expands properly and includes the provider base path. However, the getTargetBasePath() call concatenates the application context with the servlet path, the servlet path being equal to the provider base path.

      Real values used in my tests:

      application context: /imdb
      provider base: /atom/
      adapter href: movies
      GET URI: http://localhost:8080/imdb/atom/movies/12345

      The generated edit URI is: http://localhost:8080/imdb/atom/atom/movies/12345

      Thanks for looking into this.

      Remy

      1. route_manager.patch
        3 kB
        David Calavera
      2. DefaultWorkspaceManager.patch
        0.7 kB
        Remy Gendron

        Activity

        Remy Gendron created issue -
        Remy Gendron made changes -
        Field Original Value New Value
        Description My Abdera servlet is not mapped to the root of my application context. It is mapped to /atom/*, so that my application context can host multiple servlets and a static HTML site at the root path.

        Thus, I create my provider with a base of /atom/. This in turn creates the following route: /atom/:collection/:entry

        When I GET an entry, the resolving part goes well. However, the generated edit link for this entry duplicates the base part of the URI.

        RouteManager.urlFor(RequestContext, Object, Object) line: 158
        SpringProvider(AbstractProvider).urlFor(RequestContext, Object, Object) line: 102
        ServletRequestContext(AbstractRequestContext).urlFor(Object, Object) line: 184
        MovieAdapter(AbstractCollectionAdapter).getHref(RequestContext) line: 82
        MovieAdapter(AbstractEntityCollectionAdapter<T>).getFeedIriForEntry(T, RequestContext) line: 548
        MovieAdapter(AbstractEntityCollectionAdapter<T>).getEntryFromCollectionProvider(RequestContext) line: 721
        MovieAdapter(AbstractEntityCollectionAdapter<T>).getEntry(RequestContext) line: 316
        SpringProvider(AbstractProvider).process(RequestContext) line: 155

        The last stack frame (urlFor) is where I believe the error is. The route expands properly and includes the provider base path. However, the getTargetBasePath() call concatenates the application context with the servlet path, the servlet path being equal to the provider base path.

        Thanks for looking into this.

        Remy
        My Abdera servlet is not mapped to the root of my application context. It is mapped to /atom/*, so that my application context can host multiple servlets and a static HTML site at the root path.

        Thus, I create my provider with a base of /atom/. This in turn creates the following route: /atom/:collection/:entry

        When I GET an entry, the resolving part goes well. However, the generated edit link for this entry duplicates the base part of the URI.

        RouteManager.urlFor(RequestContext, Object, Object) line: 158
        SpringProvider(AbstractProvider).urlFor(RequestContext, Object, Object) line: 102
        ServletRequestContext(AbstractRequestContext).urlFor(Object, Object) line: 184
        MovieAdapter(AbstractCollectionAdapter).getHref(RequestContext) line: 82
        MovieAdapter(AbstractEntityCollectionAdapter<T>).getFeedIriForEntry(T, RequestContext) line: 548
        MovieAdapter(AbstractEntityCollectionAdapter<T>).getEntryFromCollectionProvider(RequestContext) line: 721
        MovieAdapter(AbstractEntityCollectionAdapter<T>).getEntry(RequestContext) line: 316
        SpringProvider(AbstractProvider).process(RequestContext) line: 155

        The last stack frame (urlFor) is where I believe the error is. The route expands properly and includes the provider base path. However, the getTargetBasePath() call concatenates the application context with the servlet path, the servlet path being equal to the provider base path.

        Real values used in my tests:

        application context: /imdb
        provider base: /atom/
        adapter href: movies
        GET URI: http://localhost:8080/imdb/atom/movies/12345

        The generated edit URI is: http://localhost:8080/imdb/atom/atom/movies/12345

        Thanks for looking into this.

        Remy
        David Calavera made changes -
        Attachment route_manager.patch [ 12380163 ]
        David Calavera made changes -
        Attachment route_manager.patch [ 12380163 ]
        David Calavera made changes -
        Attachment route_manager.patch [ 12380168 ]
        Remy Gendron made changes -
        Attachment DefaultWorkspaceManager.patch [ 12380182 ]
        Dan Diephouse made changes -
        Assignee Dan Diephouse [ dandiep ]
        Dan Diephouse made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Dan Diephouse made changes -
        Fix Version/s 0.5.0 [ 12313105 ]

          People

          • Assignee:
            Dan Diephouse
            Reporter:
            Remy Gendron
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development