Skip to content

400 on an endpoint operation using a @Selector #11274

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

Closed
sebastienminne opened this issue Dec 6, 2017 · 5 comments
Closed

400 on an endpoint operation using a @Selector #11274

sebastienminne opened this issue Dec 6, 2017 · 5 comments
Labels
status: duplicate A duplicate of another issue

Comments

@sebastienminne
Copy link

I'm trying to get a custom endpoint working on M7 release, here is the code

@Component
@Endpoint(id = "mycache")
class WebCacheEndpoint {

	@ReadOperation
	public Map<String, Object> cache() {
		Info.Builder builder = new Info.Builder();
		builder.withDetail("blabla", "blabla");

		Info build = builder.build();
		return build.getDetails();
	}

	@ReadOperation
	public Map<String, Object> cache2(@Selector String test) {
		Info.Builder builder = new Info.Builder();
		builder.withDetail("blabla", test);

		Info build = builder.build();
		return build.getDetails();
	}
}

I can see routes in the logs :
INFO 69597 --- [ main] .b.a.e.w.r.WebFluxEndpointHandlerMapping : Mapped "{[/mycache]
INFO 69597 --- [ main] .b.a.e.w.r.WebFluxEndpointHandlerMapping : Mapped "{[/mycache/{arg0}]

I get a response form /mycache but having a 400 bad request on /mycache/{arg0}

Could that be an issue on that version ?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 6, 2017
@snicoll
Copy link
Member

snicoll commented Dec 6, 2017

Are you sure you're running with m7? Arg0 means the parameter name wasn't found and that should lead to an exception.

You need to compile with -parameters.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Dec 6, 2017
@sebastienminne
Copy link
Author

Yes I'm running M7, can't see any exception.

What do you mean to compile with -parameters ?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 6, 2017
@snicoll
Copy link
Member

snicoll commented Dec 6, 2017

Can you please share a sample that reproduces the problem?

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 6, 2017
@sebastienminne
Copy link
Author

Here it is : https://github.com/sebastienminne/actuator-selector-issue

route /mycache is fine
route /mycache/test is not

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 6, 2017
@snicoll
Copy link
Member

snicoll commented Dec 6, 2017

Duplicates #10618 #10001

The endpoint infrastructure is using parameter names to infer the selector name. Your project works if I run it with mvn spring-boot:run (because the flag is set automatically) and having it named {arg0} is an indication that the -parameters javac flag. I guess you're running this from your IDE and you should configure it to add -parameters as well.

@snicoll snicoll closed this as completed Dec 6, 2017
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Dec 6, 2017
@snicoll snicoll changed the title @Selector seems not working in M7 400 on an endpoint operation using a @Selector Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants