1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl;
14
15 import java.beans.PropertyChangeEvent;
16 import java.beans.PropertyChangeListener;
17 import java.io.File;
18 import java.io.IOException;
19 import java.util.ArrayList;
20 import java.util.Arrays;
21 import java.util.HashSet;
22 import java.util.List;
23 import java.util.Set;
24
25 import javax.swing.ImageIcon;
26 import javax.wsdl.BindingOperation;
27 import javax.wsdl.Message;
28 import javax.xml.namespace.QName;
29
30 import org.apache.log4j.Logger;
31 import org.apache.xmlbeans.SchemaGlobalElement;
32 import org.apache.xmlbeans.SchemaType;
33
34 import com.eviware.soapui.config.AttachmentConfig;
35 import com.eviware.soapui.config.CallConfig;
36 import com.eviware.soapui.config.CredentialsConfig;
37 import com.eviware.soapui.impl.actions.ShowDesktopPanelAction;
38 import com.eviware.soapui.impl.wsdl.actions.operation.AddToMockServiceAction;
39 import com.eviware.soapui.impl.wsdl.actions.request.AddRequestToTestCaseAction;
40 import com.eviware.soapui.impl.wsdl.actions.request.CloneRequestAction;
41 import com.eviware.soapui.impl.wsdl.actions.request.DeleteRequestAction;
42 import com.eviware.soapui.impl.wsdl.actions.request.RenameRequestAction;
43 import com.eviware.soapui.impl.wsdl.actions.support.ShowOnlineHelpAction;
44 import com.eviware.soapui.impl.wsdl.submit.RequestTransportRegistry;
45 import com.eviware.soapui.impl.wsdl.submit.filters.PropertyExpansionRequestFilter;
46 import com.eviware.soapui.impl.wsdl.submit.transports.http.AttachmentUtils;
47 import com.eviware.soapui.impl.wsdl.submit.transports.http.WsdlResponse;
48 import com.eviware.soapui.impl.wsdl.support.FileAttachment;
49 import com.eviware.soapui.impl.wsdl.support.HelpUrls;
50 import com.eviware.soapui.impl.wsdl.support.ModelItemIconAnimator;
51 import com.eviware.soapui.impl.wsdl.support.RequestFileAttachment;
52 import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext;
53 import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlUtils;
54 import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlUtils.SoapHeader;
55 import com.eviware.soapui.model.iface.Attachment;
56 import com.eviware.soapui.model.iface.Interface;
57 import com.eviware.soapui.model.iface.MessagePart;
58 import com.eviware.soapui.model.iface.Request;
59 import com.eviware.soapui.model.iface.Submit;
60 import com.eviware.soapui.model.iface.SubmitContext;
61 import com.eviware.soapui.model.iface.SubmitListener;
62 import com.eviware.soapui.model.support.InterfaceListenerAdapter;
63 import com.eviware.soapui.settings.WsdlSettings;
64 import com.eviware.soapui.support.UISupport;
65 import com.eviware.soapui.support.action.ActionSupport;
66 import com.eviware.soapui.support.types.StringToStringMap;
67
68 /***
69 * Request implementation holding a SOAP request
70 *
71 * @author Ole.Matzura
72 */
73
74 public class WsdlRequest extends AbstractWsdlModelItem<CallConfig> implements Request, AttachmentContainer
75 {
76 public static final String RESPONSE_PROPERTY = WsdlRequest.class.getName() + "@response";
77 public static final String RESPONSE_CONTENT_PROPERTY = WsdlRequest.class.getName() + "@response-content";
78 public static final String ATTACHMENTS_PROPERTY = WsdlRequest.class.getName() + "@attachments";
79 public static final String INLINE_RESPONSE_ATTACHMENTS = WsdlRequest.class.getName() + "@inline-response-attachments";
80 public static final String EXPAND_MTOM_RESPONSE_ATTACHMENTS = WsdlRequest.class.getName() + "@expand-mtom-attachments";
81 public static final String STRIP_WHITESPACES = WsdlRequest.class.getName() + "@strip-whitespaces";
82 public static final String REQUEST_HEADERS_PROPERTY = WsdlRequest.class.getName() + "@request-headers";
83 public static final String DISABLE_MULTIPART_ATTACHMENTS = WsdlRequest.class.getName() + "@disable-multipart-attachments";
84
85 public final static String PW_TYPE_NONE="None";
86 public final static String PW_TYPE_DIGEST="PasswordDigest";
87 public final static String PW_TYPE_TEXT="PasswordText";
88
89 private final WsdlOperation operation;
90 private WsdlResponse response;
91 private final static Logger log = Logger.getLogger( WsdlRequest.class );
92
93
94 protected List<FileAttachment> attachments = new ArrayList<FileAttachment>();
95
96 private RequestIconAnimator iconAnimator;
97 private Set<SubmitListener> listeners = new HashSet<SubmitListener>();
98 private List<WsdlAttachmentPart> definedAttachmentParts;
99
100 private InternalInterfaceListener interfaceListener = new InternalInterfaceListener();
101
102 public WsdlRequest( WsdlOperation operation, CallConfig callConfig )
103 {
104 super( callConfig, operation, null );
105
106 this.operation = operation;
107
108 initActions();
109 initEndpoints();
110 initAttachments();
111
112 iconAnimator = initIconAnimator();
113
114
115 if( callConfig.getEncoding() == null || callConfig.getEncoding().length() == 0 )
116 {
117 callConfig.setEncoding( "UTF-8" );
118 }
119
120 addSubmitListener( iconAnimator );
121
122 operation.getInterface().addPropertyChangeListener( interfaceListener );
123 operation.getInterface().addInterfaceListener( interfaceListener );
124 }
125
126 private void initAttachments()
127 {
128 for( AttachmentConfig ac : getConfig().getAttachmentList() )
129 {
130 FileAttachment attachment = new RequestFileAttachment( ac, this );
131 attachments.add( attachment);
132 }
133 }
134
135 public void updateConfig(CallConfig request)
136 {
137 setConfig( request );
138 }
139
140 public ModelItemIconAnimator getIconAnimator()
141 {
142 return iconAnimator;
143 }
144
145 protected RequestIconAnimator initIconAnimator()
146 {
147 return new RequestIconAnimator();
148 }
149
150 protected void initEndpoints()
151 {
152 if( getEndpoint() == null )
153 {
154 String[] endpoints = operation.getInterface().getEndpoints();
155 if( endpoints.length > 0 )
156 {
157 setEndpoint( endpoints[0] );
158 }
159 }
160 }
161
162 protected void initActions()
163 {
164 addAction( new ShowDesktopPanelAction( "Open Request Editor", "Opens the Request Editor for this request", this ));
165 addAction( ActionSupport.SEPARATOR_ACTION );
166 addAction( new AddRequestToTestCaseAction( this ));
167
168 addAction( new AddToMockServiceAction( this ));
169 addAction( new CloneRequestAction( this ));
170 addAction( ActionSupport.SEPARATOR_ACTION );
171 addAction( new RenameRequestAction( this ));
172 addAction( new DeleteRequestAction( this ));
173 addAction( ActionSupport.SEPARATOR_ACTION );
174 addAction( new ShowOnlineHelpAction( HelpUrls.REQUEST_HELP_URL ));
175 }
176
177 public String getRequestContent()
178 {
179 return getConfig().getRequest();
180 }
181
182 public void setEndpoint(String endpoint)
183 {
184 String old = getEndpoint();
185 if( old != null && old.equals( endpoint ))
186 return;
187
188 getConfig().setEndpoint( endpoint );
189 notifyPropertyChanged( ENDPOINT_PROPERTY, old, endpoint);
190 }
191
192 public String getEndpoint()
193 {
194 return getConfig().getEndpoint();
195 }
196
197 public String getEncoding()
198 {
199 return getConfig().getEncoding();
200 }
201
202 public void setEncoding(String encoding)
203 {
204 String old = getEncoding();
205 getConfig().setEncoding( encoding );
206 notifyPropertyChanged( ENCODING_PROPERTY, old, encoding );
207 }
208
209 public StringToStringMap getRequestHeaders()
210 {
211 return StringToStringMap.fromXml( getSettings().getString( REQUEST_HEADERS_PROPERTY, null ));
212 }
213
214 public void setRequestHeaders( StringToStringMap map )
215 {
216 StringToStringMap old = getRequestHeaders();
217 getSettings().setString( REQUEST_HEADERS_PROPERTY, map.toXml() );
218 notifyPropertyChanged( REQUEST_HEADERS_PROPERTY, old, map );
219 }
220
221 public boolean isInlineResponseAttachments()
222 {
223 return getSettings().getBoolean( INLINE_RESPONSE_ATTACHMENTS );
224 }
225
226 public void setInlineResponseAttachments( boolean inlineResponseAttachments )
227 {
228 boolean old = getSettings().getBoolean( INLINE_RESPONSE_ATTACHMENTS );
229 getSettings().setBoolean( INLINE_RESPONSE_ATTACHMENTS, inlineResponseAttachments );
230 notifyPropertyChanged( INLINE_RESPONSE_ATTACHMENTS, old, inlineResponseAttachments );
231 }
232
233 public boolean isStripWhitespaces()
234 {
235 return getSettings().getBoolean( STRIP_WHITESPACES );
236 }
237
238 public void setStripWhitespaces( boolean stripWhitespaces )
239 {
240 boolean old = getSettings().getBoolean( STRIP_WHITESPACES );
241 getSettings().setBoolean( STRIP_WHITESPACES, stripWhitespaces );
242 notifyPropertyChanged( STRIP_WHITESPACES, old, stripWhitespaces );
243 }
244
245 public boolean isExpandMtomResponseAttachments()
246 {
247 return getSettings().getBoolean( EXPAND_MTOM_RESPONSE_ATTACHMENTS );
248 }
249
250 public void setExpandMtomResponseAttachments( boolean expandMtomResponseAttachments )
251 {
252 boolean old = getSettings().getBoolean( EXPAND_MTOM_RESPONSE_ATTACHMENTS );
253 getSettings().setBoolean( EXPAND_MTOM_RESPONSE_ATTACHMENTS, expandMtomResponseAttachments );
254 notifyPropertyChanged( EXPAND_MTOM_RESPONSE_ATTACHMENTS, old, expandMtomResponseAttachments );
255 }
256
257 /***
258 * Use getResponse().getContentAsString();
259 * @deprecated
260 */
261
262 public String getResponseContent()
263 {
264 return response == null ? null : response.getContentAsString();
265 }
266
267 public WsdlResponse getResponse()
268 {
269 return response;
270 }
271
272 public WsdlOperation getOperation()
273 {
274 return operation;
275 }
276
277 public void setRequestContent(String request)
278 {
279 String old = getRequestContent();
280 if( request.equals( old ))
281 return;
282 getConfig().setRequest( request );
283 definedAttachmentParts = null;
284 notifyPropertyChanged( REQUEST_PROPERTY, old, request );
285 }
286
287 public void setResponse( WsdlResponse response, SubmitContext context )
288 {
289 WsdlResponse oldResponse = (WsdlResponse) getResponse();
290 this.response = response;
291
292 notifyPropertyChanged( RESPONSE_PROPERTY, oldResponse, response );
293 }
294
295 public ImageIcon getIcon()
296 {
297 return iconAnimator.getIcon();
298 }
299
300 public String getUsername()
301 {
302 CredentialsConfig credentialsConfig = getConfig().getCredentials();
303 if( credentialsConfig == null ) return null;
304
305 return credentialsConfig.getUsername();
306 }
307
308 public String getPassword()
309 {
310 CredentialsConfig credentialsConfig = getConfig().getCredentials();
311 if( credentialsConfig == null ) return null;
312
313 return credentialsConfig.getPassword();
314 }
315
316 public String getDomain()
317 {
318 CredentialsConfig credentialsConfig = getConfig().getCredentials();
319 if( credentialsConfig == null ) return null;
320
321 return credentialsConfig.getDomain();
322 }
323
324 public void setUsername( String username )
325 {
326 CredentialsConfig credentialsConfig = getConfig().getCredentials();
327 if( credentialsConfig == null )
328 credentialsConfig = getConfig().addNewCredentials();
329
330 credentialsConfig.setUsername( username );
331 }
332
333 public void setPassword( String password )
334 {
335 CredentialsConfig credentialsConfig = getConfig().getCredentials();
336 if( credentialsConfig == null )
337 credentialsConfig = getConfig().addNewCredentials();
338
339 credentialsConfig.setPassword( password );
340 }
341
342 public void setDomain( String domain )
343 {
344 CredentialsConfig credentialsConfig = getConfig().getCredentials();
345 if( credentialsConfig == null )
346 credentialsConfig = getConfig().addNewCredentials();
347
348 credentialsConfig.setDomain( domain );
349 }
350
351 public void addSubmitListener(SubmitListener listener)
352 {
353 listeners.add( listener );
354 }
355
356 public void removeSubmitListener(SubmitListener listener)
357 {
358 listeners.remove( listener );
359 }
360
361 public Submit submit( SubmitContext submitContext, boolean async ) throws SubmitException
362 {
363 String endpoint = PropertyExpansionRequestFilter.expandProperties( submitContext, getEndpoint());
364 if( endpoint == null || endpoint.trim().length() == 0 )
365 {
366 UISupport.showErrorMessage( "Missing endpoint for request [" + getName() + "]" );
367 return null;
368 }
369
370 try
371 {
372 WsdlSubmit submitter = new WsdlSubmit(this, (SubmitListener[]) listeners.toArray(new SubmitListener[listeners
373 .size()]), RequestTransportRegistry.getTransport(endpoint, submitContext));
374 submitter.submitRequest(submitContext, async);
375 return submitter;
376 }
377 catch( Exception e )
378 {
379 throw new SubmitException( e.toString() );
380 }
381 }
382
383 private class InternalInterfaceListener extends InterfaceListenerAdapter implements PropertyChangeListener
384 {
385 public void propertyChange(PropertyChangeEvent evt)
386 {
387 if( evt.getPropertyName().equals( Interface.ENDPOINT_PROPERTY ))
388 {
389 String endpoint = getEndpoint();
390 if( evt.getOldValue() != null && evt.getOldValue().equals( endpoint ))
391 {
392 setEndpoint( (String) evt.getNewValue() );
393 }
394 }
395 }
396 }
397
398 public String getWssPasswordType()
399 {
400 return getConfig().getWssPasswordType();
401 }
402
403 public void setWssPasswordType(String wssPasswordType)
404 {
405 getConfig().setWssPasswordType( wssPasswordType );
406 }
407
408
409
410
411 public Attachment attachFile( File file, boolean cache )
412 {
413 try
414 {
415 FileAttachment fileAttachment = new RequestFileAttachment( file, cache, this );
416 attachments.add( fileAttachment );
417 notifyPropertyChanged(ATTACHMENTS_PROPERTY, null, fileAttachment );
418 return fileAttachment;
419 }
420 catch (IOException e)
421 {
422 UISupport.showErrorMessage( e );
423 return null;
424 }
425 }
426
427
428
429
430 public int getAttachmentCount()
431 {
432 return attachments.size();
433 }
434
435
436
437
438 public Attachment getAttachmentAt( int index )
439 {
440 return attachments.get( index );
441 }
442
443
444
445
446 public Attachment [] getAttachmentsForPart( String partName )
447 {
448 List<Attachment> result = new ArrayList<Attachment>();
449
450 for( Attachment attachment : attachments )
451 {
452 if( attachment.getPart().equals( partName ))
453 result.add( attachment );
454 }
455
456 return result.toArray( new Attachment[result.size()]);
457 }
458
459
460
461
462 public void removeAttachment( Attachment attachment )
463 {
464 int ix = attachments.indexOf( attachment );
465 attachments.remove( ix );
466
467 try
468 {
469 notifyPropertyChanged(ATTACHMENTS_PROPERTY, attachment, null );
470 }
471 finally
472 {
473 getConfig().removeAttachment( ix);
474 }
475 }
476
477
478
479
480 public Attachment[] getAttachments()
481 {
482 return attachments.toArray( new Attachment[attachments.size()] );
483 }
484
485
486
487
488 public WsdlAttachmentPart [] getDefinedAttachmentParts()
489 {
490 if( definedAttachmentParts == null )
491 {
492 try
493 {
494 UISupport.setHourglassCursor();
495 definedAttachmentParts = AttachmentUtils.extractAttachmentParts(
496 (WsdlOperation)getOperation(), getRequestContent(), true );
497 }
498 catch (Exception e)
499 {
500 log.warn( e.toString() );
501 }
502 finally
503 {
504 UISupport.resetCursor();
505 }
506 }
507
508 return definedAttachmentParts.toArray( new WsdlAttachmentPart[definedAttachmentParts.size()] );
509 }
510
511
512
513
514 public WsdlAttachmentPart getAttachmentPart( String partName )
515 {
516 WsdlAttachmentPart[] parts = getDefinedAttachmentParts();
517 for( WsdlAttachmentPart part : parts )
518 {
519 if( part.getName().equals( partName ))
520 return part;
521 }
522
523 return null;
524 }
525
526 public void copyAttachmentsTo(WsdlRequest newRequest)
527 {
528 if( getAttachmentCount() > 0 )
529 {
530 try
531 {
532 UISupport.setHourglassCursor();
533 for (int c = 0; c < getAttachmentCount(); c++)
534 {
535 try
536 {
537 Attachment attachment = getAttachmentAt(c);
538 newRequest.addAttachment( attachment );
539 }
540 catch (Exception e)
541 {
542 e.printStackTrace();
543 }
544 }
545 }
546 finally
547 {
548 UISupport.resetCursor();
549 }
550 }
551 }
552
553 private Attachment addAttachment(Attachment attachment)
554 {
555 if( attachment instanceof FileAttachment )
556 {
557 AttachmentConfig oldConfig = ((FileAttachment)attachment).getConfig();
558 AttachmentConfig newConfig = (AttachmentConfig) getConfig().addNewAttachment().set( oldConfig );
559 FileAttachment newAttachment = new RequestFileAttachment( newConfig, this );
560 attachments.add( newAttachment);
561 return newAttachment;
562 }
563 else log.error( "Unkown attachment type: " + attachment );
564
565 return null;
566 }
567
568 public void copyTo(WsdlRequest newRequest)
569 {
570 newRequest.setEncoding( getEncoding() );
571 newRequest.setEndpoint( getEndpoint() );
572 newRequest.setRequestContent( getRequestContent() );
573 newRequest.setWssPasswordType( getWssPasswordType() );
574
575 CredentialsConfig credentials = getConfig().getCredentials();
576 if( credentials != null)
577 newRequest.getConfig().setCredentials( (CredentialsConfig) credentials.copy() );
578
579 copyAttachmentsTo( newRequest );
580
581 newRequest.setRequestHeaders( getRequestHeaders() );
582 }
583
584
585
586
587 public boolean isMtomEnabled()
588 {
589 return getSettings().getBoolean( WsdlSettings.ENABLE_MTOM );
590 }
591
592 public void setMtomEnabled( boolean mtomEnabled )
593 {
594 getSettings().setBoolean( WsdlSettings.ENABLE_MTOM, mtomEnabled );
595 definedAttachmentParts = null;
596 }
597
598 public void release()
599 {
600 super.release();
601
602 getOperation().getInterface().removeInterfaceListener( interfaceListener );
603 getOperation().getInterface().removePropertyChangeListener( interfaceListener );
604 }
605
606 public MessagePart[] getRequestParts()
607 {
608 try
609 {
610
611 List<MessagePart> result = new ArrayList<MessagePart>();
612 WsdlOperation op = (WsdlOperation) getOperation();
613 WsdlContext wsdlContext = op.getInterface().getWsdlContext();
614 BindingOperation bindingOperation = op.findBindingOperation(wsdlContext.getDefinition());
615
616 if( bindingOperation == null )
617 return new MessagePart[0];
618
619
620 List<SoapHeader> headers = WsdlUtils.getSoapHeaders( bindingOperation.getBindingInput()
621 .getExtensibilityElements());
622
623 for (int i = 0; i < headers.size(); i++)
624 {
625 SoapHeader header = headers.get( i );
626
627 Message message = wsdlContext.getDefinition().getMessage( header.getMessage() );
628 if( message == null )
629 {
630 log.error( "Missing message for header: " + header.getMessage() );
631 continue;
632 }
633
634 javax.wsdl.Part part = message.getPart( header.getPart() );
635
636 if( part != null )
637 {
638 SchemaType schemaType = getSchemaTypeForPart( wsdlContext, part );
639 if( schemaType != null )
640 result.add( new WsdlHeaderPart( part.getName(), schemaType, part.getElementName(), this ));
641 }
642 else
643 log.error( "Missing part for header; " + header.getPart() );
644 }
645
646
647 javax.wsdl.Part[] parts = WsdlUtils.getInputParts( bindingOperation );
648
649 for( int i = 0; i < parts.length; i++ )
650 {
651 javax.wsdl.Part part = parts[i];
652
653 if( !WsdlUtils.isAttachmentInputPart( part, bindingOperation ))
654 {
655 SchemaType schemaType = getSchemaTypeForPart( wsdlContext, part );
656 if( schemaType != null )
657 result.add( new WsdlContentPart( part.getName(), schemaType, part.getElementName(), this ));
658 }
659 }
660
661 result.addAll( Arrays.asList( getDefinedAttachmentParts()) );
662
663 return result.toArray( new MessagePart[result.size()] );
664 }
665 catch (Exception e)
666 {
667 e.printStackTrace();
668 return new MessagePart [0];
669 }
670 }
671
672 public SchemaType getSchemaTypeForPart( WsdlContext wsdlContext, javax.wsdl.Part part) throws Exception
673 {
674 SchemaType schemaType = null;
675 QName elementName = part.getElementName();
676
677 if( elementName != null )
678 {
679 SchemaGlobalElement elm = wsdlContext.getSchemaTypeLoader().findElement(elementName);
680 if( elm != null )
681 {
682 schemaType = elm.getType();
683 }
684 else log.error( "Could not find element [" + elementName + "] specified in part [" + part.getName() + "]" );
685 }
686 else
687 {
688 QName typeName = part.getTypeName();
689
690 if( typeName != null )
691 {
692 schemaType = wsdlContext.getSchemaTypeLoader().findType( typeName );
693
694 if( schemaType == null )
695 {
696 log.error( "Could not find type [" + typeName + "] specified in part [" + part.getName() + "]" );
697 }
698 }
699 }
700 return schemaType;
701 }
702
703 public MessagePart[] getResponseParts()
704 {
705 try
706 {
707
708 List<MessagePart> result = new ArrayList<MessagePart>();
709 WsdlOperation op = (WsdlOperation) getOperation();
710 WsdlContext wsdlContext = op.getInterface().getWsdlContext();
711 BindingOperation bindingOperation = op.findBindingOperation(wsdlContext.getDefinition());
712
713 if( bindingOperation == null )
714 return new MessagePart[0];
715
716
717 List<SoapHeader> headers = WsdlUtils.getSoapHeaders( bindingOperation.getBindingOutput()
718 .getExtensibilityElements());
719
720 for (int i = 0; i < headers.size(); i++)
721 {
722 SoapHeader header = headers.get( i );
723
724 Message message = wsdlContext.getDefinition().getMessage( header.getMessage() );
725 if( message == null )
726 {
727 log.error( "Missing message for header: " + header.getMessage() );
728 continue;
729 }
730
731 javax.wsdl.Part part = message.getPart( header.getPart() );
732
733 if( part != null )
734 {
735 SchemaType schemaType = getSchemaTypeForPart( wsdlContext, part );
736 if( schemaType != null )
737 result.add( new WsdlHeaderPart( part.getName(), schemaType, part.getElementName(), this ));
738 }
739 else
740 log.error( "Missing part for header; " + header.getPart() );
741 }
742
743
744 javax.wsdl.Part[] parts = WsdlUtils.getOutputParts( bindingOperation );
745
746 for( int i = 0; i < parts.length; i++ )
747 {
748 javax.wsdl.Part part = parts[i];
749
750 if( !WsdlUtils.isAttachmentOutputPart( part, bindingOperation ))
751 {
752 SchemaType schemaType = getSchemaTypeForPart( wsdlContext, part );
753 if( schemaType != null )
754 result.add( new WsdlContentPart( part.getName(), schemaType, part.getElementName(), this ));
755 }
756 }
757
758 result.addAll( Arrays.asList( getDefinedAttachmentParts()) );
759
760 return result.toArray( new MessagePart[result.size()] );
761 }
762 catch (Exception e)
763 {
764 e.printStackTrace();
765 return new MessagePart [0];
766 }
767 }
768
769 protected class RequestIconAnimator extends ModelItemIconAnimator implements SubmitListener
770 {
771 public RequestIconAnimator()
772 {
773 super( WsdlRequest.this, "/request.gif",
774 new String[] {"/exec_request_1.gif", "/exec_request_2.gif",
775 "/exec_request_3.gif", "/exec_request_4.gif"} );
776 }
777
778 public boolean beforeSubmit(Submit submit, SubmitContext context)
779 {
780 if( isEnabled() && submit.getRequest() == getTarget() )
781 start();
782 return true;
783 }
784
785 public void afterSubmit(Submit submit, SubmitContext context)
786 {
787 if( submit.getRequest() == getTarget() )
788 stop();
789 }
790 }
791
792 public boolean isMultipartEnabled()
793 {
794 return !getSettings().getBoolean( DISABLE_MULTIPART_ATTACHMENTS );
795 }
796
797 public void setMultipartEnabled( boolean multipartEnabled )
798 {
799 getSettings().setBoolean( DISABLE_MULTIPART_ATTACHMENTS, multipartEnabled );
800 }
801 }