1

I have a Jetty service that I run with Jetty programmatically. I have a Jetty class in the package package.of.my.jersey. I configure the server in the following way:

    ServletContextHandler context = new ServletContextHandler();
    context.setContextPath("/test");
    Map<String, Object> initMap = new HashMap<String, Object>();
    initMap.put("com.sun.jersey.api.json.POJOMappingFeature", "true");
    initMap.put("com.sun.jersey.config.property.packages",
            "package.of.my.jersey");

    context.addServlet(new ServletHolder(new ServletContainer(
            new PackagesResourceConfig(initMap))), "/newValue/*");

I run the service via "java -jar nameOfTheService.jar", and get the service works correctly for the methods that the Jersey class exposes.

I have also some HTML pages in the java/main/resources/package/of.my.jersey, and I want to access to them. The problem is that I havent find any way to access it. Is there anyway to allow other resources to run to be called via http in the same service?

Thank you in advance!

pokeRex110
  • 833
  • 2
  • 14
  • 26
  • 1
    There's a solution for web.xml configuration but it's quite easy to replicate this configuring programmatically: http://stackoverflow.com/questions/12422660/jersey-servlet-mapping-causes-404-error-for-static-resources/12428843#12428843 – Jonas Jul 13 '13 at 18:19
  • Thank you, it is what I was searching. ;) – pokeRex110 Jul 16 '13 at 16:07

1 Answers1

2

FYI: Using dropwizard makes life easier. It use Jetty for HTTP, Jersey for REST, Jackson for JSON and other good stuff for daily work.

user3280180
  • 1,393
  • 1
  • 11
  • 27