Replace non UTF-8 characters in asciidoc source
Replace the odd instance of non UTF-8 characters in the reference asciidoc source, mainly smart-quotes. Issue: SPR-11096
This commit is contained in:
parent
dfa7483812
commit
4b0de69246
|
@ -3464,7 +3464,7 @@ org.springframework.scripting.groovy.GroovyMessenger@272961
|
||||||
[[beans-factory-extension-bpp-examples-rabpp]]
|
[[beans-factory-extension-bpp-examples-rabpp]]
|
||||||
===== Example: The RequiredAnnotationBeanPostProcessor
|
===== Example: The RequiredAnnotationBeanPostProcessor
|
||||||
|
|
||||||
Using callback interfaces or annotations in conjunction with a custom `BeanPostProcessor` implementation is a common means of extending the Spring IoC container. An example is Spring's `RequiredAnnotationBeanPostProcessor` a `BeanPostProcessor` implementation that ships with the Spring distribution which ensures that JavaBean properties on beans that are marked with an (arbitrary) annotation are actually (configured to be) dependency-injected with a value.
|
Using callback interfaces or annotations in conjunction with a custom `BeanPostProcessor` implementation is a common means of extending the Spring IoC container. An example is Spring's `RequiredAnnotationBeanPostProcessor` - a `BeanPostProcessor` implementation that ships with the Spring distribution which ensures that JavaBean properties on beans that are marked with an (arbitrary) annotation are actually (configured to be) dependency-injected with a value.
|
||||||
|
|
||||||
[[beans-factory-extension-factory-postprocessors]]
|
[[beans-factory-extension-factory-postprocessors]]
|
||||||
==== Customizing configuration metadata with a BeanFactoryPostProcessor
|
==== Customizing configuration metadata with a BeanFactoryPostProcessor
|
||||||
|
@ -4723,7 +4723,7 @@ When working with standard annotations, it is important to know that some signif
|
||||||
|
|
||||||
| @Component
|
| @Component
|
||||||
| @Named
|
| @Named
|
||||||
|
|
| -
|
||||||
|
|
||||||
| @Scope("singleton")
|
| @Scope("singleton")
|
||||||
| @Singleton
|
| @Singleton
|
||||||
|
@ -4733,18 +4733,18 @@ When working with standard annotations, it is important to know that some signif
|
||||||
|
|
||||||
| @Qualifier
|
| @Qualifier
|
||||||
| @Named
|
| @Named
|
||||||
|
|
| -
|
||||||
|
|
||||||
| @Value
|
| @Value
|
||||||
|
|
| -
|
||||||
| no equivalent
|
| no equivalent
|
||||||
|
|
||||||
| @Required
|
| @Required
|
||||||
|
|
| -
|
||||||
| no equivalent
|
| no equivalent
|
||||||
|
|
||||||
| @Lazy
|
| @Lazy
|
||||||
|
|
| -
|
||||||
| no equivalent
|
| no equivalent
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
@ -25545,7 +25545,7 @@ To perform the actual rendering, `DispatcherPortlet` does the following:
|
||||||
|
|
||||||
The `ViewRendererServlet` is then able to call the `render` method on the `View` with the appropriate arguments.
|
The `ViewRendererServlet` is then able to call the `render` method on the `View` with the appropriate arguments.
|
||||||
|
|
||||||
The actual URL for the `ViewRendererServlet` can be changed using `DispatcherPortlet`’s `viewRendererUrl` configuration parameter.
|
The actual URL for the `ViewRendererServlet` can be changed using `DispatcherPortlet`'s `viewRendererUrl` configuration parameter.
|
||||||
|
|
||||||
[[portlet-controller]]
|
[[portlet-controller]]
|
||||||
=== Controllers
|
=== Controllers
|
||||||
|
@ -25589,10 +25589,10 @@ Of course, just a `Controller` interface isn't enough. To provide a basic infras
|
||||||
| Indicates whether or not this `Controller` requires a session to do its work. This feature is offered to all controllers. If a session is not present when such a controller receives a request, the user is informed using a `SessionRequiredException`.
|
| Indicates whether or not this `Controller` requires a session to do its work. This feature is offered to all controllers. If a session is not present when such a controller receives a request, the user is informed using a `SessionRequiredException`.
|
||||||
|
|
||||||
| `synchronizeSession`
|
| `synchronizeSession`
|
||||||
| Use this if you want handling by this controller to be synchronized on the user's session. To be more specific, the extending controller will override the `handleRenderRequestInternal(..)` and `handleActionRequestInternal(..)` methods, which will be synchronized on the user’s session if you specify this variable.
|
| Use this if you want handling by this controller to be synchronized on the user's session. To be more specific, the extending controller will override the `handleRenderRequestInternal(..)` and `handleActionRequestInternal(..)` methods, which will be synchronized on the user's session if you specify this variable.
|
||||||
|
|
||||||
| `renderWhenMinimized`
|
| `renderWhenMinimized`
|
||||||
| If you want your controller to actually render the view when the portlet is in a minimized state, set this to true. By default, this is set to false so that portlets that are in a minimized state don’t display any content.
|
| If you want your controller to actually render the view when the portlet is in a minimized state, set this to true. By default, this is set to false so that portlets that are in a minimized state don't display any content.
|
||||||
|
|
||||||
| `cacheSeconds`
|
| `cacheSeconds`
|
||||||
| When you want a controller to override the default cache expiration defined for the portlet, specify a positive integer here. By default it is set to `-1`, which does not change the default caching. Setting it to `0` will ensure the result is never cached.
|
| When you want a controller to override the default cache expiration defined for the portlet, specify a positive integer here. By default it is set to `-1`, which does not change the default caching. Setting it to `0` will ensure the result is never cached.
|
||||||
|
@ -25675,7 +25675,7 @@ This can be very valuable since you can then use interceptors to pre-process and
|
||||||
=== Handler mappings
|
=== Handler mappings
|
||||||
Using a handler mapping you can map incoming portlet requests to appropriate handlers. There are some handler mappings you can use out of the box, for example, the `PortletModeHandlerMapping`, but let's first examine the general concept of a `HandlerMapping`.
|
Using a handler mapping you can map incoming portlet requests to appropriate handlers. There are some handler mappings you can use out of the box, for example, the `PortletModeHandlerMapping`, but let's first examine the general concept of a `HandlerMapping`.
|
||||||
|
|
||||||
Note: We are intentionally using the term "Handler" here instead of "Controller". `DispatcherPortlet` is designed to be used with other ways to process requests than just Spring Portlet MVC’s own Controllers. A Handler is any Object that can handle portlet requests. Controllers are an example of Handlers, and they are of course the default. To use some other framework with `DispatcherPortlet`, a corresponding implementation of `HandlerAdapter` is all that is needed.
|
Note: We are intentionally using the term "Handler" here instead of "Controller". `DispatcherPortlet` is designed to be used with other ways to process requests than just Spring Portlet MVC's own Controllers. A Handler is any Object that can handle portlet requests. Controllers are an example of Handlers, and they are of course the default. To use some other framework with `DispatcherPortlet`, a corresponding implementation of `HandlerAdapter` is all that is needed.
|
||||||
|
|
||||||
The functionality a basic `HandlerMapping` provides is the delivering of a `HandlerExecutionChain`, which must contain the handler that matches the incoming request, and may also contain a list of handler interceptors that are applied to the request. When a request comes in, the `DispatcherPortlet` will hand it over to the handler mapping to let it inspect the request and come up with an appropriate `HandlerExecutionChain`. Then the `DispatcherPortlet` will execute the handler and interceptors in the chain (if any). These concepts are all exactly the same as in Spring Web MVC.
|
The functionality a basic `HandlerMapping` provides is the delivering of a `HandlerExecutionChain`, which must contain the handler that matches the incoming request, and may also contain a list of handler interceptors that are applied to the request. When a request comes in, the `DispatcherPortlet` will hand it over to the handler mapping to let it inspect the request and come up with an appropriate `HandlerExecutionChain`. Then the `DispatcherPortlet` will execute the handler and interceptors in the chain (if any). These concepts are all exactly the same as in Spring Web MVC.
|
||||||
|
|
||||||
|
@ -25693,7 +25693,7 @@ The rest of this section describes three of Spring Portlet MVC's most commonly u
|
||||||
[[portlet-handlermapping-portletmode]]
|
[[portlet-handlermapping-portletmode]]
|
||||||
==== PortletModeHandlerMapping
|
==== PortletModeHandlerMapping
|
||||||
|
|
||||||
This is a simple handler mapping that maps incoming requests based on the current mode of the portlet (e.g. ‘view’, ‘edit’, ‘help’). An example:
|
This is a simple handler mapping that maps incoming requests based on the current mode of the portlet (e.g. 'view', 'edit', 'help'). An example:
|
||||||
|
|
||||||
[source,xml]
|
[source,xml]
|
||||||
[subs="verbatim,quotes"]
|
[subs="verbatim,quotes"]
|
||||||
|
@ -27309,7 +27309,7 @@ The Spring approach is to allow the creation and use of proxy objects, normally
|
||||||
|
|
||||||
[[ejb-access-local]]
|
[[ejb-access-local]]
|
||||||
==== Accessing local SLSBs
|
==== Accessing local SLSBs
|
||||||
Assume that we have a web controller that needs to use a local EJB. We’ll follow best practice and use the EJB Business Methods Interface pattern, so that the EJB’s local interface extends a non EJB-specific business methods interface. Let’s call this business methods interface `MyComponent`.
|
Assume that we have a web controller that needs to use a local EJB. We'll follow best practice and use the EJB Business Methods Interface pattern, so that the EJB's local interface extends a non EJB-specific business methods interface. Let's call this business methods interface `MyComponent`.
|
||||||
|
|
||||||
[source,java]
|
[source,java]
|
||||||
[subs="verbatim,quotes"]
|
[subs="verbatim,quotes"]
|
||||||
|
@ -27319,7 +27319,7 @@ public interface MyComponent {
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
One of the main reasons to use the Business Methods Interface pattern is to ensure that synchronization between method signatures in local interface and bean implementation class is automatic. Another reason is that it later makes it much easier for us to switch to a POJO (plain old Java object) implementation of the service if it makes sense to do so. Of course we’ll also need to implement the local home interface and provide an implementation class that implements `SessionBean` and the `MyComponent` business methods interface. Now the only Java coding we’ll need to do to hook up our web tier controller to the EJB implementation is to expose a setter method of type `MyComponent` on the controller. This will save the reference as an instance variable in the controller:
|
One of the main reasons to use the Business Methods Interface pattern is to ensure that synchronization between method signatures in local interface and bean implementation class is automatic. Another reason is that it later makes it much easier for us to switch to a POJO (plain old Java object) implementation of the service if it makes sense to do so. Of course we'll also need to implement the local home interface and provide an implementation class that implements `SessionBean` and the `MyComponent` business methods interface. Now the only Java coding we'll need to do to hook up our web tier controller to the EJB implementation is to expose a setter method of type `MyComponent` on the controller. This will save the reference as an instance variable in the controller:
|
||||||
|
|
||||||
[source,java]
|
[source,java]
|
||||||
[subs="verbatim,quotes"]
|
[subs="verbatim,quotes"]
|
||||||
|
@ -27347,7 +27347,7 @@ We can subsequently use this instance variable in any business method in the con
|
||||||
</bean>
|
</bean>
|
||||||
----
|
----
|
||||||
|
|
||||||
There’s a lot of work happening behind the scenes, courtesy of the Spring AOP framework, although you aren’t forced to work with AOP concepts to enjoy the results. The `myComponent` bean definition creates a proxy for the EJB, which implements the business method interface. The EJB local home is cached on startup, so there’s only a single JNDI lookup. Each time the EJB is invoked, the proxy invokes the `classname` method on the local EJB and invokes the corresponding business method on the EJB.
|
There's a lot of work happening behind the scenes, courtesy of the Spring AOP framework, although you aren't forced to work with AOP concepts to enjoy the results. The `myComponent` bean definition creates a proxy for the EJB, which implements the business method interface. The EJB local home is cached on startup, so there's only a single JNDI lookup. Each time the EJB is invoked, the proxy invokes the `classname` method on the local EJB and invokes the corresponding business method on the EJB.
|
||||||
|
|
||||||
The `myController` bean definition sets the `myComponent` property of the controller class to the EJB proxy.
|
The `myController` bean definition sets the `myComponent` property of the controller class to the EJB proxy.
|
||||||
|
|
||||||
|
@ -27364,9 +27364,9 @@ Alternatively (and preferably in case of many such proxy definitions), consider
|
||||||
</bean>
|
</bean>
|
||||||
----
|
----
|
||||||
|
|
||||||
This EJB access mechanism delivers huge simplification of application code: the web tier code (or other EJB client code) has no dependence on the use of EJB. If we want to replace this EJB reference with a POJO or a mock object or other test stub, we could simply change the `myComponent` bean definition without changing a line of Java code. Additionally, we haven’t had to write a single line of JNDI lookup or other EJB plumbing code as part of our application.
|
This EJB access mechanism delivers huge simplification of application code: the web tier code (or other EJB client code) has no dependence on the use of EJB. If we want to replace this EJB reference with a POJO or a mock object or other test stub, we could simply change the `myComponent` bean definition without changing a line of Java code. Additionally, we haven't had to write a single line of JNDI lookup or other EJB plumbing code as part of our application.
|
||||||
|
|
||||||
Benchmarks and experience in real applications indicate that the performance overhead of this approach (which involves reflective invocation of the target EJB) is minimal, and is typically undetectable in typical use. Remember that we don’t want to make fine-grained calls to EJBs anyway, as there’s a cost associated with the EJB infrastructure in the application server.
|
Benchmarks and experience in real applications indicate that the performance overhead of this approach (which involves reflective invocation of the target EJB) is minimal, and is typically undetectable in typical use. Remember that we don't want to make fine-grained calls to EJBs anyway, as there's a cost associated with the EJB infrastructure in the application server.
|
||||||
|
|
||||||
There is one caveat with regards to the JNDI lookup. In a bean container, this class is normally best used as a singleton (there simply is no reason to make it a prototype). However, if that bean container pre-instantiates singletons (as do the various XML `ApplicationContext` variants) you may have a problem if the bean container is loaded before the EJB container loads the target EJB. That is because the JNDI lookup will be performed in the `init()` method of this class and then cached, but the EJB will not have been bound at the target location yet. The solution is to not pre-instantiate this factory object, but allow it to be created on first use. In the XML containers, this is controlled via the `lazy-init` attribute.
|
There is one caveat with regards to the JNDI lookup. In a bean container, this class is normally best used as a singleton (there simply is no reason to make it a prototype). However, if that bean container pre-instantiates singletons (as do the various XML `ApplicationContext` variants) you may have a problem if the bean container is loaded before the EJB container loads the target EJB. That is because the JNDI lookup will be performed in the `init()` method of this class and then cached, but the EJB will not have been bound at the target location yet. The solution is to not pre-instantiate this factory object, but allow it to be created on first use. In the XML containers, this is controlled via the `lazy-init` attribute.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue