001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/ogcwebservices/getcapabilities/HTTP.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042:
043: ---------------------------------------------------------------------------*/
044: package org.deegree.ogcwebservices.getcapabilities;
045:
046: import java.net.URL;
047: import java.util.ArrayList;
048: import java.util.List;
049:
050: /**
051: * The HTTP-Protocol, which extends the super-interface {@link Protocol}. It defines the
052: * {@link #getGetOnlineResources()} and the {@link #getPostOnlineResources()} methods.
053: *
054: * @author <a href="mailto:k.lupp@web.de">Katharina Lupp </a>
055: * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
056: * @version $Revision: 9345 $ $Date: 2007-12-27 08:22:25 -0800 (Thu, 27 Dec 2007) $
057: */
058: public class HTTP extends Protocol {
059:
060: private List<URL> getOnlineResource = new ArrayList<URL>();
061:
062: private List<URL> postOnlineResource = new ArrayList<URL>();
063:
064: /**
065: * default constructor
066: */
067: public HTTP() {
068: }
069:
070: /**
071: * constructor initializing the class with get and post URL
072: */
073: public HTTP(URL[] getOnlineResource, URL[] postOnlineResource) {
074: setGetOnlineResources(getOnlineResource);
075: setPostOnlineResources(postOnlineResource);
076: }
077:
078: /**
079: * Return the list of online resources for the HTTP GET request. An Online Resource URL intended
080: * for HTTP GET requests, is a URL prefix to which additional parameters must be appended in
081: * order to construct a valid Operation request. A URL prefix is defined as an opaque string
082: * including the protocol, hostname, optional port number, path, a question mark '?', and,
083: * optionally, one or more server-specific parameters ending in an ampersand '&'.
084: *
085: */
086: public URL[] getGetOnlineResources() {
087: return getOnlineResource.toArray(new URL[getOnlineResource
088: .size()]);
089: }
090:
091: /**
092: * adds a get-online resource to the HTTP protocol class
093: */
094: public void addGetOnlineResource(URL getOnlineResource) {
095: this .getOnlineResource.add(getOnlineResource);
096: }
097:
098: /**
099: *
100: */
101: public void setGetOnlineResources(URL[] getOnlineResource) {
102: this .getOnlineResource.clear();
103:
104: if (getOnlineResource != null) {
105: for (int i = 0; i < getOnlineResource.length; i++) {
106: addGetOnlineResource(getOnlineResource[i]);
107: }
108: }
109: }
110:
111: /**
112: * Return the list of online resources for the HTTP GET request. An Online Resource URL intended
113: * for HTTP POST requests is a complete and valid URL to which Clients transmit encoded requests
114: * in the body of the POST document.
115: */
116: public URL[] getPostOnlineResources() {
117: return postOnlineResource.toArray(new URL[postOnlineResource
118: .size()]);
119: }
120:
121: /**
122: * sets URL prefix for post HTTP request method.
123: */
124: public void setPostOnlineResources(URL[] postOnlineResource) {
125: this .postOnlineResource.clear();
126:
127: if (postOnlineResource != null) {
128: for (int i = 0; i < postOnlineResource.length; i++) {
129: addPostOnlineResource(postOnlineResource[i]);
130: }
131: }
132: }
133:
134: /**
135: * adds a post-online resource to the HTTP protocol class
136: */
137: public void addPostOnlineResource(URL postOnlineResource) {
138: this.postOnlineResource.add(postOnlineResource);
139: }
140: }
|