Skip to content

Commit ca28feb

Browse files
committed
GH-4492 route all deprecated endpoints through new controllers
1 parent ad1f46e commit ca28feb

File tree

5 files changed

+784
-593
lines changed

5 files changed

+784
-593
lines changed

tools/server-spring/src/main/java/org/eclipse/rdf4j/http/server/repository/transaction/AbstractActionController.java

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import org.springframework.web.servlet.mvc.AbstractController;
4040

4141
/**
42-
* Handles requests for transaction creation on a repository.
42+
* Handles requests for transaction operations on a repository.
4343
*
4444
* @author Jeen Broekstra
4545
*/
@@ -86,6 +86,11 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
8686

8787
}
8888

89+
// Comes from disposableBean interface so to be able to stop the ActiveTransactionRegistry scheduler
90+
@Override
91+
public void destroy() throws Exception {
92+
ActiveTransactionRegistry.INSTANCE.destroyScheduler();
93+
}
8994
/**
9095
* Handle the specific action as part of the supplied {@link Transaction} object.
9196
*
@@ -96,30 +101,6 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
96101
protected abstract ModelAndView handleAction(HttpServletRequest request, HttpServletResponse response,
97102
Transaction transaction) throws Exception;
98103

99-
/* private methods */
100-
101-
private UUID getTransactionID(HttpServletRequest request) throws ClientHTTPException {
102-
String pathInfoStr = request.getPathInfo();
103-
104-
UUID txnID = null;
105-
106-
if (pathInfoStr != null && !pathInfoStr.equals("/")) {
107-
String[] pathInfo = pathInfoStr.substring(1).split("/");
108-
// should be of the form: /<Repository>/transactions/<txnID>
109-
if (pathInfo.length == 3) {
110-
try {
111-
txnID = UUID.fromString(pathInfo[2]);
112-
logger.debug("txnID is '{}'", txnID);
113-
} catch (IllegalArgumentException e) {
114-
throw new ClientHTTPException(SC_BAD_REQUEST, "not a valid transaction id: " + pathInfo[2]);
115-
}
116-
} else {
117-
logger.warn("could not determine transaction id from path info {} ", pathInfoStr);
118-
}
119-
}
120-
121-
return txnID;
122-
}
123104

124105
static RDFFormat getRDFFormat(HttpServletRequest request) {
125106
return Rio.getParserFormatForMIMEType(request.getContentType())
@@ -149,10 +130,30 @@ static ModelAndView emptyOkResponse() {
149130
return new ModelAndView(SimpleResponseView.getInstance(), model);
150131
}
151132

152-
// Comes from disposableBean interface so to be able to stop the ActiveTransactionRegistry scheduler
153-
@Override
154-
public void destroy() throws Exception {
155-
ActiveTransactionRegistry.INSTANCE.destroyScheduler();
133+
/* private methods */
134+
135+
private UUID getTransactionID(HttpServletRequest request) throws ClientHTTPException {
136+
String pathInfoStr = request.getPathInfo();
137+
138+
UUID txnID = null;
139+
140+
if (pathInfoStr != null && !pathInfoStr.equals("/")) {
141+
String[] pathInfo = pathInfoStr.substring(1).split("/");
142+
// should be of the form: /<Repository>/transactions/<txnID>
143+
if (pathInfo.length == 3) {
144+
try {
145+
txnID = UUID.fromString(pathInfo[2]);
146+
logger.debug("txnID is '{}'", txnID);
147+
} catch (IllegalArgumentException e) {
148+
throw new ClientHTTPException(SC_BAD_REQUEST, "not a valid transaction id: " + pathInfo[2]);
149+
}
150+
} else {
151+
logger.warn("could not determine transaction id from path info {} ", pathInfoStr);
152+
}
153+
}
154+
155+
return txnID;
156156
}
157157

158+
158159
}

0 commit comments

Comments
 (0)