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        table.addProperty( "Follow Redirects", "followRedirects", JPropertiesTable.BOOLEAN_OPTIONS );
56  
57        // security / authentication
58        table.addProperty( "Username", "username", true );
59        table.addPropertyShadow( "Password", "password", true );
60        table.addProperty( "Domain", "domain", true );
61  
62        StringList keystores = new StringList( request.getOperation().getInterface().getProject().getWssContainer().getCryptoNames() );
63        keystores.add( "" );
64        table.addProperty( "SSL Keystore", "sslKeystore", keystores.toStringArray() );
65  
66        table.addProperty( "Strip whitespaces", "stripWhitespaces", JPropertiesTable.BOOLEAN_OPTIONS );
67        table.addProperty( "Remove Empty Content", "removeEmptyContent", JPropertiesTable.BOOLEAN_OPTIONS );
68        table.addProperty( "Entitize Properties", "entitizeProperties", JPropertiesTable.BOOLEAN_OPTIONS );
69  
70        // post-processing
71        table.addProperty( "Pretty Print", "prettyPrint", JPropertiesTable.BOOLEAN_OPTIONS );
72        table.addProperty( "Dump File", "dumpFile" ).setDescription( "Dumps response message to specified file" );
73  
74        table.setPropertyObject( request );
75  
76        return table;
77     }
78  
79     public boolean hasOverviewPanel()
80     {
81        return true;
82     }
83  }