View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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 com.eviware.soapui.impl.EmptyPanelBuilder;
16  import com.eviware.soapui.impl.rest.RestRequest;
17  import com.eviware.soapui.impl.support.AbstractHttpRequest.RequestMethod;
18  import com.eviware.soapui.support.components.JPropertiesTable;
19  import com.eviware.soapui.support.types.StringList;
20  
21  import java.awt.*;
22  
23  /***
24   * PanelBuilder for WsdlInterface
25   * 
26   * @author Ole.Matzura
27   */
28  
29  public class RestRequestPanelBuilder extends EmptyPanelBuilder<RestRequest>
30  {
31     public RestRequestPanelBuilder()
32     {
33     }
34     
35     public RestRequestDesktopPanel buildDesktopPanel(RestRequest request)
36     {
37        return new RestRequestDesktopPanel(request);
38     }
39  
40     public boolean hasDesktopPanel()
41     {
42        return true;
43     }
44  
45     public Component buildOverviewPanel(RestRequest request)
46     {
47     	JPropertiesTable<RestRequest> table = new JPropertiesTable<RestRequest>( "Request Properties" );
48     	table.addProperty( "Name", "name" );
49     	table.addProperty( "Description", "description", true );
50     	table.addProperty( "Method", "method", new Object[] { RequestMethod.GET, 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( "Bind Address", "bindAddress", true );
55     	
56     	// security / authentication
57     	table.addProperty( "Username", "username", true );
58     	table.addPropertyShadow( "Password", "password", true );
59     	table.addProperty( "Domain", "domain", true );
60     	
61     	StringList keystores = new StringList( request.getOperation().getInterface().getProject().getWssContainer().getCryptoNames() );
62  		keystores.add( "" );
63  		table.addProperty( "SSL Keystore", "sslKeystore", keystores.toStringArray() );
64  
65  		table.addProperty( "Strip whitespaces", "stripWhitespaces", JPropertiesTable.BOOLEAN_OPTIONS );
66     	table.addProperty( "Remove Empty Content", "removeEmptyContent", JPropertiesTable.BOOLEAN_OPTIONS );
67  
68     	// post-processing
69     	table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
70     	table.addProperty( "Dump File", "dumpFile" ).setDescription("Dumps response message to specified file" );
71     	
72     	table.setPropertyObject( request );
73     	
74     	return table;
75     }
76  
77     public boolean hasOverviewPanel()
78     {
79        return true;
80     }
81  }