Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest annotations: problems with similar mapped path. #462

Closed
bitstorm opened this issue Feb 16, 2016 · 5 comments
Closed

Rest annotations: problems with similar mapped path. #462

bitstorm opened this issue Feb 16, 2016 · 5 comments

Comments

@bitstorm
Copy link
Contributor

Copied from bitstorm/Wicket-rest-annotations#4

I have the following two methods mapped:

@MethodMapping(value = "/path/get_from_path")
public Result getFromPath(@RequestParam("term") String term, @RequestParam("anotherterm") String term) {
    Result result = new Result();
    return result;
}

@MethodMapping(value = "/path/get_from_another_path")
public Result getFromAnotherPath(@RequestParam("term") String term, @RequestParam("anotherterm") String term) {
    Result result = new Result();
    return result;
}

When I visit this url localhost:8080/mountpoint/path/get_from_another_path?term=10&anotherterm=150 I get the following error:

org.apache.wicket.WicketRuntimeException: Ambiguous methods mapped for the current request: URL 'mountpoint/path/get_from_another_path?term=10&anotherterm=150', HTTP method GET. Mapped methods: getFromePath, getFromAnotherPath
    at org.wicketstuff.rest.resource.AbstractRestResource.throwAmbiguousMethodsException(AbstractRestResource.java:479) ~[wicketstuff-restannotations-7.2.0.jar:?]
    at org.wicketstuff.rest.resource.AbstractRestResource.selectMostSuitedMethod(AbstractRestResource.java:445) ~[wicketstuff-restannotations-7.2.0.jar:?]
    at org.wicketstuff.rest.resource.AbstractRestResource.respond(AbstractRestResource.java:179) ~[wicketstuff-restannotations-7.2.0.jar:?]
    at org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:105) ~[wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:108) ~[wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865) ~[wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) ~[wicket-request-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284) [wicket-core-7.1.0.jar:7.1.0]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.Server.handle(Server.java:499) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
18:31:21.621 [qtp258447256-18] WARN  RequestCycleExtra - ********************************
18:31:21.622 [qtp258447256-18] ERROR org.apache.wicket.DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Ambiguous methods mapped for the current request: URL 'inhanawerest/subheading/term_to_abstract?subheading=10&term=150', HTTP method GET. Mapped methods: getDocumentAbstracts, getHeadings
    at org.wicketstuff.rest.resource.AbstractRestResource.throwAmbiguousMethodsException(AbstractRestResource.java:479) ~[wicketstuff-restannotations-7.2.0.jar:?]
    at org.wicketstuff.rest.resource.AbstractRestResource.selectMostSuitedMethod(AbstractRestResource.java:445) ~[wicketstuff-restannotations-7.2.0.jar:?]
    at org.wicketstuff.rest.resource.AbstractRestResource.respond(AbstractRestResource.java:179) ~[wicketstuff-restannotations-7.2.0.jar:?]
    at org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:105) ~[wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:108) ~[wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865) ~[wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) ~[wicket-request-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203) [wicket-core-7.1.0.jar:7.1.0]
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284) [wicket-core-7.1.0.jar:7.1.0]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.Server.handle(Server.java:499) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]

Is this intended behavior?
The paths are distinct and from my point of view the exception should not be thrown.

@sleighsoft
Copy link

As the Maven package has not been updated yet, my question is:
How can I create a jar from your project?
mvn package fails with an error and I really need that feature.

@sleighsoft
Copy link

You should update your pom.xml to the new snapshot 7.2.0 -> 7.3.0 version.

<parent>
        <groupId>org.wicketstuff</groupId>
        <artifactId>wicketstuff-core</artifactId>
        <version>7.3.0-SNAPSHOT</version>
</parent>

Then building the package works again.

@bitstorm
Copy link
Contributor Author

for some reason pom version has not been bumped for all submodules. I will try to fix it asap.

@sleighsoft
Copy link

I know this is probably a good request for a new issue. But could you implement something like @QueryParam that can convert term=X&term=Y&term=Z to a List like jax-rs does?

@bitstorm
Copy link
Contributor Author

Hi,

the snapshot release containing the fix is now available. Just add snapshot repository to our pom:

<repository> <id>wicketstuff-core-snapshots</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <snapshots> <enabled>true</enabled> </snapshots> </repository>

please open an new ticket for the requested feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants