Skip to content

Conversation

zhenghaibo1008
Copy link
Contributor

add pojo、jaxrs、springmvc、codefirst、customer-handler sample to java chassis

@coveralls
Copy link

Coverage Status

Coverage increased (+0.008%) to 81.671% when pulling 19f73c6 on zhenghaibo1008:samples into e5bba88 on ServiceComb:master.


@Path("/sayhi")
@POST
@Override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an valid example I think. This example is the same as pojo example bellow. Any tags in this class can be deleted. For springmvc example, we need register it with @RestSchema and call it with rest template


import javax.ws.rs.core.MediaType;

@RpcSchema(schemaId = "codeFirstSpringmvcHello")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as jaxrs example review. this is not a valid example


public static void main(String[] args) throws Exception {
init(args);
System.out.println(hello.sayHi("Java Chassis"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't call @RestScheam service with RPC call, must call these method with RestTeplate( REST style api). This can work only because you define only POST methods in your application.

public class JaxrsHelloImpl implements Hello {

@Path("/sayhi")
@POST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only POST methods, try some get/put or other to find why client code is wrong

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.huawei.com/schema/paas/cse/rpc classpath:META-INF/spring/spring-paas-cse-rpc.xsd">

<cse:rpc-reference id="hello" microservice-name="hello"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

microservice-name should be jaxrs

@Component
public class SpringmvcClient {

@RpcReference(microserviceName = "springmvc", schemaId = "springmvcHello")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same problem as jaxrs examples

@@ -0,0 +1,24 @@
# samples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notes about the examples:

  1. we can call jaxrs/springmvc server implementation with RPC style client code, this is not our intention, but this seams a quite great feature. We can discuss if include this feature in the example. Before that, we must test any other HTTP methods like GET/POST
  2. should add client codes use RestTemplate to call jarxs/springmvc service, that's what we have given in other demos.

@WillemJiang WillemJiang merged commit c1d4e2c into apache:master Jun 26, 2017
@zhenghaibo1008 zhenghaibo1008 deleted the samples branch June 26, 2017 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants