반응형
server.xml
- imgView(별칭)라는 아래 Context추가
<Context docBase="C:/EasyFrameDeveloper/server/apache-tomcat-8.5.11/webapps/프로젝트명/resources/upload" path="/imgView" reloadable="true"/>
<Service name="Catalina">
<Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector URIEncoding="UTF-8" port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context docBase="C:/EasyFrameDeveloper/server/apache-tomcat-8.5.11/webapps/프로젝트명/resources/upload" path="/imgView" reloadable="true"/> <!-- "/imgView"는 alias -->
<Context docBase="channel" path="/channel" reloadable="true" source="org.eclipse.jst.jee.server:channel"/></Host>
</Engine>
</Service>
controller
- server.xml에서 추가한 /imgView 위치를 사용
http://localhost:8080/imgView/summernote/
/**
* 이미지 업로드
* @return
* @exception Exception
*/
@PostMapping(value = "/imgUpload")
public ResponseEntity<?> imgUpload(MultipartHttpServletRequest file, HttpServletRequest request, HttpServletResponse response) throws IllegalStateException, IOException {
log.debug("summernote 이미지 업로드 {} ", file);
HashMap<String, Object> uploadInfo = fileManageService.ftpFileUpload(file);
return ResponseEntity.ok().body("http://localhost:8080/imgView/summernote/" + uploadInfo.get("fileName"));
}
web.xml
- multipartResolver Bean 설정
반응형
'JAVA' 카테고리의 다른 글
[JAVA] IE 다운로드 안될경우 (엑셀 등등) (0) | 2019.11.13 |
---|---|
[JAVA] 뒤로가기 클릭시 해당페이지 찾을수 없음 해결방법 (0) | 2019.11.13 |
[JAVA] 제네릭스(Geneics) (0) | 2019.11.13 |
[JAVA] 현재날짜, 일주일전날짜, 한달전날짜 계산 (0) | 2019.11.13 |
[JAVA] 시간 딜레이 함수 (0) | 2019.11.13 |