| 1977 | // ---------------------------------------------------------------------- |
| 1978 | |
| 1979 | void RenderingController::HandleGET_mxnSelectedSlice(const httplib::Request& req, httplib::Response& res) const |
| 1980 | { |
| 1981 | const auto id = ReadRequiredPathParam(req, "id"); |
| 1982 | |
| 1983 | if (!IsValidMxNWindowId(id)) |
| 1984 | { |
| 1985 | const auto error = ErrorResponse::InvalidRequest( |
| 1986 | "Malformed MxN window id '" + id + "'. Expected pattern: <prefix>__<bare> with URL-segment-safe characters.", |
| 1987 | req.path); |
| 1988 | this->SendErrorResponse(res, 400, error); |
| 1989 | return; |
| 1990 | } |
| 1991 | |
| 1992 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasMxNSelectedSliceGetter()) |
| 1993 | { |
| 1994 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 1995 | this->SendErrorResponse(res, 503, error); |
| 1996 | return; |
| 1997 | } |
| 1998 | |
| 1999 | SliceState state; |
| 2000 | try |
| 2001 | { |
| 2002 | state = m_RenderWindowBridge->GetMxNSelectedSlice(id); |
| 2003 | } |
| 2004 | catch (const std::exception& e) |
| 2005 | { |
| 2006 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 2007 | this->SendErrorResponse(res, status, payload); |
| 2008 | return; |
| 2009 | } |
| 2010 | |
| 2011 | res.status = 200; |
| 2012 | res.set_content(SliceStateToJson(state).dump(), "application/json"); |
| 2013 | } |
| 2014 | |
| 2015 | void RenderingController::HandlePUT_mxnSelectedSlice(const httplib::Request& req, httplib::Response& res) const |
| 2016 | { |