http://localhost:8080/MicroStrategy/servlet/mstrWeb에서 

 

http://localhost:8080/servlet/mstrWeb으로 ContextPath 변경후 Export 문제 발생

 

 

 

1. Export시 Session 끊어짐

 

WEB-INF/xml/sys_defaults.properties 파일에

useSessionCookie=1 

추가

 

 

 

 

 

2. PDF Export시에 d3차트 로딩 실패

기본설정 > 프로젝트 기본값 > 보안 > 내배내기 용 URL 허용 > 현재도메인 URL 패턴 추가

http://localhost:8080/*

 

 

 

 

3. PDF Export시 /images/를 제외한 다른 폴더의 image파일 not found 에러

 

http://localhost:8080/servlet/plugins/myplugin/images/mytest.png 식으로 잘못 호출하고 있음.

 

 

- web.xml에 서블릿 매핑 추가

    <servlet-mapping>
        <servlet-name>mstrDocumentImages</servlet-name>
        <url-pattern>/servlet/plugins/myplugin/*</url-pattern>
    </servlet-mapping>

 

- DocumentImageServlet 에 관련 코드 추가

    private String getRedirectPath(HttpServletRequest request, String path) {
        String imagesRootPath = "/images/";
        String savedImagesRootPath = "/savedimages/";
        String redirectScheme = request.getScheme();
        String port = ":" + request.getServerPort();

        if (StringUtils.isNotEmpty(_scheme)) {
            redirectScheme = _scheme;
            port = "";
        }

        String contextPath = redirectScheme + "://" + request.getServerName() + port + request.getContextPath();
        int position = path.toLowerCase(Locale.ENGLISH).indexOf(imagesRootPath);
        if (position <= 0) {
            position = path.toLowerCase(Locale.ENGLISH).indexOf(savedImagesRootPath);
        }
        if (position <= 0) {
            return "";
        }
        
        /////////PDF Export 문제로 추가함/////////////
        int myPosition = path.indexOf("/plugins/myplugin/");
        if( myPosition > -1) {
            position = myPosition;
        }
        /////////PDF Export 문제로 추가함/////////////
        
        String tempStr = path.substring(position);
        tempStr = contextPath + tempStr;
        Pattern p = Pattern.compile("\r|\n");
        Matcher m = p.matcher(tempStr);
        tempStr = m.replaceAll("");
        return tempStr;
    }

 

 

:
Posted by 정규식