Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dangling /management/plugins/ endpoint #709

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading