/** * The filter attempts to generate application metadata (if configured so) and in case the call is made * to the expected URL the metadata value is displayed and no further filters are invoked. Otherwise * filter chain invocation continues. * * @param request request * @param response response * @throws javax.servlet.ServletException error * @throws java.io.IOException io error */ protected void processMetadataDisplay(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { SAMLMessageContext context = contextProvider.getLocalEntity(request, response); String entityId = context.getLocalEntityId(); response.setContentType("application/samlmetadata+xml"); // SAML_Meta, 4.1.1 - line 1235 response.setCharacterEncoding("UTF-8"); response.addHeader("Content-Disposition", "attachment; filename=\"spring_saml_metadata.xml\""); displayMetadata(entityId, response.getWriter()); } catch (MetadataProviderException e) { throw new ServletException("Error initializing metadata", e); } }