You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2010/08/31 07:05:08 UTC

svn commit: r991076 - in /tuscany/sca-java-2.x/trunk/modules/binding-http-runtime: META-INF/MANIFEST.MF src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java

Author: lresende
Date: Tue Aug 31 05:05:08 2010
New Revision: 991076

URL: http://svn.apache.org/viewvc?rev=991076&view=rev
Log:
Add missing imported packages to OSGi Manifest

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF?rev=991076&r1=991075&r2=991076&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/META-INF/MANIFEST.MF Tue Aug 31 05:05:08 2010
@@ -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/

Modified: tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java?rev=991076&r1=991075&r2=991076&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java Tue Aug 31 05:05:08 2010
@@ -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.HttpServletRes
 
 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 HTTPXMLWireFormatServiceInt
         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 HTTPXMLWireFormatServiceInt
             }
             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 HTTPXMLWireFormatServiceInt
 //                        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 HTTPXMLWireFormatServiceInt
             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;