svg파일 조회 수정

main
이범준 1 year ago
parent ffd697507e
commit da92a4f207

@ -1,11 +1,13 @@
package cokr.xit.fims.base;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringWriter;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.regex.Matcher;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -78,14 +80,16 @@ public class FileController extends cokr.xit.base.file.web.FileController {
String requestURI = request.getRequestURI().toString();
String filepath = requestURI.split("modifySvg")[1];
filepath = URLDecoder.decode(filepath);
filepath = filepath.replace("\\","/");
String svgRootPath = ("classpath:svg");
filepath = svgRootPath + filepath;
filepath = URLDecoder.decode(filepath, "UTF-8");
filepath = filepath.replaceAll("/", Matcher.quoteReplacement(File.separator));
filepath = "svg" + filepath;
ClassPathResource resource = new ClassPathResource(filepath);
InputStream is = resource.getInputStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
Document document = documentBuilder.parse(filepath);
Document document = documentBuilder.parse(is);
Element root = document.getDocumentElement();
NodeList nodeList = root.getChildNodes();

Loading…
Cancel
Save