01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.transport.http;
20:
21: import org.apache.axis2.Constants;
22: import org.apache.axis2.context.ConfigurationContext;
23:
24: import javax.servlet.ServletConfig;
25: import javax.servlet.ServletContext;
26: import javax.servlet.ServletException;
27: import javax.servlet.http.HttpServletRequest;
28: import javax.servlet.http.HttpServletResponse;
29: import java.io.IOException;
30:
31: /**
32: *
33: */
34: public class AxisAdminServlet extends AxisServlet {
35:
36: protected transient AdminAgent agent;
37:
38: protected void doPost(HttpServletRequest req,
39: HttpServletResponse res) throws ServletException,
40: IOException {
41: doGet(req, res);
42: }
43:
44: protected void doGet(HttpServletRequest req,
45: HttpServletResponse resp) throws ServletException,
46: IOException {
47: try {
48: req.getSession().setAttribute(Constants.SERVICE_PATH,
49: configContext.getServicePath());
50: agent.handle(req, resp);
51: } catch (Exception e) {
52: throw new ServletException(e);
53: }
54: }
55:
56: public void init(ServletConfig config) throws ServletException {
57: super .init(config);
58: ServletContext servletContext = config.getServletContext();
59: this .configContext = (ConfigurationContext) servletContext
60: .getAttribute(CONFIGURATION_CONTEXT);
61: servletContext.setAttribute(this .getClass().getName(), this );
62: agent = new AdminAgent(configContext);
63: this .servletConfig = config;
64: }
65:
66: public void init() throws ServletException {
67: if (this.servletConfig != null) {
68: init(this.servletConfig);
69: }
70: }
71: }
|