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

Root path and resource specific path ignored #5

Closed
ncolomer opened this issue Mar 21, 2012 · 1 comment
Closed

Root path and resource specific path ignored #5

ncolomer opened this issue Mar 21, 2012 · 1 comment
Labels

Comments

@ncolomer
Copy link

I was not able to change the path of my resource using the Builder:

Config config = new Config.Builder()
    .host("127.0.0.1")
    .port(8080)
    // First try
    .path("/MapPush/api/")
    // Second try
    .resource("/MapPush/api/", EventResource.class)
    .build();
server = new Nettosphere.Builder().config(config).build();
server.start();

The first and second try don't give any results: my resource is always mapped to root /*
Moreover, the log always shows the following line:

10:04:52.050 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path: /*
@ncolomer
Copy link
Author

After observing the Config.Builder#resource(String path, Class<?> c):

public Builder resource(String path, Class<?> c) {
    try {
        if (AtmosphereHandler.class.isAssignableFrom(c)) {
            handlers.put(path, AtmosphereHandler.class.cast(c.newInstance()));
        } else if (Servlet.class.isAssignableFrom(c)) {
            handlers.put(path, new ReflectorServletProcessor(Servlet.class.cast(c.newInstance())));
        } else {
            // TODO: NOT clear
            applicationPath = path;
            initParam("com.sun.jersey.config.property.packages", c.getPackage().getName());
        }
    } catch (Exception ex) {
        logger.error("Invalid resource {}", c);
    }
    return this;
}

I understood that path means namespace of the resource class, not the servlet-mapping path. My mistake :)

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

No branches or pull requests

1 participant