diff options
Diffstat (limited to 'edit-webapp/WEB-INF/jsp/metadata.jsp')
-rw-r--r-- | edit-webapp/WEB-INF/jsp/metadata.jsp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/edit-webapp/WEB-INF/jsp/metadata.jsp b/edit-webapp/WEB-INF/jsp/metadata.jsp new file mode 100644 index 0000000..09d721b --- /dev/null +++ b/edit-webapp/WEB-INF/jsp/metadata.jsp @@ -0,0 +1,23 @@ +<%@ page import="org.springframework.web.context.WebApplicationContext" %> +<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %> +<% +final WebApplicationContext springContext = + WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext()); +final String path = springContext.getEnvironment().getProperty("idp.home") + "/metadata/idp-metadata.xml"; +try (final java.io.FileInputStream in = new java.io.FileInputStream(path)) { + int i; + while ((i = in.read()) != -1) { + out.write(i); + } +} catch (final java.io.IOException e) { + out.println(e.getMessage()); + return; +} + +final String acceptHeader = request.getHeader("Accept"); +if (acceptHeader != null && !acceptHeader.contains("application/samlmetadata+xml")) { + response.setContentType("application/xml"); +} else { + response.setContentType("application/samlmetadata+xml"); +} +%>
\ No newline at end of file |