Skip to content

Commit

Permalink
chore: add Redirect from old icon endpoint to the new one [DHIS2-16042]
Browse files Browse the repository at this point in the history
  • Loading branch information
zubaira authored Dec 5, 2023
1 parent 2f8d701 commit 485a832
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -56,6 +57,7 @@
import org.hisp.dhis.icon.IconService;
import org.hisp.dhis.schema.descriptors.IconSchemaDescriptor;
import org.hisp.dhis.webapi.mvc.annotation.ApiVersion;
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.utils.HeaderUtils;
import org.springframework.core.io.Resource;
import org.springframework.http.CacheControl;
Expand Down Expand Up @@ -100,9 +102,12 @@ public class IconController {
}

@GetMapping("/{iconKey}/icon.svg")
public void getIconData(HttpServletResponse response, @PathVariable String iconKey)
throws IOException, NotFoundException {
downloadDefaultIcon(iconKey, response);
@Deprecated
public void getIconData(
HttpServletResponse response, HttpServletRequest request, @PathVariable String iconKey)
throws IOException {
String location = response.encodeRedirectURL("/icons/" + iconKey + "/icon");
response.sendRedirect(ContextUtils.getRootPath(request) + location);
}

@GetMapping(value = "/{key}/icon")
Expand Down

0 comments on commit 485a832

Please sign in to comment.