KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > invocation > portal > ContentTypeInterceptor


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.invocation.portal;
10
11 import org.jboss.portal.server.PortalResponse;
12 import org.jboss.portal.server.invocation.AttachmentKey;
13 import org.jboss.portal.server.invocation.Interceptor;
14 import org.jboss.portal.server.invocation.Invocation;
15
16 /**
17  * Choose the content type of the response.
18  *
19  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
20  * @version $Revision: 1.3 $
21  */

22 public class ContentTypeInterceptor
23    implements Interceptor
24 {
25    public Object JavaDoc invoke(Invocation invocation)
26    {
27       String JavaDoc contentType = "text/html";
28       PortalResponse response = (PortalResponse)invocation.getAttachment(AttachmentKey.PORTAL_RESPONSE);
29       response.setContentType(contentType);
30       return invocation.invokeNext();
31    }
32 }
33
Popular Tags