Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 5 of 6
You can rely on the container to manage resources by:
PostConstruct phase) and remove them (PreDestroy phase). For example, if you need a connection to a JMS provider, you create this in the PostConstruct phase and remove it in the PreDestroy phase. If resources such as JMS connections are not removed, it is possible that no new resources can be released by the
provider.
EntityManager. Using a container-managed EntityManager causes the persistence context to be automatically propagated to every component that uses the EntityManager within the transaction.
Using container-managed resources lets the application server handle verbose code. This leaves you with the specific problem at hand, without all the code surrounding it.
A JSF component library -- Apache MyFaces Trinidad -- presents another scenario that calls for tweaking WebLogic. If you use
a Trinidad version older than 10.*.10 on a WebLogic server, the partial page rendering mechanism does not function properly.
(Trinidad has no problems on OC4J.) Trinidad assumes that the content type of an Ajax request is always text/xml. On a WebLogic server this assumption is wrong. On WebLogic the content type is text/html and is interpreted as such by Trinidad, with the result that the partial page rendering mechanism fails. A solution for this
issue is to hard-code the content type, as shown in Listing 3:
@SuppressWarnings("deprecation")
final class XmlHttpServletResponse extends HttpServletResponseWrapper {
private String _contentType = null;
XmlHttpServletResponse(ServletResponse response) {
super((HttpServletResponse)response);
_contentType = "text/xml;charset=utf-8";
}
...
@Override
public void setContentType(final String type) {
super.setContentType(_contentType);
}
}
The setContentType method overrides the default behavior and sets the content type to text/xml, relegating the partial page rendering issue to the history books.
As I mentioned earlier, WebLogic uses domains. It is possible to install libraries -- for example, a Trinidad library -- on a certain domain. To achieve this you just
package the Trinidad JARs into a WAR file. Then you can deploy the library as you would any other application. After the library is deployed, this entry is automatically
added to the domain's configuration file (config.xml):
<library>
<name>trinidad</name>
<target>GeneralServer</target>
<module-type>war</module-type>
<source-path>pad\trinidad.war</source-path>
<deployment-order>1</deployment-order>
<security-dd-model>DDOnly</security-dd-model>
</library>
Note that the configuration file contains all the domain's configured resources. To let a deployed application use a library,
you must configure the deployment override for the application by adding an entry to the weblogic.xml file (which is created automatically if a deployment plan has been created):