01: /*
02: * Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.wso2.esb.transport.util;
18:
19: import org.apache.axis2.context.ConfigurationContext;
20: import org.apache.axis2.description.AxisService;
21: import org.wso2.utils.NetworkUtils;
22:
23: import javax.servlet.http.HttpServletRequest;
24: import javax.servlet.http.HttpServletResponse;
25: import java.io.ByteArrayOutputStream;
26: import java.io.IOException;
27:
28: /**
29: *
30: */
31: public class Wsdl11Processor extends AbstractWsdlProcessor {
32:
33: public void process(final HttpServletRequest request,
34: final HttpServletResponse response,
35: final ConfigurationContext configurationContext)
36: throws Exception {
37:
38: WSDLPrinter wsdlPrinter = new WSDLPrinter() {
39: public void printWSDL(AxisService axisService)
40: throws IOException {
41: ByteArrayOutputStream baos = new ByteArrayOutputStream();
42:
43: String importedWSDL = getImportedWSDL(request, "wsdl");
44: if ("".equals(importedWSDL)) {
45: axisService.printWSDL(baos, NetworkUtils
46: .getLocalHostname());
47: } else {
48: axisService.printUserWSDL(baos, importedWSDL);
49: }
50: RequestProcessorUtil.writeDocument(baos, response
51: .getOutputStream(), "annotated-wsdl.xsl",
52: request.getContextPath(),
53: checkForAnnotation(request));
54: }
55: };
56: printWSDL(configurationContext, request, response, wsdlPrinter);
57: }
58: }
|