Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 2f34aad

Browse files
Clément Denistangiel
authored andcommitted
Allow to override EndpointsMethodHandler creation in EndpointsServlet
- This allows full customization of response serialization, etc.
1 parent b3ec380 commit 2f34aad

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

endpoints-framework/src/main/java/com/google/api/server/spi/EndpointsServlet.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ private PathDispatcher<EndpointsContext> createDispatcher() {
9999
MethodConfigMap methods = apiConfig.getApiClassConfig().getMethods();
100100
for (Entry<EndpointMethod, ApiMethodConfig> methodEntry : methods.entrySet()) {
101101
if (!methodEntry.getValue().isIgnored()) {
102-
handlersBuilder.add(
103-
new EndpointsMethodHandler(initParameters, getServletContext(), methodEntry.getKey(),
104-
apiConfig, methodEntry.getValue(), systemService));
102+
handlersBuilder.add(createEndpointsMethodHandler(apiConfig, methodEntry));
105103
}
106104
}
107105
}
@@ -134,6 +132,12 @@ private SystemService createSystemService(ClassLoader classLoader,
134132
}
135133
}
136134

135+
protected EndpointsMethodHandler createEndpointsMethodHandler(ApiConfig apiConfig,
136+
Entry<EndpointMethod, ApiMethodConfig> methodEntry) {
137+
return new EndpointsMethodHandler(initParameters, getServletContext(), methodEntry.getKey(),
138+
apiConfig, methodEntry.getValue(), systemService);
139+
}
140+
137141
/**
138142
* Creates a new instance of the specified service class.
139143
*

0 commit comments

Comments
 (0)