KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > transport > jms > Handler


1 /*
2  * Copyright 2001, 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of 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,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.axis.transport.jms;
18
19 import java.net.URL JavaDoc;
20 import java.net.URLConnection JavaDoc;
21
22 /**
23  * URLStreamHandler for the "jms" protocol
24  *
25  * @author Ray Chun (rchun@sonicsoftware.com)
26  */

27 public class Handler
28     extends java.net.URLStreamHandler JavaDoc
29 {
30     static {
31         // register the JMSTransport class
32
org.apache.axis.client.Call.setTransportForProtocol(JMSConstants.PROTOCOL, org.apache.axis.transport.jms.JMSTransport.class);
33     }
34
35     /**
36      * Reassembles the URL string, in the form "jms:/<dest>?prop1=value1&prop2=value2&..."
37      */

38     protected String JavaDoc toExternalForm(URL JavaDoc url) {
39
40         String JavaDoc destination = url.getPath().substring(1);
41         String JavaDoc query = url.getQuery();
42
43         StringBuffer JavaDoc jmsurl = new StringBuffer JavaDoc(JMSConstants.PROTOCOL + ":/");
44         jmsurl.append(destination).append("?").append(query);
45
46         return jmsurl.toString();
47     }
48
49     protected URLConnection JavaDoc openConnection(URL JavaDoc url) {
50         return new JMSURLConnection(url);
51     }
52 }
Popular Tags