fix: html viewresolver 오류 fix
parent
1bd613db4b
commit
714c6c5366
@ -0,0 +1,37 @@
|
|||||||
|
package kr.xit.core.spring.resolver;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import org.springframework.web.servlet.View;
|
||||||
|
import org.springframework.web.servlet.view.AbstractUrlBasedView;
|
||||||
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
||||||
|
import org.springframework.web.servlet.view.JstlView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* description : 리소스 요청에 "html/"가 존재하면 HtmlViewResolver가 처리하도록 한다. 존재하지 않으면 null을 반환
|
||||||
|
* packageName : kr.xit.core.spring.resolver
|
||||||
|
* fileName : HtmlViewResolver
|
||||||
|
* author : julim
|
||||||
|
* date : 2023-10-04
|
||||||
|
* ======================================================================
|
||||||
|
* 변경일 변경자 변경 내용
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* 2023-10-04 julim 최초 생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public class HtmlViewResolver extends InternalResourceViewResolver {
|
||||||
|
@Override
|
||||||
|
protected View loadView(String viewName, Locale locale) throws Exception {
|
||||||
|
AbstractUrlBasedView view = buildView(viewName);
|
||||||
|
View viewObj = (View) getApplicationContext().getAutowireCapableBeanFactory().initializeBean(view, viewName);
|
||||||
|
if (viewObj instanceof JstlView) {
|
||||||
|
JstlView jv = (JstlView) viewObj;
|
||||||
|
if (jv.getBeanName().indexOf(".html") == -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return viewObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package kr.xit.core.spring.resolver;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.View;
|
||||||
|
import org.springframework.web.servlet.view.AbstractUrlBasedView;
|
||||||
|
import org.springframework.web.servlet.view.JstlView;
|
||||||
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* description : 리소스 요청에 "jsp/"가 존재하면 JspViewResolver가 처리하도록 한다. 존재하지 않으면 null을 반환
|
||||||
|
* packageName : kr.xit.core.spring.resolver
|
||||||
|
* fileName : JspViewResolver
|
||||||
|
* author : julim
|
||||||
|
* date : 2023-10-04
|
||||||
|
* ======================================================================
|
||||||
|
* 변경일 변경자 변경 내용
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* 2023-10-04 julim 최초 생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public class JspViewResolver extends InternalResourceViewResolver {
|
||||||
|
@Override
|
||||||
|
protected View loadView(String viewName, Locale locale) throws Exception {
|
||||||
|
AbstractUrlBasedView view = buildView(viewName);
|
||||||
|
View viewObj = (View) getApplicationContext().getAutowireCapableBeanFactory().initializeBean(view, viewName);
|
||||||
|
if (viewObj instanceof JstlView) {
|
||||||
|
JstlView jv = (JstlView) viewObj;
|
||||||
|
if (jv.getBeanName().indexOf(".jsp") == -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return viewObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue