39
39
import org .springframework .web .servlet .mvc .AbstractController ;
40
40
41
41
/**
42
- * Handles requests for transaction creation on a repository.
42
+ * Handles requests for transaction operations on a repository.
43
43
*
44
44
* @author Jeen Broekstra
45
45
*/
@@ -86,6 +86,11 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
86
86
87
87
}
88
88
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
+ }
89
94
/**
90
95
* Handle the specific action as part of the supplied {@link Transaction} object.
91
96
*
@@ -96,30 +101,6 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
96
101
protected abstract ModelAndView handleAction (HttpServletRequest request , HttpServletResponse response ,
97
102
Transaction transaction ) throws Exception ;
98
103
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
- }
123
104
124
105
static RDFFormat getRDFFormat (HttpServletRequest request ) {
125
106
return Rio .getParserFormatForMIMEType (request .getContentType ())
@@ -149,10 +130,30 @@ static ModelAndView emptyOkResponse() {
149
130
return new ModelAndView (SimpleResponseView .getInstance (), model );
150
131
}
151
132
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 ;
156
156
}
157
157
158
+
158
159
}
0 commit comments