java - Jersey configure ResourceConfig to use FreemarkerMvcFeature -
i use code @ bottom programmatically configure grizzlywebserver. use freemarkermvcfeature, suggested added this:
new resourceconfig().register(org.glassfish.jersey.server.mvc.freemarker.freemarkermvcfeature)
the problem is, register method available in org.glassfish.jersey.server.resourceconfig
girzzly factory expects com.sun.jersey.api.core.resourceconfig
. there way register features com.sun.jersey.api.core.resourceconfig
?
// include resource classes in package somepackage resourceconfig rc = new packagesresourceconfig("somepackage"); // configure server use freemarker template engine map<string, object> params = new hashmap<string, object>(); params.put(freemarkerviewprocessor.freemarker_templates_base_path, "/src/main/resources/templates"); rc.setpropertiesandfeatures(params); // create server resource config httpserver server = grizzlyserverfactory.createhttpserver(base_uri, rc);
i think somehow mixed jersey 1 , jersey 2 dependencies. according https://jersey.java.net/apidocs/latest/jersey/org/glassfish/jersey/server/class-use/resourceconfig.html#org.glassfish.jersey.grizzly2.httpserver
jersey 2.0 grizzlyhttpserverfactory accepts org.glassfish.jersey.server.resourceconfig parameter.
Comments
Post a Comment