click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From med...@apache.org
Subject svn commit: r917470 - in /click/trunk/click/framework/src/org/apache/click: ClickRequestWrapper.java Context.java
Date Mon, 01 Mar 2010 11:24:54 GMT
Author: medgar
Date: Mon Mar  1 11:24:53 2010
New Revision: 917470

URL: http://svn.apache.org/viewvc?rev=917470&view=rev
Log:
CLK-633

Modified:
    click/trunk/click/framework/src/org/apache/click/ClickRequestWrapper.java
    click/trunk/click/framework/src/org/apache/click/Context.java

Modified: click/trunk/click/framework/src/org/apache/click/ClickRequestWrapper.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickRequestWrapper.java?rev=917470&r1=917469&r2=917470&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickRequestWrapper.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickRequestWrapper.java Mon Mar  1 11:24:53
2010
@@ -45,17 +45,17 @@
     /**
      * The <tt>FileItem</tt> objects for <tt>"multipart"</tt> POST
requests.
      */
-    private final Map fileItemMap;
+    private final Map<String, FileItem[]> fileItemMap;
 
     /** The request is a multi-part file upload POST request. */
     private final boolean isMultipartRequest;
 
+    /** The map of <tt>"multipart"</tt> request parameter values. */
+    private final Map<String, String[]> multipartParameterMap;
+
     /** The wrapped servlet request. */
     private final HttpServletRequest request;
 
-    /** The map of <tt>"multipart"</tt> request parameter values. */
-    private final Map multipartParameterMap;
-
     // ----------------------------------------------------------- Constructors
 
     /**
@@ -70,11 +70,11 @@
 
         if (isMultipartRequest) {
 
-            Map requestParams = new HashMap();
-            Map fileItems = new HashMap();
+            Map<String, String[]> requestParams = new HashMap<String, String[]>();
+            Map<String, FileItem[]> fileItems = new HashMap<String, FileItem[]>();
 
             try {
-                List itemsList = new ArrayList();
+                List<FileItem> itemsList = new ArrayList<FileItem>();
 
                 try {
 
@@ -127,8 +127,8 @@
             }
 
         } else {
-            fileItemMap = Collections.EMPTY_MAP;
-            multipartParameterMap = Collections.EMPTY_MAP;
+            fileItemMap = Collections.emptyMap();
+            multipartParameterMap = Collections.emptyMap();
         }
     }
 
@@ -142,7 +142,7 @@
      * @return map of <tt>FileItem arrays</tt> keyed on request parameter name
      * for "multipart" POST requests
      */
-    public Map getFileItemMap() {
+    public Map<String, FileItem[]> getFileItemMap() {
         return fileItemMap;
     }
 
@@ -176,6 +176,7 @@
     /**
      * @see javax.servlet.ServletRequest#getParameterNames()
      */
+    @SuppressWarnings("unchecked")
     public Enumeration getParameterNames() {
         if (isMultipartRequest) {
             return Collections.enumeration(getMultipartParameterMap().keySet());
@@ -208,6 +209,7 @@
     /**
      * @see javax.servlet.ServletRequest#getParameterMap()
      */
+    @SuppressWarnings("unchecked")
     public Map getParameterMap() {
         if (isMultipartRequest) {
             return getMultipartParameterMap();
@@ -245,8 +247,8 @@
      * @param name the name of the map key
      * @param value the value to add to the FileItem array
      */
-    private void addToMapAsFileItem(Map map, String name, FileItem value) {
-        FileItem[] oldValues = (FileItem[]) map.get(name);
+    private void addToMapAsFileItem(Map<String, FileItem[]> map, String name, FileItem
value) {
+        FileItem[] oldValues = map.get(name);
         FileItem[] newValues = null;
         if (oldValues == null) {
             newValues = new FileItem[] {value};
@@ -267,8 +269,8 @@
      * @param name the name of the map key
      * @param value the value to add to the string array
      */
-    private void addToMapAsString(Map map, String name, String value) {
-        String[] oldValues = (String[]) map.get(name);
+    private void addToMapAsString(Map<String, String[]> map, String name, String value)
{
+        String[] oldValues = map.get(name);
         String[] newValues = null;
         if (oldValues == null) {
             newValues = new String[] {value};

Modified: click/trunk/click/framework/src/org/apache/click/Context.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Context.java?rev=917470&r1=917469&r2=917470&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Context.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Context.java Mon Mar  1 11:24:53 2010
@@ -61,12 +61,12 @@
     static final String CONTEXT_FATAL_ERROR = "_context_fatal_error";
 
     /** The thread local context. */
-    private static final ThreadLocal THREAD_LOCAL_CONTEXT = new ThreadLocal();
+    private static final ThreadLocal<ContextStack> THREAD_LOCAL_CONTEXT = new ThreadLocal<ContextStack>();
 
     /** Ajax request header or parameter: "<tt>X-Requested-With</tt>". */
     private static final String X_REQUESTED_WITH = "X-Requested-With";
 
-    // -------------------------------------------------------------- Instance Variables
+    // ----------------------------------------------------- Instance Variables
 
     /** The servlet context. */
     protected final ServletContext context;
@@ -551,7 +551,7 @@
      * @throws IllegalArgumentException if the Page is not found, or is not
      * configured with a unique path
      */
-    public Page createPage(Class pageClass) {
+    public Page createPage(Class<? extends Page> pageClass) {
         return clickServlet.createPage(pageClass, request);
     }
 
@@ -563,7 +563,7 @@
      * @throws IllegalArgumentException if the Page Class is not configured
      * with a unique path
      */
-    public String getPagePath(Class pageClass) {
+    public String getPagePath(Class<? extends Page> pageClass) {
         return clickServlet.getConfigService().getPagePath(pageClass);
     }
 
@@ -575,7 +575,7 @@
      * @throws IllegalArgumentException if the Page Class for the path is not
      * found
      */
-    public Class getPageClass(String path) {
+    public Class<? extends Page> getPageClass(String path) {
         return clickServlet.getConfigService().getPageClass(path);
     }
 
@@ -619,7 +619,7 @@
      * @return map of <tt>FileItem arrays</tt> keyed on request parameter name
      * for "multipart" POST requests
      */
-    public Map getFileItemMap() {
+    public Map<String, FileItem[]> getFileItemMap() {
         return findClickRequestWrapper(request).getFileItemMap();
     }
 
@@ -736,7 +736,7 @@
      * @return rendered Velocity template merged with the model data
      * @throws RuntimeException if an error occurs
      */
-    public String renderTemplate(Class templateClass, Map model) {
+    public String renderTemplate(Class templateClass, Map<String, Object> model) {
 
         if (templateClass == null) {
             String msg = "Null templateClass parameter";
@@ -764,7 +764,7 @@
      * @return rendered Velocity template merged with the model data
      * @throws RuntimeException if an error occurs
      */
-    public String renderTemplate(String templatePath, Map model) {
+    public String renderTemplate(String templatePath, Map<String, Object> model) {
 
         if (templatePath == null) {
             String msg = "Null templatePath parameter";
@@ -865,7 +865,7 @@
     /**
      * Provides an unsynchronized Context Stack.
      */
-    static class ContextStack extends ArrayList {
+    static class ContextStack extends ArrayList<Context> {
 
         /** Serialization version indicator. */
         private static final long serialVersionUID = 1L;



Mime
View raw message