Questions tagged [guice-servlet]

Guice's servlet extensions allow you to completely eliminate web.xml from your servlet application and take advantage of type-safe, idiomatic Java configuration of your servlet and filter components

Guice Servlet Extensions

Guice Servlet provides a complete story for use in web applications and servlet containers. Guice's servlet extensions allow you to completely eliminate web.xml from your servlet application and take advantage of type-safe, idiomatic Java configuration of your servlet and filter components.

This has advantages not only in being able to use a nicer API for configuring your web applications, but also in tying together dependency injection with web components. Meaning that your servlets and filters benefit from:

  • Constructor injection
  • Type-safe, idiomatic configuration
  • Modularization (package and distribute custom Guice Servlet libraries)
  • Guice AOP

While keeping the benefits of the standard servlet lifecycle.

References

100 questions
0
votes
1 answer

Using Guice dependency injection in HttpServlet with Kotlin

Im having a trouble with injecting dependencies into my HttpServlet. If I use constructor injection, I get servlet instantiation error, because of absence of empty constructor (even when i use kotlin-noarg plugin). If I use @Inject on lateinit var I…
mustafo
  • 59
  • 1
  • 7
0
votes
1 answer

What is the difference between JerseyServletModule and ServletModule?

I am trying to understand what is the difference between JerseyServletModule present in jersey-guice library and ServletModulepresent in Guice library.
NinjaCoder
  • 2,381
  • 3
  • 24
  • 46
0
votes
1 answer

Provider extending

I need to create provider for session scopes, like ServletScopes.SESSION, but with one extra action after object construction (like add listener). First idea - to extend ServletScopes.SESSION and override some method, but, unfortunately…
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
0
votes
1 answer

Howto make a dynamic web module with sitebricks and annotations?

I'm trying to create a dynamic web module with sitebricks, without web.xml. (Annotations only.) I have been searching the net for good examples, but all of them are simple java applications containing an embedded jetty web server. I have already…
nagylzs
  • 3,954
  • 6
  • 39
  • 70
0
votes
1 answer

Inject a Hibernate Interceptor with Guice / GuicePersist

I'm using JPA with Guice Persist for my GAE projects and Restlet for the REST interface. Under the hood good old Hibernate delivers the JPA service. This works like a charm, and Guice injects necessary JPA parts into my classes, for example an…
Roland Beuker
  • 354
  • 1
  • 15
0
votes
2 answers

@BeanParam annotation in GUICE + JERSEY Bridge

@GET @Path("/book") public Response getBook(@BeanParam Filter filter) { } Filter paramater is getting initialized but nothing is set in the bean class Filter {@QueryParam("author")String author} I do have setter and getter for all…
pinakin
  • 422
  • 4
  • 16
0
votes
1 answer

Integrating Guice, Servlets And Wicket

I've spent a few days now looking through all the examples I can find and I have not found one that has worked for me. Most seem to be 4-6 years old now. I feel like I'm just missing something small to get my servlets and wicket application to work…
Chris
  • 41
  • 6
0
votes
1 answer

Tomcat wont take the Guice configuration

I'm trying to configure Guice and I'm getting this problem when I deploy the war file into Tomcat : 17-Jul-2016 15:11:55.238 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Exception lors de l'envoi…
Mohamed Taboubi
  • 6,663
  • 11
  • 55
  • 87
0
votes
1 answer

HBase MapReduce with google.inject mismatch

I'm trying to do a map reduce against a HBase table using our in-house framework which makes use of Guice 4.0 It looks like yarn might be using version 3.0 and I'm getting a type mismatch. 2016-03-25 08:19:45,784 ERROR [main]…
owenrumney
  • 1,520
  • 3
  • 18
  • 37
0
votes
1 answer

Implementation of Google guice does not work

I am a beginner lerner of Google guice. I have programmed like below to insert in Oracle and postgres db, I have posted a very simple coede here but, when I run this I am getting an error as Exception in thread "main"…
New Bee
  • 390
  • 3
  • 10
0
votes
0 answers

Requests on Jersey endpoints are not filtered through Filter by Guice's ServletModule in my JUnit test

Problem I am working on a RESTful API using Jersey. To allow mocking of objects in my unit tests, I use the dependency injection framework Guice (in particular Guice-Servlet). It is possible to filter requests through your own Filter…
Korthout
  • 371
  • 3
  • 12
0
votes
1 answer

Dependency problems upgrading Guice with Warp-Persist

We have an application that uses Guice 1.0 with warp-servlet and warp-persist, and we'd like to upgrade to Guice 2 or 3. However, we're hitting a web of dependencies that is making it complicated. Does anyone know of a simple way (as close as…
ThrawnCA
  • 1,051
  • 1
  • 10
  • 23
0
votes
2 answers

WSO2 AS guice integration

I am using WSO2 application server to deploy my web services. I would like to use guice in my project. I have read a maksim blog about axis2 guice integration. He has used web.xml for injection however i do not know how could i change web.xml in…
Umut
  • 93
  • 8
0
votes
1 answer

Install custom Jersey ViewProcessor from Guice ServletModule

I am using jersey-guice to set up all my Jersey 1 resources using a bunch of Guice (Servlet)Modules. I have written a custom ViewProcessor (CustomViewProcessor) that relies on a configuration object, that I want to be injected into it using Guice.…
derabbink
  • 2,419
  • 1
  • 22
  • 47
0
votes
2 answers

Runnable war with jetty+guice

This is a question about better separating the code for embedding jetty from the code for wiring up servlets. I am trying to adapt this sample code such that I will be getting a runnable war, i.e. a war file that I can drop into an existing Jetty…
derabbink
  • 2,419
  • 1
  • 22
  • 47