Skip to content
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

Is path really a must have part for URL? #3304

Open
chickenlj opened this issue Jan 22, 2019 · 4 comments
Open

Is path really a must have part for URL? #3304

chickenlj opened this issue Jan 22, 2019 · 4 comments
Labels
type/discussion Everything related with code discussion or question

Comments

@chickenlj
Copy link
Contributor

chickenlj commented Jan 22, 2019

dubbo://30.5.120.36:20890/org.apache.dubbo.samples.basic.api.DemoService?anyhost=true&application=demo-provider&bind.ip=30.5.120.36&bind.port=20890&dubbo=2.0.2&generic=false&interface=org.apache.dubbo.samples.basic.api.DemoService&methods=sayHello&pid=68763&release=2.7.0-SNAPSHOT&side=provider&timestamp=1548142826615

Here, in this example, the path value is /org.apache.dubbo.samples.basic.api.DemoService, it's generaged by default and is the same as interface=org.apache.dubbo.samples.basic.api.DemoService.
I tried to figure out the role path plays in the framework, it seems to have some some meaning for Rest or Http protocols, but is never used for Dubbo protocol.

  • Dubbo Protocol

Not used at all except to distinguish two different items in Registry.
Take Zookeeper as an example, the following two items can exist at the same time under the same parent node /dubbo/org.apache.dubbo.samples.basic.api.DemoService/providers only because they have different path.

dubbo://30.5.120.36:20890/org.apache.dubbo.samples.basic.api.DemoService
dubbo://30.5.120.36:20890/org.apache.dubbo.samples.basic.api.DemoService2
  • Rest Protocol (maybe works the same way for all http based protocol)

Used to distinguish different rest paths

@Path("users")
@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
@Api(value = "UserService")
public interface UserService {

    @GET
    @Path("{id : \\d+}")
    @ApiOperation(value = "getUser")
    User getUser(@ApiParam(value = "id") @PathParam("id")Long id);

    Long registerUser(User user);
}
dubbo://30.5.120.36:20890/{your-path}/users/{id}
@chickenlj
Copy link
Contributor Author

At least, if it's not mandatory, is it possible for us to stop giving it a default value and just leave it empty?

Or maybe I still don't get it's real design purpose.

@chickenlj
Copy link
Contributor Author

@chickenlj
Copy link
Contributor Author

#3017

@chickenlj
Copy link
Contributor Author

#3328

@CrazyHZM CrazyHZM added the type/discussion Everything related with code discussion or question label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/discussion Everything related with code discussion or question
Projects
None yet
Development

No branches or pull requests

2 participants