From 875e50908c2630d263661af492654cd44bef2d65 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Tue, 25 Jan 2011 23:30:28 +0000 Subject: Sandbox to experiment with dynamic mass virtual hosting and running a different composite per vhost. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1063520 13f79535-47bb-0310-9956-ffa450edef68 --- .../HTTPDefaultWireFormatProviderFactory.java | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sandbox/sebastien/java/vhost/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatProviderFactory.java (limited to 'sandbox/sebastien/java/vhost/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatProviderFactory.java') diff --git a/sandbox/sebastien/java/vhost/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatProviderFactory.java b/sandbox/sebastien/java/vhost/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatProviderFactory.java new file mode 100644 index 0000000000..45e74d8ec8 --- /dev/null +++ b/sandbox/sebastien/java/vhost/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatProviderFactory.java @@ -0,0 +1,68 @@ +/* + * 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.tuscany.sca.binding.http.format; + +import org.apache.tuscany.sca.binding.http.HTTPDefaultWireFormat; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.provider.WireFormatProvider; +import org.apache.tuscany.sca.provider.WireFormatProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + +public class HTTPDefaultWireFormatProviderFactory implements WireFormatProviderFactory { + + public HTTPDefaultWireFormatProviderFactory(ExtensionPointRegistry extensionPoints) { + } + + @Override + public Class getModelType() { + return null; + } + + @Override + public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) { + return null; + } + + @Override + public WireFormatProvider createServiceWireFormatProvider(final RuntimeEndpoint endpoint) { + return new WireFormatProvider() { + @Override + public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract) { + // TODO: Ideally this wants to set the databinding on a per request basis from the + // http content type and accept headers and so support things like json or xml etc, + // for now to get started just use json + interfaceContract.getInterface().resetDataBinding("JSON"); + return interfaceContract; + } + @Override + public Interceptor createInterceptor() { + return new HTTPDefaultWireFormatServiceInterceptor(endpoint); + } + @Override + public String getPhase() { + return Phase.SERVICE_BINDING_WIREFORMAT; + }}; + } + +} -- cgit v1.2.3