View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 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  
13  package com.eviware.soapui.impl.rest.panels.request;
14  
15  import java.awt.Component;
16  
17  import com.eviware.soapui.impl.EmptyPanelBuilder;
18  import com.eviware.soapui.impl.rest.RestRequest;
19  import com.eviware.soapui.support.components.JPropertiesTable;
20  import com.eviware.soapui.support.types.StringList;
21  
22  /***
23   * PanelBuilder for WsdlInterface
24   * 
25   * @author Ole.Matzura
26   */
27  
28  public class RestRequestPanelBuilder extends EmptyPanelBuilder<RestRequest>
29  {
30  	public RestRequestPanelBuilder()
31  	{
32  	}
33  
34  	public RestRequestDesktopPanel buildDesktopPanel( RestRequest request )
35  	{
36  		return new RestRequestDesktopPanel( request );
37  	}
38  
39  	public boolean hasDesktopPanel()
40  	{
41  		return true;
42  	}
43  
44  	public Component buildOverviewPanel( RestRequest request )
45  	{
46  		JPropertiesTable<RestRequest> table = new JPropertiesTable<RestRequest>( "Request Properties" );
47  		table.addProperty( "Name", "name" );
48  		table.addProperty( "Description", "description", true );
49  		// table.addProperty( "Method", "method", new Object[]{RequestMethod.GET,
50  		// RequestMethod.POST,
51  		// RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.HEAD} );
52  		table.addProperty( "Encoding", "encoding", new String[] { null, "UTF-8", "iso-8859-1" } );
53  		table.addProperty( "Endpoint", "endpoint", request.getOperation().getInterface().getEndpoints() );
54  		table.addProperty( "Timeout", "timeout", true );
55  		table.addProperty( "Bind Address", "bindAddress", true );
56  		table.addProperty( "Follow Redirects", "followRedirects", JPropertiesTable.BOOLEAN_OPTIONS );
57  
58  		// security / authentication
59  		table.addProperty( "Username", "username", true );
60  		table.addPropertyShadow( "Password", "password", true );
61  		table.addProperty( "Domain", "domain", true );
62  
63  		StringList keystores = new StringList( request.getOperation().getInterface().getProject().getWssContainer()
64  				.getCryptoNames() );
65  		keystores.add( "" );
66  		table.addProperty( "SSL Keystore", "sslKeystore", keystores.toStringArray() );
67  
68  		table.addProperty( "Strip whitespaces", "stripWhitespaces", JPropertiesTable.BOOLEAN_OPTIONS );
69  		table.addProperty( "Remove Empty Content", "removeEmptyContent", JPropertiesTable.BOOLEAN_OPTIONS );
70  		table.addProperty( "Entitize Properties", "entitizeProperties", JPropertiesTable.BOOLEAN_OPTIONS );
71  
72  		// post-processing
73  		table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
74  		table.addProperty( "Dump File", "dumpFile" ).setDescription( "Dumps response message to specified file" );
75  		table.addProperty( "Max Size", "maxSize", true ).setDescription( "The maximum number of bytes to receive" );
76  
77  		table.setPropertyObject( request );
78  
79  		return table;
80  	}
81  
82  	public boolean hasOverviewPanel()
83  	{
84  		return true;
85  	}
86  }