View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2009 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  package com.eviware.soapui.impl.rest;
13  
14  import java.beans.PropertyChangeListener;
15  
16  import org.apache.log4j.Logger;
17  
18  import com.eviware.soapui.config.RestRequestConfig;
19  import com.eviware.soapui.impl.support.http.HttpRequestInterface;
20  import com.eviware.soapui.impl.wsdl.submit.transports.http.HttpResponse;
21  import com.eviware.soapui.model.iface.SubmitContext;
22  
23  public interface RestRequestInterface extends HttpRequestInterface<RestRequestConfig>, PropertyChangeListener
24  {
25  
26  	public enum RequestMethod
27  	{
28  		GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE;
29  
30  		public static String[] getMethodsAsStringArray()
31  		{
32  			return new String[] { GET.toString(), POST.toString(), PUT.toString(), DELETE.toString(), HEAD.toString(),
33  					OPTIONS.toString(), TRACE.toString() };
34  		}
35  
36  		public static RequestMethod[] getMethods()
37  		{
38  			return new RequestMethod[] { GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE };
39  		}
40  	}
41  
42  	public final static Logger log = Logger.getLogger( RestRequest.class );
43  	public static final String DEFAULT_MEDIATYPE = "application/xml";
44  	public static final String REST_XML_REQUEST = "restXmlRequest";
45  
46  	public abstract RestMethod getRestMethod();
47  
48  	public abstract RestRepresentation[] getRepresentations();
49  
50  	public abstract RestRepresentation[] getRepresentations( RestRepresentation.Type type );
51  
52  	public abstract RestRepresentation[] getRepresentations( RestRepresentation.Type type, String mediaType );
53  
54  	public abstract String getAccept();
55  
56  	public abstract void setAccept( String acceptEncoding );
57  
58  	public abstract String[] getResponseMediaTypes();
59  
60  	public abstract RestResource getResource();
61  
62  	public abstract void setPath( String fullPath );
63  
64  	public abstract void setResponse( HttpResponse response, SubmitContext context );
65  
66  	public abstract void release();
67  
68  	public abstract boolean hasEndpoint();
69  
70  }