|
MyFaces Trinidad and WebLogic
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:
Listing 3. Hard-coding an Ajax request's content type on WebLogic
@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.
Deploying Trinidad to WebLogic domains
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): |
|