Test Series - spring

Test Number 17/20

Q: Servlet listener which loads application context.
A. Security:intercept-methods
B. global-method-security
C. ContextLoaderListener
D. None of the mentioned
Solution: A web application can load Spring application context by registering the servlet listener ContextLoaderListener.
Q: Method to retrieve Spring Applicationcontext.
A. WebApplicationContextUtils.getRequiredWebApplicationContext()
B. WebApplicationContextUtils.getRequiredWeb()
C. WebApplicationUtils.getRequiredWebApplicationContext()
D. None of the mentioned
Solution: As Spring applicationcontext is stored in the servlet context, you can retrieve it through the WebApplicationContextUtils.getRequiredWebApplicationContext() method by passing in a servlet context.
Q: Class used to have full access to the Spring context’s life cycle machinery and dependency injection.
A. DelegatingFilterProxy
B. WebApplicationContextUtils.getRequiredWeb()
C. WebApplicationUtils.getRequiredWebApplicationContext()
D. None of the mentioned
Solution: If you want to implement filter-like functionality but want to have full access to the Spring context’s life cycle machinery and dependency injection, use the DelegatingFilterProxy class.
Q: In order to leverage Spring application context machinery and configuration.
A. HttpRequestHandlerJNDI
B. HttpRequestHandlerServlet
C. HttpRequestHandler
D. None of the mentioned
Solution: Suppose we wanted to rewrite the servlet functionality to leverage Spring application context machinery and configuration. The HttpRequestHandlerServlet will handle this for us.
Q: Interface implemented by object instantiated by HttpRequestHandlerServlet.
A. HttpRequestHandlerJNDI
B. HttpRequestHandlerServlet
C. HttpRequestHandler
D. None of the mentioned
Solution: In the servlet example, the HttpRequestHandlerServlet delegated to another object that implemented an interface—HttpRequestHandler—that was considerably simpler than that of a raw servlet.
Q: Attribute used to look up and delegate a particular root bean.
A. filter
B. filter-name
C. filtername
D. none of the mentioned
Solution: the filter-name attribute is used to determine which bean in the root Spring application context to look up and delegate to.
Q: ActionSupport class provides a method to access spring application context.
A. getWebApplicationContext()
B. getWebApplication()
C. getApplicationContext()
D. contextEventListener()
Solution: Spring provides the ActionSupport class, a subclass of the Action base class that has a convenient getWebApplicationContext() method for you to access Spring application context.
Q: Struts servlet used to handle web requests.
A. ActionServlet
B. Action
C. ActionSupport
D. ActionStruts
Solution: In the web deployment descriptor (i.e., web.xml) of a Struts application, you have to register the Struts servlet ActionServlet to handle web requests.
Q: Struts plugin used to integrate with spring.
A. ContextLoaderListener
B. ContextLoaderPlugin
C. ContextLoaderListenerPlugin
D. None of the mentioned
Solution: Another way is to register the Struts plug-in ContextLoaderPlugin in the Struts configuration file.
Q: Integration of JSF with Spring Application Context.
A. ContextLoaderListener
B. DelegatingVariableResolver
C. SpringBeanFacesELResolver
D. All of the mentioned
Solution: Due to the similarity between Spring and JSF bean models, it’s very easy to integrate them by registering the Spring-provided JSF variable resolver DelegatingVariableResolver (for JSF 1.1) or the SpringBeanFacesELResolver (for JSF 1.2 and greater).

You Have Score    /10