This article compiles some code examples of the com.google.inject.servlet.RequestScoped.
method in Java, showing the specific implementation of RequestScoped.
usage. These code examples mainly come from platforms such as Github
/Stackoverflow
/Maven
. They are codes extracted from some selected projects and have strong The reference meaning can help you to a certain extent. The specific details of the RequestScoped.
method are as follows:
Package path: com.google.inject.servlet.RequestScoped
Class name: RequestScoped
Method name:
RequestScoped.Introduction
None
Code example
Code sample source: origin: Qihoo360/XLearning
@RequestScoped
public class App {
final ApplicationContext context;
@Inject
App(ApplicationContext context) {
this.cOntext= context;
}
}
Code sample source: origin: spotbugs/spotbugs
@RequestScoped
public class TestClass2 {
@Inject
public TestClass2(String unassisted, @Assisted String assisted) {
}
}
Code sample source: origin: apache/usergrid
@Path("status")
@RequestScoped
public class StatusResource {
private static final Logger logger = LoggerFactory.getLogger( StatusResource.class );
Code sample source: origin: com.google.inject.extensions/guice-servlet
@Provides
@RequestScoped
HttpServletResponse provideHttpServletResponse() {
return GuiceFilter.getResponse(Key.get(HttpServletResponse.class));
}
Code sample source: origin: com.google.inject. extensions/guice-servlet
@RequestScoped
public static class SomeObject {
private static final String INVALID = "invalid";
@Inject
public SomeObject(@ Named(INVALID) String value) {
this.value = value;
}
private final String value;
}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@Provides
@RequestScoped
HttpServletRequest provideHttpServletRequest() {
return GuiceFilter.getRequest(Key.get(HttpServletRequest. class));
}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@RequestScoped
public static class MyNonSingletonServlet extends HttpServlet {}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@RequestScoped
static class InRequest {}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@RequestScoped
static class AnnotatedRequestScopedClass {}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@RequestScoped
public static class SomeObject {}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@SuppressWarnings("unchecked") / / defined by getParameterMap()
@Provides
@RequestScoped
@RequestParameters
Map provideRequestParameters(ServletRequest req) {
return req.getParameterMap();
}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@Provides
@RequestScoped
String provideString() {
return "foo";
}
Code sample source: origin: com.google.inject.extensions/guice-servlet
@Provides
@RequestScoped
Object provideObject() {
return new Object();
}
});
Code sample source: origin: com.google.inject.extensions/guice-servlet
@Provides
@RequestScoped
Object provideObject() {
return new Object() ;
}
});
Code sample source: origin: com.google.inject.extensions/guice-servlet
@ Provides
@Named("G")
@RequestScoped
String provideG() {
return "g";
}
};
Code sample source: origin: com.google.inject.extensions/guice-servlet
@Provides
@RequestScoped
@Named("foo")
String provideNamedString() {
return "foo";
}
});
Code sample source: origin: com.sun.jersey.contribs/jersey-guice
@RequestScoped
@Provides
public HttpResponseContext responseContext(WebApplication wa) {
return wa.getThreadLocalHttpContext().getResponse();
}
}
Code sample source: origin: com.sun.jersey.contribs/jersey-guice
@RequestScoped
@Provides
public HttpRequestContext requestContext(WebApplication wa) {
return wa.getThreadLocalHttpContext().getRequest();
}
Code sample source: origin: com.sun.jersey.contribs/jersey -guice
@RequestScoped
@Provides
public Request request(WebApplication wa) {
return wa.getThreadLocalHttpContext().getRequest();
}
Code sample source: origin: com.sun.jersey.contribs/jersey-guice
@RequestScoped
@Provides
public SecurityContext securityContext(WebApplication wa) {
return wa.getThreadLocalHttpContext().getRequest();
}