Giter Club home page Giter Club logo

Comments (20)

purplefox avatar purplefox commented on May 26, 2024

Thanks. Do you have a reproducer for this?
The easiest thing would be to copy and edit the realtime apex example in the examples repository.

from vertx-web.

leolux avatar leolux commented on May 26, 2024

I must be wrong with the cause of the 404. The SockJSHandler does not handle only root-paths. The RountingContextWrapper is setting the mountPoint in repsect to the parent mointPoint:

public RoutingContextWrapper(String mountPoint, HttpServerRequest request, Iterator iter,
RoutingContext inner) {
super(mountPoint, request, iter);
this.inner = inner;
String parentMountPoint = inner.mountPoint();
if (mountPoint.charAt(mountPoint.length() - 1) == '/') {
// Remove the trailing slash or we won't match
mountPoint = mountPoint.substring(0, mountPoint.length() - 1);
}
this.mountPoint = parentMountPoint == null ? mountPoint : parentMountPoint + mountPoint; //<- Here the parrent mountPoint gets added to the given mountPoint. So the handler will match for "/nonrootpath/info" in my case.
}

The 404 error disappeares when I remove all of my self-written handlers and when I have only one SockJSHandler registered. Currently I have to investigate why one of my own handlers produces a 404.

from vertx-web.

leolux avatar leolux commented on May 26, 2024

Ok, I've found the issue within the class RouteImpl. The cause for the 404 was a handler that I have registered on a path with an asterisk * at the end. The problem is that the current implementation of RouteImpl matches more paths than the author likely intented to do.

Regarding the documentation https://github.com/vert-x3/vertx-apex/blob/master/src/main/asciidoc/java/index.adoc the example path "/some/path/*" should be called for any request with a URI path that starts with "/some/path/". But that's not true :-) The trailing-slash will be removed during the path-match-check in the class RouteImpl, line 336, so it will be called for any request with a URI path that starts with "/some/path":

if (exactPath) {
return pathMatchesExact(requestPath, thePath);
} else {
return requestPath.startsWith(removeTrailing(thePath)); <- Here is the cause of matching too much
}

Is the path "/some/path/*" really meant to match "/some/pathfoo/bar.html" and "/some/path.html"?

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

Thanks, once you get a reproducer together, I'll take a look :)

from vertx-web.

leolux avatar leolux commented on May 26, 2024

Here is a simple Testcase. It can be used to update/added to io.vertx.ext.apex.RouterTest:
https://gist.github.com/leolux/0675612cc442f569faae

from vertx-web.

leolux avatar leolux commented on May 26, 2024

I like to run all Apex Unit-Tests. Is there any global TestSuite?

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

Not sure what you mean by "global testuite".

If you want to run all Apex tests you can do this in your IDE by right clicking the directory and run as... or from the command line: mvn test

from vertx-web.

leolux avatar leolux commented on May 26, 2024

Ok, that's even simpler :-)

from vertx-web.

leolux avatar leolux commented on May 26, 2024

I have some problems running the Apex Unit-Tests. From 381 tests there are 247 failures and 1 error. But I didn't make any changes in the code. How many tests are supposed to fail at the moment?

Do you plan to introduce Gerrit? Using Git in combination with Gerrit would be one way to assure that only those change sets will get merged into the master branch that have passed all tests in Jenkins.

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

Which operating system are you using?

from vertx-web.

leolux avatar leolux commented on May 26, 2024

Windows 8, Version 6.3 (64 bit)

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

There have been some trouble running on Windows in the past. I have merged a PR that should fix some of the issues. Trouble is non of the core team are Windows users.
Also.. when you clone the GitHub project can you make sure your Git client doesn't convert \n to \r\n?

from vertx-web.

leolux avatar leolux commented on May 26, 2024

You are right. The conversion to CRLF was the problem. So I changed my global config to:
core.autocrlf=false
core.eol=lf

Maybe we should force LF for this repository by adding the file .gitattributes containing the following line

  • text eol=lf

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

Not sure we want to convert everything to LF.

I think what is needed is for git to not do any conversions - i.e. just to respect whatever is in the repository and not change the line endings at all.

from vertx-web.

leolux avatar leolux commented on May 26, 2024

General question: How to propose fixes & unit-tests? I couldn't create a pull request somehow because I seem to have no permission do create a remote/upstream branch.

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

Pull requests are done in the standard fork and pull way:

https://help.github.com/articles/using-pull-requests/

from vertx-web.

leolux avatar leolux commented on May 26, 2024

Thx. Do you have a code style formatter for eclipse? The default settings do not match the existing formatting.

from vertx-web.

purplefox avatar purplefox commented on May 26, 2024

IntelliJ yes, not sure about eclipse

https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines

But settings should be pretty much default with the exception that we
use two spaces for tabs :)

On 30/03/15 14:08, leolux wrote:

Thx. Do you have a code style formatter for eclipse? The default
settings do not match with the existing formatting.


Reply to this email directly or view it on GitHub
#73 (comment).

from vertx-web.

leolux avatar leolux commented on May 26, 2024

I didn't find any plugin, converter or xml for eclipse that reflects existing codestyle from inelliJ. But I found a very similar code formatter from google that works better than the default eclipse formatter for vertx: https://code.google.com/p/google-styleguide/source/browse/trunk/eclipse-java-google-style.xml

from vertx-web.

leolux avatar leolux commented on May 26, 2024

Here is my PR: #84
The change didn't introduce any error/failure in any unit test.

from vertx-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.