[pal-cvs 3882] [1617] clean up jars, modified ui, clear multiple values.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 12月 16日 (火) 06:34:40 JST


Revision: 1617
          http://svn.sourceforge.jp/view?root=pal&view=rev&rev=1617
Author:   shinsuke
Date:     2008-12-16 06:34:40 +0900 (Tue, 16 Dec 2008)

Log Message:
-----------
clean up jars, modified ui, clear multiple values.

Modified Paths:
--------------
    pal-wcm/trunk/.classpath
    pal-wcm/trunk/pom.xml
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/action/EditorAction.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/service/ContentService.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileconnectorServlet.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java
    pal-wcm/trunk/src/main/webapp/WEB-INF/view/editor/prefs.jsp

Added Paths:
-----------
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/DownloadUtil.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/StreamUtil.java


-------------- next part --------------
Modified: pal-wcm/trunk/.classpath
===================================================================
--- pal-wcm/trunk/.classpath	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/.classpath	2008-12-15 21:34:40 UTC (rev 1617)
@@ -4,7 +4,6 @@
     <classpathentry kind="src" path="src/main/webapp/WEB-INF/view"/>
     <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 
-  <classpathentry kind="var" path="M2_REPO/jp/sf/pal/common-utils/0.2/common-utils-0.2.jar" sourcepath="M2_REPO/jp/sf/pal/common-utils/0.2/common-utils-0.2-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/portlet-api/portlet-api/1.0/portlet-api-1.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar" sourcepath="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/>
@@ -24,19 +23,21 @@
   <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/portals/jetspeed-2/jetspeed-api/2.1.3/jetspeed-api-2.1.3.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/seasar/sastruts/sa-struts-portlet/1.0.0-rc1/sa-struts-portlet-1.0.0-rc1.jar" sourcepath="M2_REPO/org/seasar/sastruts/sa-struts-portlet/1.0.0-rc1/sa-struts-portlet-1.0.0-rc1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/seasar/sastruts/sa-struts-portlet/1.0.0-rc4/sa-struts-portlet-1.0.0-rc4.jar" sourcepath="M2_REPO/org/seasar/sastruts/sa-struts-portlet/1.0.0-rc4/sa-struts-portlet-1.0.0-rc4-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/struts/struts/1.2.9/struts-1.2.9.jar"/>
-  <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.2/antlr-2.7.2.jar" sourcepath="M2_REPO/antlr/antlr/2.7.2/antlr-2.7.2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
   <classpathentry kind="var" path="M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1.jar" sourcepath="M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/seasar/sastruts/sa-struts/1.0.4/sa-struts-1.0.4.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/seasar/container/s2-tiger/2.4.27/s2-tiger-2.4.27.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/seasar/container/s2-extension/2.4.27/s2-extension-2.4.27.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/seasar/container/s2-framework/2.4.27/s2-framework-2.4.27.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/seasar/sastruts/sa-struts/1.0.4-sp2/sa-struts-1.0.4-sp2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/seasar/container/s2-tiger/2.4.31/s2-tiger-2.4.31.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/seasar/container/s2-extension/2.4.31/s2-extension-2.4.31.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/seasar/container/s2-framework/2.4.31/s2-framework-2.4.31.jar"/>
   <classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/jboss/javassist/3.4.ga/javassist-3.4.ga.jar"/>
   <classpathentry kind="var" path="M2_REPO/ognl/ognl/2.6.9-patch-20070908/ognl-2.6.9-patch-20070908.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi/3.0-FINAL/poi-3.0-FINAL.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.0/geronimo-annotation_1.0_spec-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/easymock/easymock/2.2/easymock-2.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.1.1/geronimo-annotation_1.0_spec-1.1.1.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0/geronimo-ejb_3.0_spec-1.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-interceptor_3.0_spec/1.0/geronimo-interceptor_3.0_spec-1.0.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.0/geronimo-jta_1.1_spec-1.0.jar"/>

Modified: pal-wcm/trunk/pom.xml
===================================================================
--- pal-wcm/trunk/pom.xml	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/pom.xml	2008-12-15 21:34:40 UTC (rev 1617)
@@ -98,11 +98,6 @@
   </repositories>
   <dependencies>
     <dependency>
-      <groupId>jp.sf.pal</groupId>
-      <artifactId>common-utils</artifactId>
-      <version>0.2</version>
-    </dependency>
-    <dependency>
       <groupId>portlet-api</groupId>
       <artifactId>portlet-api</artifactId>
       <version>1.0</version>
@@ -152,7 +147,6 @@
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.13</version>
-      <type>jar</type>
     </dependency>
     <dependency>
       <groupId>javax.mail</groupId>
@@ -165,12 +159,6 @@
       <artifactId>jetspeed-api</artifactId>
       <version>2.1.3</version>
       <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>junit</groupId>
-          <artifactId>junit</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
@@ -182,21 +170,7 @@
     <dependency>
       <groupId>org.seasar.sastruts</groupId>
       <artifactId>sa-struts-portlet</artifactId>
-      <version>1.0.0-rc2</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.easymock</groupId>
-          <artifactId>easymock</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>commons-logging</groupId>
-          <artifactId>commons-logging</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>junit</groupId>
-          <artifactId>junit</artifactId>
-        </exclusion>
-      </exclusions>
+      <version>1.0.0-rc4</version>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
@@ -218,6 +192,38 @@
       <artifactId>geronimo-jta_1.1_spec</artifactId>
       <version>1.0</version>
     </dependency>
+<!-- Removed from war -->
+    <dependency>
+<!-- needed by validator(validwhen) -->
+      <groupId>antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>2.7.7</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>2.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>xalan</groupId>
+      <artifactId>xalan</artifactId>
+      <version>2.5.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>2.0.2</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
   <reporting>
     <plugins>

Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/action/EditorAction.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/action/EditorAction.java	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/action/EditorAction.java	2008-12-15 21:34:40 UTC (rev 1617)
@@ -17,6 +17,8 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Locale;
 
@@ -64,7 +66,7 @@
 
     private ContentService contentService;
 
-    private HttpServletRequest request;
+    private transient HttpServletRequest request;
 
     private String getReceivedPath() {
         PortletRequest portletRequest = (PortletRequest) request
@@ -323,6 +325,19 @@
                         locales[i].toString() };
                 localeList.add(tmp);
             }
+            Collections.sort(localeList, new Comparator<String[]>() {
+                public int compare(String[] tc1, String[] tc2) {
+                    String tc1Name = tc1[1];
+                    String tc2Name = tc2[1];
+                    if (tc1Name.compareTo(tc2Name) < 0) {
+                        return -1;
+                    } else if (tc1Name.compareTo(tc2Name) > 0) {
+                        return 1;
+                    }
+                    return 0;
+                }
+            });
+
         }
         try {
             localeItems = contentService.getLocaleList(

Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/service/ContentService.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/service/ContentService.java	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/service/ContentService.java	2008-12-15 21:34:40 UTC (rev 1617)
@@ -50,6 +50,8 @@
  */
 public class ContentService implements Serializable {
 
+    private static final long serialVersionUID = -4039452318407162712L;
+
     private transient HttpServletRequest request;
 
     private transient PageManager pageManager = null;
@@ -252,7 +254,8 @@
             fp.setValueList(list);
             fragment.getPreferences().add(fp);
         } else {
-            fp.getValueList().set(0, StringEscapeUtils.escapeXml(value));
+            fp.getValueList().clear();
+            fp.getValueList().add(StringEscapeUtils.escapeXml(value));
         }
     }
 

Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileconnectorServlet.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileconnectorServlet.java	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileconnectorServlet.java	2008-12-15 21:34:40 UTC (rev 1617)
@@ -78,7 +78,8 @@
             doCreateFolder(req, resp);
         } else {
             resp.sendError(HttpServletResponse.SC_BAD_REQUEST,
-                    "Unknown action command. The command is " + command + ".");
+                    "Unknown action command. The command is " +
+                            StringEscapeUtils.escapeHtml(command) + ".");
             return;
         }
         resp.getWriter().flush();

Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java	2008-12-15 21:34:40 UTC (rev 1617)
@@ -26,10 +26,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import jp.sf.pal.common.util.DownloadUtil;
 import jp.sf.pal.wcm.WcmConstants;
+import jp.sf.pal.wcm.util.DownloadUtil;
 import jp.sf.pal.wcm.util.PALWcmUtil;
 
+import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -74,8 +75,9 @@
         }
         if (!namespaceList.contains(namespace)) {
             resp.sendError(HttpServletResponse.SC_FORBIDDEN,
-                    "you do not have a proper permission: " + name + "(" +
-                            namespace + ")");
+                    "you do not have a proper permission: " +
+                            StringEscapeUtils.escapeHtml(name) + "(" +
+                            StringEscapeUtils.escapeHtml(namespace) + ")");
             return;
 
         }

Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/DownloadUtil.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/DownloadUtil.java	                        (rev 0)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/DownloadUtil.java	2008-12-15 21:34:40 UTC (rev 1617)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2005-2006 Portal Application Laboratory project.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package jp.sf.pal.wcm.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import javax.mail.internet.MimeUtility;
+import javax.portlet.PortletContext;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author shinsuke
+ * 
+ */
+public class DownloadUtil {
+
+    /**
+     * Logger for this class
+     */
+    private static final Log log = LogFactory.getLog(DownloadUtil.class);
+
+    public static final String OCTET_STREAM = "application/octet-stream";
+
+    public static void setContentType(HttpServletRequest request,
+            HttpServletResponse response, String contentType) {
+        response.setContentType(contentType);
+    }
+
+    public static void setFilename(HttpServletRequest request,
+            HttpServletResponse response, String filename) {
+        if (isMSIE(request)) {
+            // for MSIE
+            try {
+                filename = URLEncoder.encode(filename, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                log.error("Unsupported Encoding.", e);
+            }
+        } else {
+            // for Others
+            try {
+                filename = MimeUtility.encodeWord(filename, "UTF-8", "B");
+            } catch (UnsupportedEncodingException e) {
+                log.error("Unsupported Encoding.", e);
+            }
+        }
+        response.setHeader("Content-Disposition", "inline; filename=\"" +
+                filename + "\"");
+    }
+
+    public static boolean isMSIE(HttpServletRequest request) {
+        String agent = request.getHeader("user-agent");
+        if (log.isDebugEnabled()) {
+            log.debug("isMSIE() - agent=" + agent);
+        }
+        if (agent.indexOf("MSIE") > 0) {
+            return true;
+        }
+        return false;
+    }
+
+    public static void writeResponse(HttpServletRequest request,
+            HttpServletResponse response, String contentType, String filename,
+            InputStream in) throws IOException {
+        setContentType(request, response, contentType);
+        setFilename(request, response, filename);
+        writeResponse(request, response, in);
+    }
+
+    public static void writeResponse(HttpServletRequest request,
+            HttpServletResponse response, InputStream in) throws IOException {
+        StreamUtil.drain(in, response.getOutputStream());
+        response.getOutputStream().flush();
+    }
+
+    public static String getMimeType(Object context, String filename) {
+        if (context instanceof ServletContext) {
+            ServletContext servletContext = (ServletContext) context;
+            return servletContext.getMimeType(filename);
+        } else if (context instanceof PortletContext) {
+            PortletContext portletContext = (PortletContext) context;
+            return portletContext.getMimeType(filename);
+        }
+        return null;
+    }
+
+}


Property changes on: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/DownloadUtil.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/StreamUtil.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/StreamUtil.java	                        (rev 0)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/StreamUtil.java	2008-12-15 21:34:40 UTC (rev 1617)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2005-2006 Portal Application Laboratory project.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package jp.sf.pal.wcm.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author shinsuke
+ * 
+ */
+public class StreamUtil {
+    private static final int BLOCK_SIZE = 4096;
+
+    public static void drain(InputStream r, OutputStream w) throws IOException {
+        byte[] bytes = new byte[BLOCK_SIZE];
+        try {
+            int length = r.read(bytes);
+            while (length != -1) {
+                if (length != 0) {
+                    w.write(bytes, 0, length);
+                }
+                length = r.read(bytes);
+            }
+        } finally {
+            bytes = null;
+        }
+
+    }
+}


Property changes on: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/StreamUtil.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: pal-wcm/trunk/src/main/webapp/WEB-INF/view/editor/prefs.jsp
===================================================================
--- pal-wcm/trunk/src/main/webapp/WEB-INF/view/editor/prefs.jsp	2008-12-15 13:49:10 UTC (rev 1616)
+++ pal-wcm/trunk/src/main/webapp/WEB-INF/view/editor/prefs.jsp	2008-12-15 21:34:40 UTC (rev 1617)
@@ -29,7 +29,7 @@
     <html:hidden property="currentPath"/>
     <div style="margin-top:5px;">
       <label><bean:message key="prefs.label.language"/></label><br/>
-      <html:select property="locale" size="10">
+      <html:select property="locale" size="10" style="width:200px;">
         <c:forEach var="l" items="${localeList}">
           <html:option value="${l[1]}">${l[0]}(${l[1]})</html:option>
         </c:forEach>
@@ -45,7 +45,7 @@
     <html:hidden property="currentPath"/>
     <div>
       <label><bean:message key="prefs.language_list"/></label><br/>
-      <html:select property="locale" size="5" style="width:150px;">
+      <html:select property="locale" size="5" style="width:200px;">
         <c:forEach var="l" items="${localeItems}">
           <html:option value="${f:h(l)}">${f:h(l)}</html:option>
         </c:forEach>


pal-cvs メーリングリストの案内
Back to archive index