portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r565864 - /portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java
Date Tue, 14 Aug 2007 19:33:49 GMT
Author: taylor
Date: Tue Aug 14 12:33:48 2007
New Revision: 565864

URL: http://svn.apache.org/viewvc?view=rev&rev=565864
Log:
https://issues.apache.org/jira/browse/JS2-769
example of another content type

Modified:
    portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java

Modified: portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java?view=diff&rev=565864&r1=565863&r2=565864
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java
(original)
+++ portals/jetspeed-2/trunk/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java
Tue Aug 14 12:33:48 2007
@@ -89,12 +89,21 @@
     {
         PortletContext context = getPortletContext();
         ResourceBundle resource = getPortletConfig().getResourceBundle(request.getLocale());
-        response.setContentType("text/html");
-
-        response.getWriter().println("<br/><b>"+resource.getString("helloworld.label.InitParamHello")+"
= " + this.getInitParameter("hello") +  "</b>");
-        // response.getWriter().println("<br/><b>Render URL = " + url +  "</b>");
-        
-        PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/hello.jsp");
-        rd.include(request, response);        
+        String contentType = request.getResponseContentType();
+        if (contentType.startsWith("text/html"))
+        {
+            response.setContentType("text/html");
+            response.getWriter().println("<br/><b>"+resource.getString("helloworld.label.InitParamHello")+"
= " + this.getInitParameter("hello") +  "</b>");
+            PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/hello.jsp");
+            rd.include(request, response);                                
+        }
+        else if (contentType.startsWith("text/vnd.wap.wml"))
+        {
+            response.setContentType("text/vnd.wap.wml");            
+            response.getWriter().println("<br/><b>WML: "+resource.getString("helloworld.label.InitParamHello")+"
= " + this.getInitParameter("hello") +  "</b>");
+            PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/hello-wml.jsp");
+            rd.include(request, response);                    
+        }            
+        // response.getWriter().println("<br/><b>Render URL = " + url +  "</b>");
       
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message