|
Axis 2 example source code file (HTTPTransportReceiver.java)
The Axis 2 HTTPTransportReceiver.java source code/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.axis2.transport.http; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; /** * Class HTTPTransportReceiver */ public class HTTPTransportReceiver { public static Map getGetRequestParameters(String requestURI) { Map map = new HashMap(); if (requestURI == null || "".equals(requestURI)) { return map; } char[] chars = requestURI.toCharArray(); final int NOT_BEGUN = 1500; final int INSIDE_NAME = 1501; final int INSIDE_VALUE = 1502; int state = NOT_BEGUN; StringBuffer name = new StringBuffer(); StringBuffer value = new StringBuffer(); for (int index = 0; index < chars.length; index++) { if (state == NOT_BEGUN) { if (chars[index] == '?') { state = INSIDE_NAME; } } else if (state == INSIDE_NAME) { if (chars[index] == '=') { state = INSIDE_VALUE; } else { name.append(chars[index]); } } else if (state == INSIDE_VALUE) { if (chars[index] == ',') { state = INSIDE_NAME; map.put(name.toString(), value.toString()); name.delete(0, name.length()); value.delete(0, value.length()); } else { value.append(chars[index]); } } } if (name.length() + value.length() > 0) { map.put(name.toString(), value.toString()); } return map; } /** * Returns the HTML text for the list of services deployed. * This can be delegated to another Class as well * where it will handle more options of GET messages. * * @return Returns String. */ public static String getServicesHTML(ConfigurationContext configurationContext) { String temp = ""; Map services = configurationContext.getAxisConfiguration().getServices(); Hashtable erroneousServices = configurationContext.getAxisConfiguration().getFaultyServices(); boolean status = false; if ((services != null) && !services.isEmpty()) { status = true; Collection serviceCollection = services.values(); temp += "<h2>" + "Deployed services" + ""; for (Iterator it = serviceCollection.iterator(); it.hasNext();) { AxisService axisService = (AxisService) it.next(); Iterator iterator = axisService.getOperations(); temp += "<h3>" + axisService.getName() + "</a>"; if (iterator.hasNext()) { temp += "Available operations <ul>"; for (; iterator.hasNext();) { AxisOperation axisOperation = (AxisOperation) iterator.next(); temp += "<li>" + axisOperation.getName().getLocalPart() + ""; } temp += "</ul>"; } else { temp += "No operations specified for this service"; } } } if ((erroneousServices != null) && !erroneousServices.isEmpty()) { temp += "<hr> Other Axis 2 examples (source code examples)Here is a short list of links related to this Axis 2 HTTPTransportReceiver.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.