KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > sandesha > RMTransport


1 /*
2 * Copyright 1999-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 *
16 */

17
18 package org.apache.sandesha;
19
20 import org.apache.axis.AxisEngine;
21 import org.apache.axis.AxisFault;
22 import org.apache.axis.MessageContext;
23 import org.apache.axis.client.Call;
24 import org.apache.axis.client.Transport;
25 import org.apache.axis.transport.http.HTTPConstants;
26
27 /**
28  * A File Transport class.
29  *
30  * @author Rob Jellinghaus (robj@unrealities.com)
31  * @author Doug Davis (dug@us.ibm.com)
32  * @author Glen Daniels (gdaniels@allaire.com)
33  */

34 public class RMTransport extends Transport {
35
36     private String JavaDoc action;
37
38     private String JavaDoc cookie;
39
40     private String JavaDoc cookie2;
41
42     public RMTransport() {
43         transportName = "RMTransport";
44     }
45
46     public RMTransport(String JavaDoc url, String JavaDoc action) {
47         transportName = "RMTransport";
48         this.url = url;
49         this.action = action;
50
51     }
52
53     public void setupMessageContextImpl(MessageContext mc, Call call, AxisEngine engine)
54             throws AxisFault {
55         if (action != null) {
56             mc.setUseSOAPAction(true);
57             mc.setSOAPActionURI(action);
58         }
59
60         // Set up any cookies we know about
61
if (cookie != null)
62             mc.setProperty(HTTPConstants.HEADER_COOKIE, cookie);
63         if (cookie2 != null)
64             mc.setProperty(HTTPConstants.HEADER_COOKIE2, cookie2);
65
66         // Allow the SOAPAction to determine the service, if the service
67
// (a) has not already been determined, and (b) if a service matching
68
// the soap action has been deployed.
69
if (mc.getService() == null) {
70             mc.setTargetService((String JavaDoc) mc.getSOAPActionURI());
71         }
72     }
73
74     public void processReturnedMessageContext(MessageContext context) {
75         cookie = context.getStrProp(HTTPConstants.HEADER_COOKIE);
76         cookie2 = context.getStrProp(HTTPConstants.HEADER_COOKIE2);
77     }
78
79 }
Popular Tags