← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7662: import fixes

 

------------------------------------------------------------
revno: 7662
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-07-21 17:46:29 +0200
message:
  import fixes
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java	2012-07-21 15:45:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java	2012-07-21 15:46:29 +0000
@@ -27,13 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Calendar;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import javassist.util.proxy.ProxyObject;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
@@ -44,8 +37,14 @@
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Calendar;
+
+import static org.apache.commons.lang.StringUtils.trimToNull;
 import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY;
-import static org.apache.commons.lang.StringUtils.trimToNull;
 
 /**
  * @author Lars Helge Overland
@@ -74,7 +73,7 @@
 
     @Autowired
     private SystemSettingManager systemSettingManager;
-    
+
     public enum CacheStrategy
     {
         NO_CACHE,
@@ -82,9 +81,9 @@
         CACHE_TWO_WEEKS,
         RESPECT_SYSTEM_SETTING
     }
-    
+
     public void configureResponse( HttpServletResponse response, String contentType, CacheStrategy cacheStrategy,
-        String filename, boolean attachment )
+                                   String filename, boolean attachment )
     {
         if ( contentType != null )
         {
@@ -94,10 +93,10 @@
         if ( cacheStrategy.equals( CacheStrategy.RESPECT_SYSTEM_SETTING ) )
         {
             String strategy = trimToNull( (String) systemSettingManager.getSystemSetting( KEY_CACHE_STRATEGY ) );
-            
+
             cacheStrategy = strategy != null ? CacheStrategy.valueOf( strategy ) : CacheStrategy.NO_CACHE;
         }
-        
+
         if ( cacheStrategy == null || cacheStrategy.equals( CacheStrategy.NO_CACHE ) )
         {
             // -----------------------------------------------------------------
@@ -117,7 +116,7 @@
         {
             Calendar cal = Calendar.getInstance();
             cal.add( Calendar.DAY_OF_YEAR, 14 );
-            
+
             response.setHeader( HEADER_CACHE_CONTROL, "public, max-age=1209600" );
             response.setHeader( HEADER_EXPIRES, DateUtils.getHttpDateString( cal.getTime() ) );
         }
@@ -135,30 +134,29 @@
         response.setStatus( HttpServletResponse.SC_CONFLICT );
         printResponse( response, message );
     }
-    
+
     public static void okResponse( HttpServletResponse response, String message )
     {
         response.setStatus( HttpServletResponse.SC_OK );
         printResponse( response, message );
     }
-    
+
     public static void notFoundResponse( HttpServletResponse response, String message )
     {
         response.setStatus( HttpServletResponse.SC_NOT_FOUND );
         printResponse( response, message );
     }
-    
+
     private static void printResponse( HttpServletResponse response, String message )
     {
         response.setContentType( CONTENT_TYPE_TEXT );
-        
+
         try
         {
             PrintWriter writer = response.getWriter();
             writer.println( message );
             writer.flush();
-        }
-        catch ( IOException ex )
+        } catch ( IOException ex )
         {
             // Ignore
         }
@@ -208,8 +206,7 @@
         try
         {
             port = Integer.parseInt( xForwardedPort );
-        }
-        catch ( NumberFormatException e )
+        } catch ( NumberFormatException e )
         {
             port = request.getServerPort();
         }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebUtils.java	2012-07-21 15:45:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebUtils.java	2012-07-21 15:46:29 +0000
@@ -27,18 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javassist.util.proxy.ProxyObject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.api.controller.WebMetaData;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.Pager;
-import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
 import org.hisp.dhis.system.util.ReflectionUtils;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.servlet.http.HttpServletRequest;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;