01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.vfny.geoserver.action.wcs;
06:
07: import org.apache.struts.action.ActionForm;
08: import org.apache.struts.action.ActionForward;
09: import org.apache.struts.action.ActionMapping;
10: import org.vfny.geoserver.action.ConfigAction;
11: import org.vfny.geoserver.config.WCSConfig;
12: import org.vfny.geoserver.form.wcs.WCSContentForm;
13: import org.vfny.geoserver.global.UserContainer;
14: import java.io.IOException;
15: import java.net.URL;
16: import javax.servlet.ServletException;
17: import javax.servlet.http.HttpServletRequest;
18: import javax.servlet.http.HttpServletResponse;
19:
20: /**
21: * DOCUMENT ME!
22: *
23: * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification)
24: * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification)
25: */
26: public final class WCSContentAction extends ConfigAction {
27: public ActionForward execute(ActionMapping mapping,
28: ActionForm form, UserContainer user,
29: HttpServletRequest request, HttpServletResponse response)
30: throws IOException, ServletException {
31: WCSContentForm contentForm = (WCSContentForm) form;
32:
33: boolean enabled = contentForm.isEnabled();
34:
35: if (contentForm.isEnabledChecked() == false) {
36: enabled = false;
37: }
38:
39: String onlineResource = contentForm.getOnlineResource();
40:
41: WCSConfig config = getWCSConfig();
42: config.setEnabled(enabled);
43: config.setOnlineResource(new URL(onlineResource));
44:
45: getApplicationState().notifyConfigChanged();
46:
47: return mapping.findForward("config");
48: }
49: }
|