Author: thomas.heute(a)jboss.com
Date: 2008-05-29 06:23:04 -0400 (Thu, 29 May 2008)
New Revision: 10835
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view.jsp
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view_fr.jsp
Removed:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
Log:
- Simple JSP Portlet i18n
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java 2008-05-29
09:43:27 UTC (rev 10834)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java 2008-05-29
10:23:04 UTC (rev 10835)
@@ -26,17 +26,34 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.UnavailableException;
+
import java.io.IOException;
+import java.util.Locale;
-/** @author <a href="mailto:roy@jboss.org">Roy Russo</a> */
+/**
+ * @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ */
public class JSPPortlet extends GenericPortlet
{
- private static final String JSP_PATH = "/WEB-INF/jsp/jsp";
+ private static final String JSP_PATH = "/WEB-INF/jsp";
protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws
PortletException, IOException, UnavailableException
{
rResponse.setContentType("text/html");
- javax.portlet.PortletRequestDispatcher pRD =
this.getPortletContext().getRequestDispatcher(JSP_PATH + "/view.jsp");
+ Locale locale = rRequest.getLocale();
+
+ javax.portlet.PortletRequestDispatcher pRD = null;
+
+ if (this.getPortletContext().getResource(JSP_PATH + "/view_" +
locale.getLanguage() + ".jsp") != null)
+ {
+ pRD = this.getPortletContext().getRequestDispatcher(JSP_PATH +
"/view_" + locale.getLanguage() + ".jsp");
+ }
+ else
+ {
+ pRD = this.getPortletContext().getRequestDispatcher(JSP_PATH +
"/view.jsp");
+ }
+
pRD.include(rRequest, rResponse);
}
}
\ No newline at end of file
Copied:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view.jsp
(from rev 10818,
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/view.jsp)
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view.jsp
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view.jsp 2008-05-29
10:23:04 UTC (rev 10835)
@@ -0,0 +1,64 @@
+<%@ page import="org.jboss.portal.server.PortalConstants" %>
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~ JBoss, a division of Red Hat ~
+~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+~ contributors as indicated by the @authors tag. See the ~
+~ copyright.txt in the distribution for a full listing of ~
+~ individual contributors. ~
+~ ~
+~ This is free software; you can redistribute it and/or modify it ~
+~ under the terms of the GNU Lesser General Public License as ~
+~ published by the Free Software Foundation; either version 2.1 of ~
+~ the License, or (at your option) any later version. ~
+~ ~
+~ This software is distributed in the hope that it will be useful, ~
+~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+~ Lesser General Public License for more details. ~
+~ ~
+~ You should have received a copy of the GNU Lesser General Public ~
+~ License along with this software; if not, write to the Free ~
+~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
+
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<table border="0" cellspacing="2" cellpadding="2">
+ <tr>
+ <td align="center"><a
href="http://portal.demo.jboss.com" target="_blank"><img
+ src="<%= renderRequest.getContextPath() %>/images/dodemo.gif"
border="0"
+ alt="Try the latest release of JBoss Portal, live and online."
/></a>
+ <a
href="http://labs.jboss.com/portal/jbossportal/download/index.html&q...
target="_blank"><img
+ src="<%= renderRequest.getContextPath()
%>/images/getcode.gif" border="0"
+ alt="Download JBoss Portal and have it up and running in minutes."
/></a>
+ <a href="http://www.portletswap.com"
target="_blank"><img
+ src="<%= renderRequest.getContextPath()
%>/images/accessorize.gif" border="0"
+ alt="Download portlets and layouts for your new JBoss Portal
installation." /></a></td>
+ </tr>
+ <tr>
+ <td></td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate">
+ <font class="portlet-font">This is a basic installation of
<b><%= PortalConstants.VERSION %>
+ </b>. You may
+ log in at any time, using the <i>Login</i> link at the top-right
of this page, with the following
+ credentials:</font>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center">
+ <b>user/user</b> or <b>admin/admin</b>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ If you are in need of guidance with regards to navigating, configuring, or
operating the portal, please view
+ our <a
href="http://labs.jboss.com/portal/jbossportal/docs/index.html"
target="_blank">online documentation</a>.
+ </td>
+ </tr>
+</table>
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view_fr.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view_fr.jsp
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/view_fr.jsp 2008-05-29
10:23:04 UTC (rev 10835)
@@ -0,0 +1,61 @@
+<%@ page import="org.jboss.portal.server.PortalConstants" %>
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~ JBoss, a division of Red Hat ~
+~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+~ contributors as indicated by the @authors tag. See the ~
+~ copyright.txt in the distribution for a full listing of ~
+~ individual contributors. ~
+~ ~
+~ This is free software; you can redistribute it and/or modify it ~
+~ under the terms of the GNU Lesser General Public License as ~
+~ published by the Free Software Foundation; either version 2.1 of ~
+~ the License, or (at your option) any later version. ~
+~ ~
+~ This software is distributed in the hope that it will be useful, ~
+~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+~ Lesser General Public License for more details. ~
+~ ~
+~ You should have received a copy of the GNU Lesser General Public ~
+~ License along with this software; if not, write to the Free ~
+~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
+
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<table border="0" cellspacing="2" cellpadding="2">
+ <tr>
+ <td align="center"><a
href="http://portal.demo.jboss.com" target="_blank"><img
+ src="<%= renderRequest.getContextPath() %>/images/dodemo.gif"
border="0"
+ alt="Try the latest release of JBoss Portal, live and online."
/></a>
+ <a
href="http://labs.jboss.com/portal/jbossportal/download/index.html&q...
target="_blank"><img
+ src="<%= renderRequest.getContextPath()
%>/images/getcode.gif" border="0"
+ alt="Download JBoss Portal and have it up and running in minutes."
/></a>
+ <a href="http://www.portletswap.com"
target="_blank"><img
+ src="<%= renderRequest.getContextPath()
%>/images/accessorize.gif" border="0"
+ alt="Download portlets and layouts for your new JBoss Portal
installation." /></a></td>
+ </tr>
+ <tr>
+ <td></td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate">
+ <font class="portlet-font">Ceci est l'installation par
défaut de <b><%= PortalConstants.VERSION %>
+ </b>. Vous pouvez vous connecter en cliquant sur le lien
<i>Login</i> en haut à droite de cette page, avec les identifiants
suivants:</font>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center">
+ <b>user/user</b> ou <b>admin/admin</b>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ Si vous avez besoin d'aide pour naviguer, configurer ou pour administrer le
portail, veuillez vous référer <a
href="http://labs.jboss.com/portal/jbossportal/docs/index.html"
target="_blank">à la documentation </a>.
+ </td>
+ </tr>
+</table>