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

Versioning REST API using Guice 3.0 + JaxRS 2.0

I'd like to have a versioned REST api using an HTTP Request Header: GET /someResource Version: 1.0 Now if I have 2 versions of this resource, my JaxRS web application needs to be able to serve responses appropriate to either of the requested…
Matthew Madson
  • 1,643
  • 13
  • 24
0
votes
4 answers

Injecting using request scope and threads

I have some bussines classes that get injected some dependencies that are provided using servlet request scope. The problem is that I want to use that bussines classes in some threads that outlive the servlet request. Whats the most transparent way…
lujop
  • 13,504
  • 9
  • 62
  • 95
0
votes
1 answer

Inject @SessionScoped value into filter with Guice

I have a class hold value of a user in session @SessionScoped class UserSession{} Now I have a LoginFilter to ensure some url accessed with user login class LoginFilter{ @Inject UserSession userSession; ... } Then Out of scope exception…
jilen
  • 5,633
  • 3
  • 35
  • 84
0
votes
1 answer

Ensuring resources are destroyed using JAX-RS, Tomcat and Guice

I have a JAX-RS webservice served using Tomcat 6. I'm using Guice to inject my resources and to create the Servlet. I've definitely got a memory leak and I assume this is because I'm not handling either the end of the request or the shutdown of the…
Paul D'Ambra
  • 7,629
  • 3
  • 51
  • 96
0
votes
1 answer

Apache Shiro Guice Servlet Configure redirectUrl for AUTHC Filter

How can I configure the redirect URL for the AUTHC Filter given by Shiro? I know how to configure it in an INI file, but I need to know how to configure it in my extension of the ShiroWebModule. Thanks!
Benjamin Ihrig
  • 271
  • 2
  • 3
  • 11
0
votes
1 answer

How to use regex to route all requests to servlet *except* static files "/(images|css|jsp|html)/.*"

Using google guice and I'd like to have all server requests (/*) flow to my servlet file except static content. If needed, I'm good with placing static content into a /static folder. I just need to pick up servelet requests to the root. Here is…
JStark
  • 2,788
  • 2
  • 29
  • 37
0
votes
0 answers

Lost "\n (quotes and newline sequence) from servlet returned text

I'm returning some text from a servlet, which is working well, except for lines ending with a " character. Those lines causes the quotes and following newline character to get lost. Do you have any ideas what could cause or fix this problem?
0
votes
2 answers

Guice and non-Singleton Servlets

How we can use non-Singleton servlet or handler in Guice, for example I want to create new instance for every request and immediately destroy it or give it to garbage collector after processing the request. I dont want to keep ii in memory as…
Nav
  • 4,450
  • 10
  • 53
  • 84
0
votes
2 answers

Guice-Persist - "Work already begun on this thread. Looks like you have called UnitOfWork.begin() twice without a balancing call to end() in between."

Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have never had a problem using the session-per-HTTPRequest feature of Guice-Persist which is similar to what Warp-persist originally used. We are…
benstpierre
  • 32,833
  • 51
  • 177
  • 288
0
votes
3 answers

How to clear browser cache using java

I have a problem in sessions. When ever I logout the session is ended but then when the browsers back button is pressed I am getting the previous page. I am using jsp servlet technology and my code for logout is given below …
user1407310
  • 173
  • 4
  • 4
  • 9
1 2 3 4 5 6
7