summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-08-31 05:05:08 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-08-31 05:05:08 +0000
commit3a981b723afb73b1d4c24b7b30b1bd24ba664e47 (patch)
treeb60629eaba18f05d6e4125f6aca1106d6575e011 /sca-java-2.x/trunk
parentde5caed0917091a043707a9a6e38874d59edea64 (diff)
Add missing imported packages to OSGi Manifest
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@991076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF2
-rw-r--r--sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java51
2 files changed, 27 insertions, 26 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF
index 175d11f601..0cadabbf76 100644
--- a/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF
+++ b/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF
@@ -16,9 +16,11 @@ Import-Package: javax.servlet,
org.apache.tuscany.sca.core;version="2.0.0",
org.apache.tuscany.sca.host.http;version="2.0.0",
org.apache.tuscany.sca.interfacedef;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.util,
org.apache.tuscany.sca.invocation;version="2.0.0",
org.apache.tuscany.sca.provider;version="2.0.0",
org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.oasisopen.sca,
org.oasisopen.sca.annotation;version="2.0.0"
Bundle-SymbolicName: org.apache.tuscany.sca.binding.http.runtime
Bundle-DocURL: http://www.apache.org/
diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java
index 48768096c5..c326b0f355 100644
--- a/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.binding.http.format;
@@ -36,7 +36,6 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.tuscany.sca.binding.http.provider.HTTPContext;
import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.invocation.Interceptor;
@@ -49,24 +48,24 @@ import org.w3c.dom.Node;
/**
* Handles the xml wire format for the http binding
- *
- * 1- determine the request and response format (xml, json, etc) from the
+ *
+ * 1- determine the request and response format (xml, json, etc) from the
* binding config or content type header and accept headers
* - TODO: need a way to configure the databinding framework based on that format
* 2- get the request contents from the HttpServletRequest
* - for a post its just the request body
* - for a get need to convert the query string into a body based on the format (xml, json, etc)
* 3- send the request on down the wire
- * 4- set the response contents in the HttpServletResponse
+ * 4- set the response contents in the HttpServletResponse
* (the databinding should already have put it in the correct format)
- *
+ *
*/
public class HTTPXMLWireFormatServiceInterceptor implements Interceptor {
private Invoker next;
private String jsonpCallbackName = "callback";
private DOMHelper domHelper;
-
+
public HTTPXMLWireFormatServiceInterceptor(RuntimeEndpoint endpoint, DOMHelper domHelper) {
this.domHelper = domHelper;
}
@@ -105,9 +104,9 @@ public class HTTPXMLWireFormatServiceInterceptor implements Interceptor {
HTTPContext context = msg.getBindingContext();
HttpServletRequest servletRequest = context.getRequest();
HttpServletResponse servletResponse = context.getResponse();
-
+
Object o = msg.getBody();
- if (msg.isFault()) {
+ if (msg.isFault()) {
String xml = domHelper.saveAsString((Node)((FaultException)o).getFaultInfo());
servletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, xml);
} else {
@@ -121,29 +120,29 @@ public class HTTPXMLWireFormatServiceInterceptor implements Interceptor {
}
servletResponse.getOutputStream().println(xml);
}
-
+
return msg;
}
/**
- * Turn the query request into XML.
+ * Turn the query request into XML.
*
* From ML thread: http://apache.markmail.org/message/ix3vvyomronellmi
- * 1- if the binding configuration contains a mapping from query parameter name to operation parameter then use that.
+ * 1- if the binding configuration contains a mapping from query parameter name to operation parameter then use that.
* 2- if the service interface or impl uses jaxrs annotations to name the parameters then use that mapping
* 3- if the query parameters are name arg0, arg1 etc than use those names for the mapping,
- * 4- otherwise use the order in the query string.
+ * 4- otherwise use the order in the query string.
*/
protected Object[] getRequestFromQueryString(Operation operation, ServletRequest servletRequest) {
-
+
// List<DataType> types = operation.getInputType().getLogical();
// int typesIndex = 0;
-//
+//
// List<String> jsonRequestArray = new ArrayList<String>();
-//
+//
// for (String name : getOrderedParameterNames(servletRequest)) {
// String jsonRequest = "";
-// // quote string parameters so clients work in the usual javascript way
+// // quote string parameters so clients work in the usual javascript way
// if (typesIndex < types.size() && String.class.equals(types.get(typesIndex).getGenericType())) {
// String x = servletRequest.getParameter(name);
// if (x.startsWith("\"") || x.startsWith("'")) {
@@ -155,19 +154,19 @@ public class HTTPXMLWireFormatServiceInterceptor implements Interceptor {
// jsonRequest += "\"" + x + "\"";
// }
// }
-// } else {
+// } else {
// jsonRequest += servletRequest.getParameter(name);
-// }
+// }
// jsonRequestArray.add(jsonRequest);
// }
//
// return jsonRequestArray.toArray();
return new Object[operation.getInputType().getLogical().size()];
- }
-
+ }
+
/**
* Get the request parameter names in the correct order.
- * Either the query parameters are named arg0, arg1, arg2 etc or else use the order
+ * Either the query parameters are named arg0, arg1, arg2 etc or else use the order
* from the order in the query string. Eg, the url:
* http://localhost:8085/HelloWorldService/sayHello2?first=petra&last=arnold&callback=foo"
* should invoke:
@@ -197,14 +196,14 @@ public class HTTPXMLWireFormatServiceInterceptor implements Interceptor {
for (String name : parameterNames) {
// ignore system and jsonpCallbackName parameters
if (!name.startsWith("_") && !name.equals(jsonpCallbackName)) {
- sortedNames.add(name);
+ sortedNames.add(name);
}
}
orderedNames.addAll(sortedNames);
}
return orderedNames;
}
-
+
protected static String read(HttpServletRequest servletRequest) throws IOException {
InputStream is = servletRequest.getInputStream();
BufferedReader reader = null;