-
Notifications
You must be signed in to change notification settings - Fork 827
add samples of java chassis #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
@Path("/sayhi") | ||
@POST | ||
@Override |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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")); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notes about the examples:
- 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
- should add client codes use RestTemplate to call jarxs/springmvc service, that's what we have given in other demos.
add pojo、jaxrs、springmvc、codefirst、customer-handler sample to java chassis