250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- myBatis
- Spring Boot
- Tomcat
- oracle
- spring
- Eclipse
- error
- Exception
- ubuntu
- 문서
- JDBC
- jpa
- JavaScript
- maven
- 설정
- Core Java
- STS
- Open Source
- AJAX
- Source
- Python
- Thymeleaf
- IntelliJ
- 오픈소스
- Docker
- MySQL
- git
- SpringBoot
- PostgreSQL
- MSSQL
Archives
- Today
- Total
헤르메스 LIFE
[HttpURLConnection] jsp 파일의 실행 본문
728x90
public String executeJSP(String urlstr) { URL url = null; BufferedReader in = null; URLConnection con = null; String returnMsg = ""; try { url = new URL(urlstr); con = url.openConnection(); con.connect(); System.out.println("++++++++Start+++++++++++"); System.out.println("getContentType() : " + con.getContentType() ); System.out.println("getContentLength() : " + con.getContentLength()); System.out.println("getUseCaches() : " + con.getUseCaches()); System.out.println("getContent() : " + con.getContent()); System.out.println("getRequestMethod() : " + ((HttpURLConnection)con).getRequestMethod()); System.out.println("getResponseCode() : " + ((HttpURLConnection)con).getResponseCode()); System.out.println("getResponseMessage() : " + ((HttpURLConnection)con).getResponseMessage()); System.out.println(con); System.out.println("++++++++++++++++++++++"); returnMsg = ((HttpURLConnection)con).getResponseMessage(); in = new BufferedReader(new InputStreamReader(con.getInputStream())); String msg = null; while((msg = in.readLine()) != null) { // returnMsg += msg ; } } catch (MalformedURLException malformedurlexception) { returnMsg = "URL Error"; } catch (IOException ioexception) { returnMsg = "IO Error"; } finally { try { if(in != null) in.close(); } catch(Exception ex3) { System.out.println(ex3.toString()); } } return returnMsg; }
728x90
'Core Java' 카테고리의 다른 글
[Source] DOM4j Modify XMLDemo (0) | 2020.12.20 |
---|---|
[Source] XPatharserDemo (0) | 2020.12.20 |
외부프로그램 실행시키기 (0) | 2020.12.17 |
Thread 를 이용한 데몬 프로그램 (0) | 2020.12.17 |
BigDecimal타입의 사칙연산 (0) | 2020.12.17 |