Skip to content

Commit

Permalink
Remove dangling /management/plugins/ endpoint
Browse files Browse the repository at this point in the history
- convert int constants for service type to an enum
- remove servlet handler for "/management/plugins/"
- document servlet operation methods
  • Loading branch information
Enet4 committed Dec 16, 2024
1 parent 15c65f5 commit 703784b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,8 @@ public DicoogleWeb(int port) throws Exception {
createServletHandler(new ForceIndexing(), "/management/tasks/index"),
createServletHandler(new UnindexServlet(), "/management/tasks/unindex"),
createServletHandler(new RemoveServlet(), "/management/tasks/remove"),
createServletHandler(new ServicesServlet(ServicesServlet.STORAGE), "/management/dicom/storage"),
createServletHandler(new ServicesServlet(ServicesServlet.QUERY), "/management/dicom/query"),
createServletHandler(new ServicesServlet(ServicesServlet.PLUGIN), "/management/plugins/"),
createServletHandler(new ServicesServlet(ServicesServlet.ServiceType.STORAGE), "/management/dicom/storage"),
createServletHandler(new ServicesServlet(ServicesServlet.ServiceType.QUERY), "/management/dicom/query"),
createServletHandler(new AETitleServlet(), "/management/settings/dicom"),
createServletHandler(new PluginsServlet(), "/plugins/*"),
createServletHandler(new PresetsServlet(), "/presets/*"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@
/** Servlet for reading and writing DICOM service configurations.
* Modifying the "running" setting will trigger a start or a stop on the actual service.
*
* At the moment, applying settings to PLUGIN-type services is not implemented, resulting in a no-op.
*
* @author Frederico Silva <fredericosilva@ua.pt>
*/
public class ServicesServlet extends HttpServlet {

public final static int STORAGE = 0;
public final static int PLUGIN = 1;
public final static int QUERY = 2;
/** The type of DICOM service */
public enum ServiceType {
/** DICOM storage */
STORAGE,
/** DICOM query/retrieve */
QUERY
}

private final int mType;
private final ServiceType mType;

public ServicesServlet(int type) {
if (type < 0 || type > 2) {
throw new IllegalArgumentException("Bad service type, must be 0, 1 or 2");
}
public ServicesServlet(ServiceType type) {
mType = type;
}

/** Get the current status of a DICOM service */
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

Expand All @@ -77,7 +77,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
autostart = base.isAutostart();
break;
default:
break;
throw new IllegalStateException("Unexpected service type " + mType);
}

JSONObject obj = new JSONObject();
Expand All @@ -89,6 +89,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
resp.getWriter().print(obj.toString());
}

/** Start/stop a DICOM service or set whether the DICOM service should auto-start */
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

Expand Down

0 comments on commit 703784b

Please sign in to comment.