I am trying to understand what is the difference between JerseyServletModule present in jersey-guice library and ServletModulepresent in Guice library.
What is the difference between JerseyServletModule and ServletModule?
695 Views Asked by NinjaCoder At
1
There are 1 best solutions below
Related Questions in JERSEY
- Error getting json jax-rs
- How to get rid of WebKitFormBoundary in uploaded file
- MULTIPART_FORM_DATA: No injection source found for a parameter of type public javax.ws.rs.core.Response
- Jersy Rest service to accept java.util.Map for MediaType.APPLICATION_JSON
- Pass parameter data from JQuery/Ajax call to Jersey web service
- Jersey Client - Variable types are ignored
- Uploading a document usibg fabric3
- Jersey version issue: MessageBodyReader not found for media type=application/xml
- Guice + Jersey + Spring data
- What options are there to do output validation of Jersey resources?
- Include null field values in Jersey REST Response
- in jersey 2.x am getting the error like java.util.concurrent.ExecutionException
- Jersey Client, memory leak, static and concurrency
- Java Restful Service eclipse tomcat HTTP Error 404
- Routing all Jersey REST requests through a method prior to execution
Related Questions in GUICE
- Guice + Jersey + Spring data
- Inject a TypeListener
- Specs2/Guice issue in Play 2.4.0 functional tests
- Guice : Inject an ArrayList of Strings
- Jersey 2 with Guice 4 on Glassfish 4.1
- Jersey resource that matches any path
- Guice Injection into Google Cloud Endpoints Transformer
- constructor cannot distinguish between multiple occurrences of the same primitive type
- Using non-static injected services in JUnit Parameterized Tests
- Modern Akka DI with Guice
- Jersey & Guice: How to appoint base path to each ServletModule?
- Constructor parameter injection using guice
- Inject values of a Map with Guice
- What Guice MethodInterceptor should return
- Guice inject context instance that is created upon each request
Related Questions in GUICE-SERVLET
- Jersey & Guice: How to appoint base path to each ServletModule?
- Testing a project using Guice Servlet: How to bind out-of-scope RequestScoped instances?
- How do I start/stop a service in a web application with Guice
- Update to entity is not recognized or persisted when using guice-persist
- Session state using guice
- Provider extending
- How to map a filter to a servlet using guice-servlet?
- Guice 3.0 request.getRequestDispatcher(..).forward prepending guice servlet path
- Guice - How to provide the same key differently in different scopes?
- When using the guice servlet extension is it possible to react to servlet destruction?
- Injecting using request scope and threads
- guice servlet is not a singleton
- how to use guice correctly for dependency inject in java servlets?
- Using Guice dependency injection in HttpServlet with Kotlin
- Embedded jetty and guice Handler servlet upon request domain(vhost)
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
TL;DR - JerseyServletModule is dead. It used to (in the Jersey 1 days) allow you to use Jersey and Guice and have them play nice. That's no longer simple.
ServletModule is a Guice module which allows you to configure servlets, servlet mappings, filters and filter mappings (amongst other things) using Guice as well as inject objects into your servlets. Create a class which inherits from ServletModule and override the
configureServletsmethod a bit like this:The documentation for building webservices with Guice and ServletModule is here.
Jersey is an implementation of of the JSR 370 so called JAX-RS API for creating rest services. It allows you to build rest services with little more than annotated classes - for example:
In the old days of Jersey 1.0, overriding
JerseyServletModuleinstead ofServlet Modulewould permit you to do both at the same time, so the above class could become:However as I alluded in the opening, there is no equivalent of JerseyServletModule in Jersey 2.0. Your options are to configure an HK-Guice bridge and continue with Jersey, or to use RestEasy which is an alternative JAX-RS implementation which does play nicely with guice.