-
Notifications
You must be signed in to change notification settings - Fork 827
JAV-495 Set default URL pattern #291
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
JAV-495 Set default URL pattern #291
Conversation
…d and URL pattern is not specified. Add a demo to demonstrate how a Spring Boot project is converted to a JavaChassis project.
private static void testNull(Test test) { | ||
TestMgr.check("code is 'null'", test.getTestString(null)); | ||
TestMgr.check(null, test.wrapParam(null)); | ||
// TestMgr.check(null, test.wrapParam(null)); |
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.
lost this test case.
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.
I commented out this line for debugging... I will retrieve it.
import io.servicecomb.demo.helloworld.greeter.Hello; | ||
import io.servicecomb.provider.pojo.RpcSchema; | ||
|
||
@RpcSchema(schemaId = "helloworld.Greeter") |
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.
why old one no need this annotations?
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.
In old edition, the schema of HelloImpl is configured in a xml file. But the schema of TestImpl is configured by annotation. After discussion with Liu Bao, we think that two kind of configuration existing in one demo is confusing, so I transform it into annotation config.
import io.servicecomb.swagger.invocation.exception.InvocationException; | ||
|
||
@RpcSchema(schemaId = "server") | ||
@RequestMapping(path = "/pojo/rest", produces = MediaType.APPLICATION_JSON) |
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.
why RpcSchema need this annotations?
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.
I keep this annotation in code for the purpose that users can transform this demo back into a Spring Boot demo more conveniently.(And they can compare this two kind of framework)
But actually this annotation is redundant, I will remove it and create another PR.
LOGGER.info("If you see this log, that means this demo project has been converted to ServiceComb framework."); | ||
|
||
invocation.next(response -> { | ||
if (invocation.getOperationName().equals("splitParam")) { |
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.
schema+operation is a unique key
OperationMeta have some qualifiedName method, you can call one of them.
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.
invocation.next(response -> {
if (invocation.getOperationMeta().getSchemaQualifiedName().equals("server.splitParam")) {
the judgement logic has been changed like above. Is this what you mean?
chain: | ||
Provider: | ||
default: myhandler | ||
servicecomb: |
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.
if you want to test auto urlPattern, should this be deleted?
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.
servicecomb:
rest:
servlet:
urlPattern: /*
I guess you mean the configuration above should be deleted, right?
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.
please fix the problems.
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import javax.ws.rs.core.MediaType; |
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.
compile warning?
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-netflix-core</artifactId> | ||
</dependency> | ||
<dependency> |
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.
client depend on server
then service's microservice.yaml in classpath too, which one will override another one, it's random, except you point the order.
even you point the order, it's bad practice.
all server schema deployed to client too. do you want this?
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.
I have fixed this problem by removing the dependency in client side, and organized import of RestServletInitializer.java. Please review this commit.
…-spring-boot-pojo-server to avoid the microservice.yaml file overriding
@wujimin I close this pull request and reopen it, and the travis-ci build passed. I can't find out the failure cause. |
see details in https://servicecomb.atlassian.net/browse/JAV-495