001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/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 17:22:25 +0100 (Do, 27 Dez 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.size()] );
088 }
089
090 /**
091 * adds a get-online resource to the HTTP protocol class
092 */
093 public void addGetOnlineResource( URL getOnlineResource ) {
094 this.getOnlineResource.add( getOnlineResource );
095 }
096
097 /**
098 *
099 */
100 public void setGetOnlineResources( URL[] getOnlineResource ) {
101 this.getOnlineResource.clear();
102
103 if ( getOnlineResource != null ) {
104 for ( int i = 0; i < getOnlineResource.length; i++ ) {
105 addGetOnlineResource( getOnlineResource[i] );
106 }
107 }
108 }
109
110 /**
111 * Return the list of online resources for the HTTP GET request. An Online Resource URL intended
112 * for HTTP POST requests is a complete and valid URL to which Clients transmit encoded requests
113 * in the body of the POST document.
114 */
115 public URL[] getPostOnlineResources() {
116 return postOnlineResource.toArray( new URL[postOnlineResource.size()] );
117 }
118
119 /**
120 * sets URL prefix for post HTTP request method.
121 */
122 public void setPostOnlineResources( URL[] postOnlineResource ) {
123 this.postOnlineResource.clear();
124
125 if ( postOnlineResource != null ) {
126 for ( int i = 0; i < postOnlineResource.length; i++ ) {
127 addPostOnlineResource( postOnlineResource[i] );
128 }
129 }
130 }
131
132 /**
133 * adds a post-online resource to the HTTP protocol class
134 */
135 public void addPostOnlineResource( URL postOnlineResource ) {
136 this.postOnlineResource.add( postOnlineResource );
137 }
138 }