TUSCANY-3517: Apply latest updates to callback sample in servlet-callback-0.0.2.zip

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@957499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
antelder 2010-06-24 10:36:45 +00:00
parent 2d74722e60
commit f865c76a19
5 changed files with 39 additions and 7 deletions
sca-java-2.x/contrib/samples/servlet-callback/src/main

View file

@ -22,7 +22,7 @@ import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
@Callback(CallbackServlet.class)
@Callback(ServletCallback.class)
public interface HelloworldService {
void sayHello(String name);

View file

@ -24,10 +24,14 @@ import org.oasisopen.sca.annotation.Service;
@Service(HelloworldService.class)
public class HelloworldServiceImpl implements HelloworldService {
private ServletCallback callback;
@Callback
private CallbackServlet callback;
public void sayHello(String name) {
public void setCallback(ServletCallback callback) {
this.callback = callback;
}
public void sayHello(String name) {
callback.sendGreeting("Hello " + name + "!");
}

View file

@ -31,8 +31,8 @@ import org.oasisopen.sca.ComponentContext;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
@Service(CallbackServlet.class)
public class HelloworldServlet extends HttpServlet implements CallbackServlet {
@Service(ServletCallback.class)
public class HelloworldServlet extends HttpServlet implements ServletCallback {
private static final long serialVersionUID = 1L;
private HttpServletResponse response;

View file

@ -0,0 +1,28 @@
/*
* 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 sample;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface ServletCallback {
void sendGreeting(String greeting);
}

View file

@ -25,7 +25,7 @@
<component name="foo">
<implementation.web web-uri=""/>
<reference name="service" target="HelloworldComponent">
<java.interface interface="HelloworldService" callbackInterface="CallbackServlet"/>
<interface.java interface="sample.HelloworldService" callbackInterface="sample.ServletCallback"/>
</reference>
</component>