← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2123: dhis-live: Added maxformcontentsize for jetty settings

 

------------------------------------------------------------
revno: 2123
committer: Saptarshi <sunbiz@xxxxxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-16 01:28:14 +0530
message:
  dhis-live: Added maxformcontentsize for jetty settings
modified:
  dhis-live/src/main/java/org/hisp/dhis/SettingsWindow.java
  dhis-live/src/main/java/org/hisp/dhis/TrayApp.java
  dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java
  dhis-live/src/main/resources/Config.xsd
  dhis-live/src/main/resources/defaultConfig.xml


--
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-live/src/main/java/org/hisp/dhis/SettingsWindow.java'
--- dhis-live/src/main/java/org/hisp/dhis/SettingsWindow.java	2010-09-14 22:43:21 +0000
+++ dhis-live/src/main/java/org/hisp/dhis/SettingsWindow.java	2010-09-15 19:58:14 +0000
@@ -1,3 +1,30 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 package org.hisp.dhis;
 
 
@@ -39,6 +66,10 @@
         countryLabel = new javax.swing.JLabel();
         langField = new javax.swing.JTextField();
         countryField = new javax.swing.JTextField();
+        maxSizeLabel = new javax.swing.JLabel();
+        maxSizeField = new javax.swing.JTextField();
+        maxSizeDefaultLabel = new javax.swing.JLabel();
+        unitLabel = new javax.swing.JLabel();
         databaseConfigPanel = new javax.swing.JPanel();
         saveButton = new javax.swing.JButton();
 
@@ -81,6 +112,15 @@
         binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, config, org.jdesktop.beansbinding.ELProperty.create("${appConfiguration.localeCountry}"), countryField, org.jdesktop.beansbinding.BeanProperty.create("text_ON_FOCUS_LOST"), "countryBinding");
         bindingGroup.addBinding(binding);
 
+        maxSizeLabel.setText("Max Form Content Size:");
+
+        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, config, org.jdesktop.beansbinding.ELProperty.create("${appConfiguration.maxFormContentSize}"), maxSizeField, org.jdesktop.beansbinding.BeanProperty.create("text"));
+        bindingGroup.addBinding(binding);
+
+        maxSizeDefaultLabel.setText("(* requires restart of DHIS 2 Live - default: 200000)");
+
+        unitLabel.setText("(bytes)");
+
         javax.swing.GroupLayout appConfigPanelLayout = new javax.swing.GroupLayout(appConfigPanel);
         appConfigPanel.setLayout(appConfigPanelLayout);
         appConfigPanelLayout.setHorizontalGroup(
@@ -89,28 +129,41 @@
                 .addContainerGap()
                 .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(appConfigPanelLayout.createSequentialGroup()
-                        .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
-                            .addComponent(hostLabel)
-                            .addComponent(langLabel))
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
-                            .addComponent(langField)
-                            .addComponent(hostField, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
+                        .addGap(25, 25, 25)
+                        .addComponent(hostLabel)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(hostField, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addGap(29, 29, 29)
+                        .addComponent(portLabel)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addGap(18, 18, 18)
+                        .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addComponent(maxSizeDefaultLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
+                            .addGroup(appConfigPanelLayout.createSequentialGroup()
+                                .addComponent(maxSizeLabel)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                .addComponent(maxSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                .addComponent(unitLabel)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)))
+                        .addContainerGap())
+                    .addGroup(appConfigPanelLayout.createSequentialGroup()
+                        .addComponent(langLabel)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(langField, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
                         .addGap(10, 10, 10)
-                        .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
-                            .addComponent(countryLabel)
-                            .addComponent(portLabel))
+                        .addComponent(countryLabel)
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
-                            .addComponent(countryField)
-                            .addComponent(portField, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)))
+                        .addComponent(countryField, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
+                        .addGap(280, 280, 280))
                     .addGroup(appConfigPanelLayout.createSequentialGroup()
                         .addComponent(browserPathLabel)
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(browserPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(browserPathButton)))
-                .addContainerGap(64, Short.MAX_VALUE))
+                        .addComponent(browserPathField, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                        .addComponent(browserPathButton)
+                        .addGap(8, 8, 8))))
         );
         appConfigPanelLayout.setVerticalGroup(
             appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -119,13 +172,21 @@
                     .addComponent(hostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(portLabel)
-                    .addComponent(hostLabel))
-                .addGap(18, 18, 18)
-                .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(langLabel)
-                    .addComponent(countryLabel)
-                    .addComponent(langField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(countryField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addComponent(hostLabel)
+                    .addComponent(maxSizeLabel)
+                    .addComponent(maxSizeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(unitLabel))
+                .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(appConfigPanelLayout.createSequentialGroup()
+                        .addGap(1, 1, 1)
+                        .addComponent(maxSizeDefaultLabel))
+                    .addGroup(appConfigPanelLayout.createSequentialGroup()
+                        .addGap(18, 18, 18)
+                        .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                            .addComponent(langLabel)
+                            .addComponent(countryLabel)
+                            .addComponent(langField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(countryField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                 .addGap(18, 18, 18)
                 .addGroup(appConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                     .addComponent(browserPathLabel)
@@ -140,7 +201,7 @@
         databaseConfigPanel.setLayout(databaseConfigPanelLayout);
         databaseConfigPanelLayout.setHorizontalGroup(
             databaseConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGap(0, 540, Short.MAX_VALUE)
+            .addGap(0, 571, Short.MAX_VALUE)
         );
         databaseConfigPanelLayout.setVerticalGroup(
             databaseConfigPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -186,6 +247,7 @@
 
     private void saveButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_saveButtonActionPerformed
     {//GEN-HEADEREND:event_saveButtonActionPerformed
+        TrayApp.getInstance().writeConfigToFile();
         this.dispose();
     }//GEN-LAST:event_saveButtonActionPerformed
 
@@ -214,9 +276,13 @@
     private javax.swing.JLabel hostLabel;
     private javax.swing.JTextField langField;
     private javax.swing.JLabel langLabel;
+    private javax.swing.JLabel maxSizeDefaultLabel;
+    private javax.swing.JTextField maxSizeField;
+    private javax.swing.JLabel maxSizeLabel;
     private javax.swing.JTextField portField;
     private javax.swing.JLabel portLabel;
     private javax.swing.JButton saveButton;
+    private javax.swing.JLabel unitLabel;
     private org.jdesktop.beansbinding.BindingGroup bindingGroup;
     // End of variables declaration//GEN-END:variables
 }

=== modified file 'dhis-live/src/main/java/org/hisp/dhis/TrayApp.java'
--- dhis-live/src/main/java/org/hisp/dhis/TrayApp.java	2010-09-14 22:43:21 +0000
+++ dhis-live/src/main/java/org/hisp/dhis/TrayApp.java	2010-09-15 19:58:14 +0000
@@ -613,7 +613,7 @@
      * Reads the config.xml and creates the Config Object
      * Uses JAXBElement to config back unmarshal the config.xml
      */
-    private void readConfigFromStream( InputStream configStream )
+    public void readConfigFromStream( InputStream configStream )
     {
         try
         {
@@ -635,7 +635,7 @@
      * Writes the config.xml based on the changed config by marshalling the config object
      * Uses JAXBElement to write the config back to xml
      */
-    private void writeConfigToFile()
+    public void writeConfigToFile()
     {
         try
         {

=== modified file 'dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java'
--- dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java	2010-09-14 22:43:21 +0000
+++ dhis-live/src/main/java/org/hisp/dhis/WebAppServer.java	2010-09-15 19:58:14 +0000
@@ -93,6 +93,7 @@
         ContextHandlerCollection handlers = new ContextHandlerCollection();
 
         WebAppContext dhisWebApp = new WebAppContext();
+        dhisWebApp.setMaxFormContentSize( TrayApp.appConfig.getMaxFormContentSize() );
         dhisWebApp.setWar( installDir + DHIS_DIR );
         handlers.addHandler( dhisWebApp );
         log.info( "Setting DHIS 2 web app context to: " + installDir + DHIS_DIR );

=== modified file 'dhis-live/src/main/resources/Config.xsd'
--- dhis-live/src/main/resources/Config.xsd	2010-09-14 22:43:21 +0000
+++ dhis-live/src/main/resources/Config.xsd	2010-09-15 19:58:14 +0000
@@ -12,6 +12,7 @@
                         <xs:element name="Port" type="xs:int" default="8080"/>
                         <xs:element name="Host" type="xs:string" default="localhost"/>
                         <xs:element name="PreferredBrowser" type="xs:string" default=""/>
+                        <xs:element name="MaxFormContentSize" type="xs:int" default="400000"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>

=== modified file 'dhis-live/src/main/resources/defaultConfig.xml'
--- dhis-live/src/main/resources/defaultConfig.xml	2010-09-14 22:43:21 +0000
+++ dhis-live/src/main/resources/defaultConfig.xml	2010-09-15 19:58:14 +0000
@@ -11,6 +11,7 @@
         <Port>8080</Port>
         <Host>localhost</Host>
         <PreferredBrowser/>
+        <MaxFormContentSize>400000</MaxFormContentSize>
     </AppConfiguration>
     <DatabaseConfiguration>
         <ConnectionTypes>