http:
method: GET
- url: http://localhost:8080/translate?q=voiture
+ url: http://localhost:8080/words/:word/translation
params:
- - name: q
+ - name: word
value: voiture
- type: query
+ type: path
auth: inherit
settings:
--- /dev/null
+package net.frustratedfunctor.definitions;
+
+public record WordDefinition() {
+}
+
--- /dev/null
+package net.frustratedfunctor.definitions;
+
+public interface WordDefinitionRepository {
+}
--- /dev/null
+package net.frustratedfunctor.definitions;
+
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+
+@Path("/words")
+public class WordDefinitionResource {
+
+ @Path("/{word}/definition")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public WordDefinition definition(@PathParam("word") String word) {
+ return null;
+ }
+
+}
--- /dev/null
+package net.frustratedfunctor.definitions;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class WordDefinitionService {
+}
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
-import org.jboss.resteasy.reactive.RestQuery;
-@Path("/translate")
+@Path("/words")
public class WordTranslationResource {
private final WordTranslationService words;
this.words = words;
}
+ @Path("/{word}/translation")
@GET
@Produces(MediaType.APPLICATION_JSON)
- public WordTranslation translate(@RestQuery("q") String word) {
+ public WordTranslation translation(@PathParam("word") String word) {
return words.translate(word);
}