Revision 5076
Added by daigle about 15 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
671 | 671 |
// Each time metacat is called, check to see if metacat has been |
672 | 672 |
// configured. If not then forward to the administration servlet |
673 | 673 |
if (!ConfigurationUtil.isMetacatConfigured()) { |
674 |
RequestUtil.forwardRequest(request, response, "/admin?action=configure", null); |
|
675 |
return; |
|
674 |
try { |
|
675 |
RequestUtil.forwardRequest(request, response, "/admin?action=configure", null); |
|
676 |
return; |
|
677 |
} catch (MetacatUtilException mue) { |
|
678 |
logMetacat.error("MetacatServlet.handleGetOrPost - utility error when forwarding to " + |
|
679 |
"configuration screen: " + mue.getMessage()); |
|
680 |
throw new ServletException("MetacatServlet.handleGetOrPost - utility error when forwarding to " + |
|
681 |
"configuration screen: " + mue.getMessage()); |
|
682 |
} |
|
676 | 683 |
} |
677 | 684 |
|
678 | 685 |
// if we get here, metacat is configured. If we have not completed the |
... | ... | |
697 | 704 |
DBConnectionPool pool = DBConnectionPool.getInstance(); |
698 | 705 |
pool.printMethodNameHavingBusyDBConnection(); |
699 | 706 |
} catch (SQLException e) { |
700 |
logMetacat.error("Error in MetacatServlet.handleGetOrPost: " |
|
701 |
+ e.getMessage()); |
|
707 |
logMetacat.error("Error in MetacatServlet.handleGetOrPost: " + e.getMessage()); |
|
702 | 708 |
e.printStackTrace(); |
703 | 709 |
} |
704 | 710 |
|
src/edu/ucsb/nceas/metacat/util/RequestUtil.java | ||
---|---|---|
30 | 30 |
import java.io.IOException; |
31 | 31 |
import java.io.BufferedReader; |
32 | 32 |
import java.io.PrintWriter; |
33 |
import java.io.StringReader; |
|
34 | 33 |
import java.net.MalformedURLException; |
35 | 34 |
import java.net.URL; |
36 | 35 |
import java.net.URLConnection; |
... | ... | |
52 | 51 |
import org.apache.commons.httpclient.methods.PostMethod; |
53 | 52 |
import org.apache.log4j.Logger; |
54 | 53 |
|
54 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
|
55 | 55 |
import edu.ucsb.nceas.metacat.service.SessionService; |
56 | 56 |
import edu.ucsb.nceas.metacat.shared.MetacatUtilException; |
57 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
|
57 | 58 |
|
58 | 59 |
public class RequestUtil { |
59 | 60 |
|
... | ... | |
75 | 76 |
* that can be used for writing output to the client |
76 | 77 |
* @param destination |
77 | 78 |
* the context-relative URL to which the request is forwarded |
79 |
* @param params the request parameters. these will be added to the request |
|
78 | 80 |
*/ |
79 |
public static void forwardRequest(HttpServletRequest request, |
|
80 |
HttpServletResponse response, String destinationUrl, Hashtable<String, String[]> params) |
|
81 |
throws IOException, ServletException { |
|
81 |
public static void forwardRequest(HttpServletRequest request, HttpServletResponse response, |
|
82 |
String destinationUrl, Hashtable<String, String[]> params) throws MetacatUtilException { |
|
82 | 83 |
|
83 | 84 |
destinationUrl += "?" + paramsToQuery(params); |
84 | 85 |
|
... | ... | |
86 | 87 |
ServletContext servletContext = request.getSession() |
87 | 88 |
.getServletContext(); |
88 | 89 |
|
89 |
servletContext.getRequestDispatcher(destinationUrl).forward(request, |
|
90 |
response); |
|
90 |
try { |
|
91 |
servletContext.getRequestDispatcher(destinationUrl).forward(request, response); |
|
92 |
} catch (IOException ioe) { |
|
93 |
throw new MetacatUtilException("RequestUtil.forwardRequest - I/O error when forwarding to " + |
|
94 |
destinationUrl + " : " + ioe.getMessage()); |
|
95 |
} catch (ServletException se) { |
|
96 |
throw new MetacatUtilException("RequestUtil.forwardRequest - Servlet error when forwarding to " + |
|
97 |
destinationUrl + " : " + se.getMessage()); |
|
98 |
} |
|
91 | 99 |
} |
100 |
|
|
101 |
/** |
|
102 |
* Forward a request that was received by this servlet on to another JSP |
|
103 |
* page or servlet to continue handling the request. In this case, the page |
|
104 |
* must be referenced in a paramter named "forwardto". If the qformat is |
|
105 |
* provided, the file will be retrieved from that skin. Otherwise, the file |
|
106 |
* will be retrieved from the system default skin. |
|
107 |
* |
|
108 |
* For more specific file location, use: forwardRequest(request,response, destinationUrl, params) |
|
109 |
* |
|
110 |
* @param request |
|
111 |
* to be forwarded |
|
112 |
* @param response |
|
113 |
* that can be used for writing output to the client |
|
114 |
* @param params |
|
115 |
* the request parameters. these will be added to the request. |
|
116 |
*/ |
|
117 |
public static void forwardRequest(HttpServletRequest request, HttpServletResponse response, |
|
118 |
Hashtable<String, String[]> params) throws MetacatUtilException { |
|
92 | 119 |
|
120 |
String forwardTos[] = params.get("forwardto"); |
|
121 |
if (forwardTos == null || forwardTos[0].equals("")) { |
|
122 |
throw new MetacatUtilException("RequestUtil.forwardRequest - forwardto must be set in parameters when forwarding."); |
|
123 |
} |
|
124 |
|
|
125 |
String forwardTo = forwardTos[0]; |
|
126 |
String qformat = null; |
|
127 |
|
|
128 |
String qformats[] = params.get("qformat"); |
|
129 |
if (qformats == null || qformats.length == 0) { |
|
130 |
try { |
|
131 |
qformat = PropertyService.getProperty("application.default-style"); |
|
132 |
} catch (PropertyNotFoundException pnfe) { |
|
133 |
qformat = "default"; |
|
134 |
logMetacat.warn("RequestUtil.forwardRequest - could not get property " + |
|
135 |
"'application.default-style'. Using 'default'"); |
|
136 |
} |
|
137 |
} else { |
|
138 |
qformat = qformats[0]; |
|
139 |
} |
|
140 |
|
|
141 |
String destinationUrl = "/style/skins/" + qformat + "/" + forwardTo; |
|
142 |
destinationUrl += "?" + paramsToQuery(params); |
|
143 |
|
|
144 |
logMetacat.debug("RequestUtil.forwardRequest - Forwarding request to " + destinationUrl); |
|
145 |
ServletContext servletContext = request.getSession() |
|
146 |
.getServletContext(); |
|
147 |
try { |
|
148 |
servletContext.getRequestDispatcher(destinationUrl).forward(request, response); |
|
149 |
} catch (IOException ioe) { |
|
150 |
throw new MetacatUtilException("RequestUtil.forwardRequest - I/O error when forwarding to " + |
|
151 |
destinationUrl + " : " + ioe.getMessage()); |
|
152 |
} catch (ServletException se) { |
|
153 |
throw new MetacatUtilException("RequestUtil.forwardRequest - Servlet error when forwarding to " + |
|
154 |
destinationUrl + " : " + se.getMessage()); |
|
155 |
} |
|
156 |
} |
|
157 |
|
|
158 |
|
|
159 |
|
|
93 | 160 |
/** |
94 | 161 |
* Post a request and return the response body |
95 | 162 |
* |
... | ... | |
251 | 318 |
* @param cookieName |
252 | 319 |
* the name of the cookie to look for |
253 | 320 |
*/ |
321 |
@SuppressWarnings("unchecked") |
|
254 | 322 |
public static Hashtable<String, String[]> getParameters(HttpServletRequest request) { |
255 | 323 |
Hashtable<String, String[]> params = new Hashtable<String, String[]>(); |
256 | 324 |
|
src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java | ||
---|---|---|
31 | 31 |
import java.util.Set; |
32 | 32 |
import java.util.Vector; |
33 | 33 |
|
34 |
import javax.servlet.ServletException; |
|
35 | 34 |
import javax.servlet.http.HttpServletRequest; |
36 | 35 |
import javax.servlet.http.HttpServletResponse; |
37 | 36 |
|
... | ... | |
39 | 38 |
|
40 | 39 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
41 | 40 |
import edu.ucsb.nceas.metacat.properties.SkinPropertyService; |
41 |
import edu.ucsb.nceas.metacat.shared.MetacatUtilException; |
|
42 | 42 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
43 | 43 |
import edu.ucsb.nceas.metacat.util.SkinUtil; |
44 | 44 |
import edu.ucsb.nceas.utilities.MetaDataProperty; |
... | ... | |
168 | 168 |
} catch (GeneralPropertyException pnfe) { |
169 | 169 |
throw new AdminException("SkinsAdmin.configureSkins - Problem getting property while " + |
170 | 170 |
"initializing skins properties page: " + pnfe.getMessage()); |
171 |
} catch (IOException ioe) { |
|
172 |
throw new AdminException("SkinsAdmin.configureSkins - IO problem while initializing " |
|
173 |
+ "skins properties page:" + ioe.getMessage()); |
|
174 |
} catch (ServletException se) { |
|
175 |
throw new AdminException("SkinsAdmin.configureSkins - problem forwarding request while " |
|
176 |
+ "initializing skins properties page: " + se.getMessage()); |
|
177 |
} |
|
171 |
} catch (MetacatUtilException mue) { |
|
172 |
throw new AdminException("SkinsAdmin.configureSkins - utility problem while initializing " |
|
173 |
+ "skins properties page:" + mue.getMessage()); |
|
174 |
} |
|
178 | 175 |
|
179 | 176 |
} else { |
180 | 177 |
// The configuration form is being submitted and needs to be |
... | ... | |
267 | 264 |
RequestUtil.forwardRequest(request, response, |
268 | 265 |
"/admin?configureType=configure&processForm=false", null); |
269 | 266 |
} |
270 |
} catch (ServletException se) { |
|
271 |
throw new AdminException("SkinsAdmin.configureSkins - problem forwarding request while " |
|
272 |
+ "processing skins properties page: " + se.getMessage()); |
|
273 |
} catch (IOException ioe) { |
|
274 |
throw new AdminException("SkinsAdmin.configureSkins - IO problem while processing skins " |
|
275 |
+ "properties page: " + ioe.getMessage()); |
|
267 |
} catch (MetacatUtilException mue) { |
|
268 |
throw new AdminException("SkinsAdmin.configureSkins - utility problem while processing skins " |
|
269 |
+ "properties page: " + mue.getMessage()); |
|
276 | 270 |
} catch (GeneralPropertyException gpe) { |
277 | 271 |
String errorMessage = "SkinsAdmin.configureSkins - problem setting property while processing skins " |
278 | 272 |
+ "properties page: " + gpe.getMessage(); |
src/edu/ucsb/nceas/metacat/admin/LoginAdmin.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
package edu.ucsb.nceas.metacat.admin; |
28 | 28 |
|
29 |
import java.io.IOException; |
|
30 | 29 |
import java.util.Vector; |
31 | 30 |
|
32 |
import javax.servlet.ServletException; |
|
33 | 31 |
import javax.servlet.http.HttpServletRequest; |
34 | 32 |
import javax.servlet.http.HttpServletResponse; |
35 | 33 |
|
... | ... | |
91 | 89 |
} catch (MetacatUtilException mue) { |
92 | 90 |
throw new AdminException("LoginAdmin.authenticateUser - Utility problem while " + |
93 | 91 |
"processing login page: " + mue.getMessage()); |
94 |
} catch (IOException ioe) { |
|
95 |
throw new AdminException("LoginAdmin.authenticateUser -IO problem while initializing " |
|
96 |
+ "user login page:" + ioe.getMessage()); |
|
97 |
} catch (ServletException se) { |
|
98 |
throw new AdminException("LoginAdmin.authenticateUser -problem forwarding request while " |
|
99 |
+ "initializing user login page: " + se.getMessage()); |
|
100 |
} |
|
92 |
} |
|
101 | 93 |
} else { |
102 | 94 |
// The configuration form is being submitted and needs to be |
103 | 95 |
// processed. |
... | ... | |
105 | 97 |
Vector<String> processingErrors = new Vector<String>(); |
106 | 98 |
Vector<String> validationErrors = new Vector<String>(); |
107 | 99 |
|
108 |
Boolean isLoggedIn = false; |
|
109 | 100 |
String userName = ""; |
110 | 101 |
|
111 | 102 |
userName = request.getParameter("username"); |
... | ... | |
119 | 110 |
|
120 | 111 |
if (validationErrors.size() == 0) { |
121 | 112 |
try { |
122 |
isLoggedIn = AuthUtil.logUserIn(request, userName, password);
|
|
113 |
AuthUtil.logUserIn(request, userName, password); |
|
123 | 114 |
} catch (MetacatUtilException ue) { |
124 | 115 |
String errorMessage = "LoginAdmin.authenticateUser - Could not log in as: " + userName |
125 | 116 |
+ " : " + ue.getMessage() + ". Please try again"; |
... | ... | |
143 | 134 |
RequestUtil.forwardRequest(request, response, |
144 | 135 |
"/admin?configureType=configure&processForm=false", null); |
145 | 136 |
} |
146 |
} catch (IOException ioe) {
|
|
137 |
} catch (MetacatUtilException mue) {
|
|
147 | 138 |
throw new AdminException("LoginAdmin.authenticateUser - IO problem while processing login page: " |
148 |
+ ioe.getMessage()); |
|
149 |
} catch (ServletException se) { |
|
150 |
throw new AdminException("LoginAdmin.authenticateUser - problem forwarding request while " |
|
151 |
+ "processoing login page: " + se.getMessage()); |
|
152 |
} |
|
139 |
+ mue.getMessage()); |
|
140 |
} |
|
153 | 141 |
} |
154 | 142 |
} |
155 | 143 |
|
src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
package edu.ucsb.nceas.metacat.admin; |
28 | 28 |
|
29 |
import java.io.IOException; |
|
30 | 29 |
import java.util.Vector; |
31 | 30 |
|
32 |
import javax.servlet.ServletException; |
|
33 | 31 |
import javax.servlet.http.HttpServletRequest; |
34 | 32 |
import javax.servlet.http.HttpServletResponse; |
35 | 33 |
|
... | ... | |
39 | 37 |
import edu.ucsb.nceas.metacat.database.DBVersion; |
40 | 38 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
41 | 39 |
import edu.ucsb.nceas.metacat.service.ServiceService; |
40 |
import edu.ucsb.nceas.metacat.shared.MetacatUtilException; |
|
42 | 41 |
import edu.ucsb.nceas.metacat.shared.ServiceException; |
43 | 42 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
44 | 43 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
... | ... | |
162 | 161 |
} catch (GeneralPropertyException gpe) { |
163 | 162 |
throw new AdminException("PropertiesAdmin.configureProperties - Problem getting or " + |
164 | 163 |
"setting property while initializing system properties page: " + gpe.getMessage()); |
165 |
} catch (IOException ioe) {
|
|
166 |
throw new AdminException("PropertiesAdmin.configureProperties - IO problem while initializing "
|
|
167 |
+ "system properties page:" + ioe.getMessage());
|
|
164 |
} catch (MetacatUtilException mue) {
|
|
165 |
throw new AdminException("PropertiesAdmin.configureProperties - utility problem while initializing "
|
|
166 |
+ "system properties page:" + mue.getMessage());
|
|
168 | 167 |
} catch (ServiceException se) { |
169 | 168 |
throw new AdminException("PropertiesAdmin.configureProperties - Service problem while initializing " |
170 | 169 |
+ "system properties page:" + se.getMessage()); |
171 |
} catch (ServletException se) { |
|
172 |
throw new AdminException("PropertiesAdmin.configureProperties - problem forwarding request while " |
|
173 |
+ "initializing system properties page: " + se.getMessage()); |
|
174 |
} |
|
170 |
} |
|
175 | 171 |
} else { |
176 | 172 |
// The configuration form is being submitted and needs to be |
177 | 173 |
// processed. |
... | ... | |
296 | 292 |
RequestUtil.forwardRequest(request, response, |
297 | 293 |
"/admin?configureType=configure&processForm=false", null); |
298 | 294 |
} |
299 |
|
|
300 |
} catch (ServletException se) { |
|
301 |
throw new AdminException("PropertiesAdmin.configureProperties - problem forwarding request while " |
|
302 |
+ "processing system properties page: " + se.getMessage()); |
|
303 |
} catch (IOException ioe) { |
|
304 |
throw new AdminException("PropertiesAdmin.configureProperties - IO problem while processing system " |
|
305 |
+ "properties page: " + ioe.getMessage()); |
|
295 |
} catch (MetacatUtilException mue) { |
|
296 |
throw new AdminException("PropertiesAdmin.configureProperties - utility problem while processing system " |
|
297 |
+ "properties page: " + mue.getMessage()); |
|
306 | 298 |
} catch (GeneralPropertyException gpe) { |
307 | 299 |
throw new AdminException("PropertiesAdmin.configureProperties - problem with properties while " |
308 | 300 |
+ "processing system properties page: " + gpe.getMessage()); |
src/edu/ucsb/nceas/metacat/admin/AuthAdmin.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
package edu.ucsb.nceas.metacat.admin; |
28 | 28 |
|
29 |
import java.io.IOException; |
|
30 | 29 |
import java.net.ConnectException; |
31 | 30 |
import java.util.Set; |
32 | 31 |
import java.util.SortedMap; |
33 | 32 |
import java.util.Vector; |
34 | 33 |
|
35 |
import javax.servlet.ServletException; |
|
36 | 34 |
import javax.servlet.http.HttpServletRequest; |
37 | 35 |
import javax.servlet.http.HttpServletResponse; |
38 | 36 |
|
... | ... | |
40 | 38 |
|
41 | 39 |
import edu.ucsb.nceas.metacat.AuthSession; |
42 | 40 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
41 |
import edu.ucsb.nceas.metacat.shared.MetacatUtilException; |
|
43 | 42 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
44 | 43 |
import edu.ucsb.nceas.utilities.GeneralPropertyException; |
45 | 44 |
import edu.ucsb.nceas.utilities.MetaDataProperty; |
... | ... | |
135 | 134 |
} catch (GeneralPropertyException gpe) { |
136 | 135 |
throw new AdminException("AuthAdmin.configureAuth - Problem getting property " + |
137 | 136 |
"while initializing LDAP properties page: " + gpe.getMessage()); |
138 |
} catch (IOException ioe) { |
|
139 |
throw new AdminException("AuthAdmin.configureAuth - IO problem while initializing " |
|
140 |
+ "LDAP properties page:" + ioe.getMessage()); |
|
141 |
} catch (ServletException se) { |
|
142 |
throw new AdminException("AuthAdmin.configureAuth - problem forwarding request while " |
|
143 |
+ "initializing LDAP properties page: " + se.getMessage()); |
|
144 |
} |
|
137 |
} catch (MetacatUtilException mue) { |
|
138 |
throw new AdminException("AuthAdmin.configureAuth - Utility problem while initializing " |
|
139 |
+ "LDAP properties page:" + mue.getMessage()); |
|
140 |
} |
|
145 | 141 |
} else { |
146 | 142 |
// The configuration form is being submitted and needs to be |
147 | 143 |
// processed. |
... | ... | |
227 | 223 |
RequestUtil.forwardRequest(request, response, |
228 | 224 |
"/admin?configureType=configure&processForm=false", null); |
229 | 225 |
} |
230 |
} catch (ServletException se) { |
|
231 |
throw new AdminException("AuthAdmin.configureAuth - problem forwarding request while " |
|
232 |
+ "processing LDAP properties page: " + se.getMessage()); |
|
233 |
} catch (IOException ioe) { |
|
234 |
throw new AdminException("AuthAdmin.configureAuth - IO problem while processing Authentication " |
|
235 |
+ "properties page: " + ioe.getMessage()); |
|
226 |
} catch (MetacatUtilException mue) { |
|
227 |
throw new AdminException("AuthAdmin.configureAuth - utility problem forwarding request while " |
|
228 |
+ "processing LDAP properties page: " + mue.getMessage()); |
|
236 | 229 |
} catch (GeneralPropertyException gpe) { |
237 | 230 |
String errorMessage = "AuthAdmin.configureAuth - Problem getting or setting property while " |
238 | 231 |
+ "processing Authentication properties page: " + gpe.getMessage(); |
src/edu/ucsb/nceas/metacat/admin/GeoserverAdmin.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
package edu.ucsb.nceas.metacat.admin; |
28 | 28 |
|
29 |
import java.io.IOException; |
|
30 | 29 |
import java.util.Vector; |
31 | 30 |
|
32 |
import javax.servlet.ServletException; |
|
33 | 31 |
import javax.servlet.http.HttpServletRequest; |
34 | 32 |
import javax.servlet.http.HttpServletResponse; |
35 | 33 |
|
... | ... | |
109 | 107 |
} catch (GeneralPropertyException gpe) { |
110 | 108 |
throw new AdminException("GeoserverAdmin.configureGeoserver - Problem getting or " + |
111 | 109 |
"setting property while initializing system properties page: " + gpe.getMessage()); |
112 |
} catch (IOException ioe) { |
|
113 |
throw new AdminException("GeoserverAdmin.configureGeoserver - IO problem while initializing " |
|
114 |
+ "system properties page:" + ioe.getMessage()); |
|
115 |
} catch (ServletException se) { |
|
116 |
throw new AdminException("GeoserverAdmin.configureGeoserver - problem forwarding request while " |
|
117 |
+ "initializing system properties page: " + se.getMessage()); |
|
118 |
} |
|
110 |
} catch (MetacatUtilException mue) { |
|
111 |
throw new AdminException("GeoserverAdmin.configureGeoserver - utility problem while initializing " |
|
112 |
+ "system properties page:" + mue.getMessage()); |
|
113 |
} |
|
119 | 114 |
} else if (bypass != null && bypass.equals("true")) { |
120 | 115 |
Vector<String> processingErrors = new Vector<String>(); |
121 | 116 |
Vector<String> processingSuccess = new Vector<String>(); |
... | ... | |
145 | 140 |
RequestUtil.forwardRequest(request, response, |
146 | 141 |
"/admin?configureType=configure&processForm=false", null); |
147 | 142 |
} |
148 |
} catch (ServletException se) { |
|
149 |
throw new AdminException("GeoserverAdmin.configureGeoserver - problem forwarding request while " |
|
150 |
+ "processing geoservices configuration page: " + se.getMessage()); |
|
151 |
} catch (IOException ioe) { |
|
152 |
throw new AdminException("GeoserverAdmin.configureGeoserver - IO problem while processing geoservices " |
|
153 |
+ "geoservices page: " + ioe.getMessage()); |
|
143 |
} catch (MetacatUtilException mue) { |
|
144 |
throw new AdminException("GeoserverAdmin.configureGeoserver - utility problem while processing geoservices " |
|
145 |
+ "geoservices page: " + mue.getMessage()); |
|
154 | 146 |
} |
155 | 147 |
|
156 | 148 |
} else { |
... | ... | |
220 | 212 |
RequestUtil.forwardRequest(request, response, |
221 | 213 |
"/admin?configureType=configure&processForm=false", null); |
222 | 214 |
} |
223 |
} catch (ServletException se) { |
|
224 |
throw new AdminException("GeoserverAdmin.configureGeoserver - problem forwarding request while " |
|
225 |
+ "processing geoservices configuration page: " + se.getMessage()); |
|
226 |
} catch (IOException ioe) { |
|
227 |
throw new AdminException("GeoserverAdmin.configureGeoserver - IO problem while processing geoservices " |
|
228 |
+ "geoservices page: " + ioe.getMessage()); |
|
215 |
} catch (MetacatUtilException mue) { |
|
216 |
throw new AdminException("GeoserverAdmin.configureGeoserver - utility problem while processing geoservices " |
|
217 |
+ "geoservices page: " + mue.getMessage()); |
|
229 | 218 |
} catch (GeneralPropertyException gpe) { |
230 | 219 |
throw new AdminException("GeoserverAdmin.configureGeoserver - problem with properties while " |
231 | 220 |
+ "processing geoservices configuration page: " + gpe.getMessage()); |
src/edu/ucsb/nceas/metacat/admin/MetacatAdminServlet.java | ||
---|---|---|
184 | 184 |
logMetacat.error(errorMessage); |
185 | 185 |
processingErrors.add(errorMessage); |
186 | 186 |
} |
187 |
|
|
188 |
if (processingErrors.size() > 0) { |
|
189 |
RequestUtil.clearRequestMessages(request); |
|
190 |
RequestUtil.setRequestErrors(request,processingErrors); |
|
191 |
// if the action that threw an exception was "configure" just go straight to the metacat |
|
192 |
// configuration. This will avoid a loop. Otherwise, call the admin servlet with |
|
193 |
// configuration action. |
|
194 |
if (action != null && action.equals("configure")) { |
|
195 |
RequestUtil.forwardRequest(request, response, "/admin/metacat-configuration.jsp", null); |
|
196 |
} else { |
|
197 |
RequestUtil.forwardRequest(request, response, "/admin?configureType=configure", null); |
|
198 |
} |
|
199 |
} |
|
187 | 200 |
} catch (GeneralPropertyException ge) { |
188 | 201 |
String errorMessage = |
189 | 202 |
"MetacatAdminServlet.handleGetOrPost - Property problem while handling request: " + ge.getMessage(); |
... | ... | |
200 | 213 |
logMetacat.error(errorMessage); |
201 | 214 |
processingErrors.add(errorMessage); |
202 | 215 |
} |
203 |
|
|
204 |
if (processingErrors.size() > 0) { |
|
205 |
RequestUtil.clearRequestMessages(request); |
|
206 |
RequestUtil.setRequestErrors(request,processingErrors); |
|
207 |
// if the action that threw an exception was "configure" just go straight to the metacat |
|
208 |
// configuration. This will avoid a loop. Otherwise, call the admin servlet with |
|
209 |
// configuration action. |
|
210 |
if (action != null && action.equals("configure")) { |
|
211 |
RequestUtil.forwardRequest(request, response, "/admin/metacat-configuration.jsp", null); |
|
212 |
} else { |
|
213 |
RequestUtil.forwardRequest(request, response, "/admin?configureType=configure", null); |
|
214 |
} |
|
215 |
} |
|
216 | 216 |
} |
217 | 217 |
} |
src/edu/ucsb/nceas/metacat/admin/BackupAdmin.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
package edu.ucsb.nceas.metacat.admin; |
28 | 28 |
|
29 |
import java.io.IOException; |
|
30 | 29 |
import java.util.Vector; |
31 | 30 |
|
32 |
import javax.servlet.ServletException; |
|
33 | 31 |
import javax.servlet.http.HttpServletRequest; |
34 | 32 |
import javax.servlet.http.HttpServletResponse; |
35 | 33 |
|
... | ... | |
114 | 112 |
// Forward the request to the JSP page |
115 | 113 |
RequestUtil.forwardRequest(request, response, |
116 | 114 |
"/admin/backup-configuration.jsp", null); |
117 |
} catch (IOException ioe) { |
|
118 |
throw new AdminException("BackupAdmin.configureBackup - IO problem while initializing " |
|
119 |
+ "backup configuration page:" + ioe.getMessage()); |
|
120 |
} catch (ServletException se) { |
|
121 |
throw new AdminException("BackupAdmin.configureBackup - Problem forwarding request while " |
|
122 |
+ "initializing backup configuration page: " + se.getMessage()); |
|
123 | 115 |
} catch (MetacatUtilException mue) { |
124 | 116 |
throw new AdminException("BackupAdmin.configureBackup - Problem discovering backup directory while " |
125 | 117 |
+ "initializing backup configuration page: " + mue.getMessage()); |
... | ... | |
183 | 175 |
RequestUtil.forwardRequest(request, response, |
184 | 176 |
"/admin?configureType=configure&processForm=false", null); |
185 | 177 |
} |
186 |
} catch (IOException ioe) { |
|
187 |
throw new AdminException("BackupAdmin.configureBackup - IO problem while processing login page: " |
|
188 |
+ ioe.getMessage()); |
|
189 |
} catch (ServletException se) { |
|
190 |
throw new AdminException("BackupAdmin.configureBackup - problem forwarding request while " |
|
191 |
+ "processing login page: " + se.getMessage()); |
|
192 |
} |
|
178 |
} catch (MetacatUtilException mue) { |
|
179 |
throw new AdminException("BackupAdmin.configureBackup - utility problem while processing login page: " |
|
180 |
+ mue.getMessage()); |
|
181 |
} |
|
193 | 182 |
} |
194 | 183 |
} |
195 | 184 |
|
src/edu/ucsb/nceas/metacat/admin/DBAdmin.java | ||
---|---|---|
45 | 45 |
import java.util.TreeSet; |
46 | 46 |
import java.util.Vector; |
47 | 47 |
|
48 |
import javax.servlet.ServletException; |
|
49 | 48 |
import javax.servlet.http.HttpServletRequest; |
50 | 49 |
import javax.servlet.http.HttpServletResponse; |
51 | 50 |
import javax.servlet.http.HttpSession; |
... | ... | |
55 | 54 |
import edu.ucsb.nceas.metacat.database.DBConnectionPool; |
56 | 55 |
import edu.ucsb.nceas.metacat.database.DBVersion; |
57 | 56 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
57 |
import edu.ucsb.nceas.metacat.shared.MetacatUtilException; |
|
58 | 58 |
import edu.ucsb.nceas.metacat.util.DatabaseUtil; |
59 | 59 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
60 | 60 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
... | ... | |
182 | 182 |
} catch (GeneralPropertyException gpe) { |
183 | 183 |
throw new AdminException("DBAdmin.configureDatabase - Problem getting or " + |
184 | 184 |
"setting property while initializing system properties page: " + gpe.getMessage()); |
185 |
} catch (IOException ioe) { |
|
186 |
throw new AdminException("DBAdmin.configureDatabase - IO problem while initializing " |
|
187 |
+ "system properties page:" + ioe.getMessage()); |
|
188 |
} catch (ServletException se) { |
|
189 |
throw new AdminException("DBAdmin.configureDatabase - problem forwarding request while " |
|
190 |
+ "initializing system properties page: " + se.getMessage()); |
|
191 |
} |
|
185 |
} catch (MetacatUtilException mue) { |
|
186 |
throw new AdminException("DBAdmin.configureDatabase - utility problem while initializing " |
|
187 |
+ "system properties page:" + mue.getMessage()); |
|
188 |
} |
|
192 | 189 |
} else { |
193 | 190 |
// The configuration form is being submitted and needs to be |
194 | 191 |
// processed, setting the properties in the configuration file |
... | ... | |
228 | 225 |
} catch (GeneralPropertyException gpe) { |
229 | 226 |
throw new AdminException("DBAdmin.configureDatabase - Problem getting or setting " + |
230 | 227 |
"property while upgrading database: " + gpe.getMessage()); |
231 |
} catch (IOException ioe) { |
|
232 |
throw new AdminException("DBAdmin.configureDatabase - IO problem while upgrading database: " |
|
233 |
+ ioe.getMessage()); |
|
234 |
} catch (ServletException se) { |
|
235 |
throw new AdminException("DBAdmin.configureDatabase - problem forwarding request while " |
|
236 |
+ "upgrading database: " + se.getMessage()); |
|
237 |
} |
|
228 |
} catch (MetacatUtilException mue) { |
|
229 |
throw new AdminException("DBAdmin.configureDatabase - utility problem while upgrading database: " |
|
230 |
+ mue.getMessage()); |
|
231 |
} |
|
238 | 232 |
} |
239 | 233 |
} |
240 | 234 |
|
Also available in: Unified diff
Change RequestUtil forwardRequest() method to throw MetacatUtilException.