001: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002: * This code is licensed under the GPL 2.0 license, availible at the root
003: * application directory.
004: */
005:
006: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
007: * This code is licensed under the GPL 2.0 license, availible at the root
008: * application directory.
009: */
010: package org.vfny.geoserver.config;
011:
012: import javax.servlet.ServletContext;
013: import javax.servlet.http.HttpServletRequest;
014: import javax.servlet.http.HttpSession;
015:
016: /**
017: * Utility methods for locatating Config classes in the Servlet context.
018: *
019: * <p>
020: * Called by ActionForms to lookup things in the WebContainer for the JSP page.
021: * Similar to the Requests utility classes.
022: * </p>
023: *
024: * <p>
025: * These methods need to be kept in lockstep with the ConfigAction convience
026: * methods.
027: * </p>
028: *
029: * @author jgarnett, Refractions Research, Inc.
030: * @author $Author: jive $ (last modification)
031: * @version $Id: ConfigRequests.java 6326 2007-03-15 18:36:40Z jdeolive $
032: */
033: public class ConfigRequests {
034: /**
035: * Access Web Map Server Configuration Model from the WebContainer.
036: *
037: * <p>
038: * Note that this represents the Configuration and not the state of the Web
039: * Feature Server.
040: * </p>
041: *
042: * @param request DOCUMENT ME!
043: *
044: * @return Configuration information for the Web Map Server
045: */
046:
047: //JD: kill this
048: // public static WMSConfig getWMSConfig(HttpServletRequest request) {
049: // HttpSession session = request.getSession();
050: // ServletContext context = session.getServletContext();
051: //
052: // return (WMSConfig) context.getAttribute(WMSConfig.CONFIG_KEY);
053: // }
054: /**
055: * Access Web Feature Server Configuration Model from the WebContainer.
056: *
057: * <p>
058: * Note that this represents the Configuration and not the state of the Web
059: * Feature Server.
060: * </p>
061: *
062: * @param request DOCUMENT ME!
063: *
064: * @return Configuration information for Web Feature Server
065: */
066:
067: // JD: kill this
068: // public static WFSConfig getWFSConfig(HttpServletRequest request) {
069: // HttpSession session = request.getSession();
070: // ServletContext context = session.getServletContext();
071: //
072: // return (WFSConfig) context.getAttribute(WFSConfig.CONFIG_KEY);
073: // }
074: /**
075: * Access Web Map Server Configuration Model from the WebContainer.
076: *
077: * @param request DOCUMENT ME!
078: *
079: * @return Configuration model for Global information.
080: */
081: public static GlobalConfig getGlobalConfig(
082: HttpServletRequest request) {
083: HttpSession session = request.getSession();
084: ServletContext context = session.getServletContext();
085:
086: return (GlobalConfig) context
087: .getAttribute(GlobalConfig.CONFIG_KEY);
088: }
089:
090: /**
091: * Access Catalog Configuration Model from the WebContainer.
092: *
093: * @param request DOCUMENT ME!
094: *
095: * @return Configuration model for Catalog information.
096: */
097: public static DataConfig getDataConfig(HttpServletRequest request) {
098: HttpSession session = request.getSession();
099: ServletContext context = session.getServletContext();
100:
101: return (DataConfig) context.getAttribute(DataConfig.CONFIG_KEY);
102: }
103: }
|