[JAVA] Reflection 활용하여 객체 필드 복사하기 [원본 객체에서 필드 값을 읽어 대상 객체에 값 설정]
·
◎ Java/Java☕
- Reflection 활용하여 객체 필드 복사하기public class ReflectionExample { public static void copyFields(Object source, Object target) throws Exception { Class sourceClass = source.getClass(); Class targetClass = target.getClass(); Field[] sourceFields = sourceClass.getDeclaredFields(); for (Field sourceField : sourceFields) { try { Field targetField = ..
[Tistory] hELLO 스킨 게시글 제목 스타일 Customizing 하기 [타이틀 디자인, 내 마음대로 바꾸기]
·
◐ 기타/블로그 꾸미기🎀
- hELLO 스킨 게시글 제목 스타일 Customizing 하기hELLO 스킨이 업데이트 된 후, 제목2의 스타일이 아래와 같이 고정되었다.타이틀을 [제목2 + 본명조]로 설정하던 나로써는 속상한 일이였다. 제목2로 지정될 경우 전처리 되어 렌더링 되는 거 같아서 기존 쓰던 양식을 그대로 JavaScript로 덮어씌어주었다.// h3 스타일 지정window.onload = function() { document.querySelectorAll('#content h3').forEach(item => { item.style = "font-family: 'Noto Serif KR'; font-weight: bolder;"; item.querySelector('a').style =..
[jQuery] AJAX 요청에 공통 경로(context path) 자동 추가하기 [AJAX 요청을 시작할 때 URL 앞에 특정 path를 자동으로 추가하는 방법]
·
◎ JavaScript/jQuery🌊
- AJAX 요청에 공통 경로(context path) 자동 추가하기 AJAX 요청 시 매번 URL 앞에 같은 공통 경로(contextPath)를 붙이는 게 번거롭다면, jQuery의 전역 설정 기능을 활용해 자동화할 수 있다.1. ajaxPrefilter 사용 (전역 인터셉터) 모든 AJAX 요청 전에 URL을 전처리할 수 있는 기능이다. contextPath가 포함되지 않은 경우에만 자동으로 붙인다. $.ajaxPrefilter(function(options, originalOptions, jqXHR) { const contextPath = "/test"; if (!options.url.startsWith(contextPath)) { options.url = contextPa..
[httpd] 리버스 프록시를 설정 방법 [Apache HTTP Server에서 요청을 다른 포트로 전달하는 방법]
·
▣ Server/Apache HTTP Server🛡️
- 리버스 프록시를 설정 방법etc/httpd/conf/httpd.conf 또는 /etc/apache2/sites-available/000-default.conf와 같은 Apache 설정 파일을 편집하면 된다. ServerAdmin webmaster@localhost DocumentRoot /var/www/html # ======================== # 리버스 프록시 설정 # ======================== # /test1 경로로 들어오는 요청은 127.0.0.1:8080 로 전달 ProxyPass /test1 http://127.0.0.1:8080/ ProxyPassReverse /test1 http://127.0.0.1:808..
[Error Note] java.lang.IllegalStateException: closed 해결 방법 [ResponseBody.string()을 여러 번 호출]
·
◈ Study/에러노트(Error Note)🧱
- java.lang.IllegalStateException: closed 해결 방법 java.lang.IllegalStateException: closed at okio.RealBufferedSource.select(RealBufferedSource.kt:218) at okhttp3.internal.Util.readBomAsCharset(Util.kt:265) at okhttp3.ResponseBody.string(ResponseBody.kt:187) at G2B.g2b.service.BidService.testAPI(BidService.java:716) at G2B.g2b.controller.MainController.index(MainController.java:20) at java.base/jdk..