<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://pth41.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://pth41.github.io/" rel="alternate" type="text/html" /><updated>2020-02-19T19:33:50+09:00</updated><id>https://pth41.github.io/feed.xml</id><title type="html">TH-Blog</title><subtitle>Dev-Blog</subtitle><author><name>TaeHee-Park</name><email>qkrxogml41@naver.com</email></author><entry><title type="html">서블릿 필터</title><link href="https://pth41.github.io/posts/2020-02-19-servlet-filter/" rel="alternate" type="text/html" title="서블릿 필터" /><published>2020-02-19T00:00:00+09:00</published><updated>2020-02-20T08:54:00+09:00</updated><id>https://pth41.github.io/posts/servlet-filter</id><content type="html" xml:base="https://pth41.github.io/posts/2020-02-19-servlet-filter/">&lt;h1 id=&quot;filter&quot;&gt;Filter&lt;/h1&gt;
&lt;p&gt;서블릿 실행 전후에 작업을 할 때 사용하는 기술&lt;/p&gt;

&lt;h2 id=&quot;필터-만들기&quot;&gt;필터 만들기&lt;/h2&gt;
&lt;p&gt;javax.servlet.Filter 인터페이스로 구현&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;init()&lt;/strong&gt;&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init()&lt;/code&gt; 메서드는 필터 객체가 생성되고 준비 작업을 위해 한 번 호출&lt;br /&gt;
매개변수는 FilterConfig 객체, 이 객체를 통해 필터 초기화 매개변수의 값을 사용&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;doFilter()&lt;/strong&gt;&lt;br /&gt;
필터와 연결된 URL에 대해 요청이 들어오면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doFilter()&lt;/code&gt;가 항상 호출&lt;br /&gt;
필터가 할 일 작성&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;destroy()&lt;/strong&gt;&lt;br /&gt;
서블릿 컨테이너는 웹 애플리케이션을 종료하기 전에&lt;br /&gt;
필터들에 대해 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destroy()&lt;/code&gt;를 호출하여 마무리 작업을 할 수 있는 기회를 줌&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ExampleFilter&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Filter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nc&quot;&gt;FilterConfig&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	
	&lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FilterConfig&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServletException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;config&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;doFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ServletRequest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServletResponse&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; 
			&lt;span class=&quot;nc&quot;&gt;FilterChain&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;IOException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServletException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;cm&quot;&gt;/* 서블릿이 실행되기 전에 해야 할 작업 */&lt;/span&gt;

		&lt;span class=&quot;n&quot;&gt;chain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;doFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;	&lt;span class=&quot;c1&quot;&gt;// 다음 필터 호출, 더이상 필터가 없다면 서블릿의 service()가 호출&lt;/span&gt;

		&lt;span class=&quot;cm&quot;&gt;/* 서블릿을 실행한 후, 클라이언트에게 응답하기 전에 해야할 작업 */&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;nd&quot;&gt;@Override&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;필터의-배치&quot;&gt;필터의 배치&lt;/h2&gt;
&lt;p&gt;필터의 배치 방법도 서블릿과 마찬가지로&lt;br /&gt;
DD파일에 기술하는 방법과 애노테이션으로 기술하는 방법&lt;/p&gt;

&lt;h3 id=&quot;dd파일에-필터-배치-정보-설정&quot;&gt;DD파일에 필터 배치 정보 설정&lt;/h3&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web.xml&lt;/code&gt; 파일에 문자 집합을 설정하는 필터를 등록&lt;/p&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 필터 선언 --&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;filter&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filter-name&amp;gt;&lt;/span&gt;필터 별명&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filter-name&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filter-class&amp;gt;&lt;/span&gt;필터 클래스 이름&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filter-class&amp;gt;&lt;/span&gt;
  	
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;init-param&amp;gt;&lt;/span&gt;
  		&lt;span class=&quot;nt&quot;&gt;&amp;lt;param-name&amp;gt;&lt;/span&gt;매개변수 이름&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param-name&amp;gt;&lt;/span&gt;
  		&lt;span class=&quot;nt&quot;&gt;&amp;lt;param-value&amp;gt;&lt;/span&gt;매개변수 값&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param-value&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;/init-param&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
  
  &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 필터 URL 매핑 --&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;filter-mapping&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;filter-name&amp;gt;&lt;/span&gt;`&lt;span class=&quot;nt&quot;&gt;&amp;lt;filter&amp;gt;&lt;/span&gt;`에서 정의한 이름&lt;span class=&quot;nt&quot;&gt;&amp;lt;/filter-name&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;url-pattern&amp;gt;&lt;/span&gt;필터가 적용될 URL&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url-pattern&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/filter-mapping&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p class=&quot;notice--info&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt; : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;init-param&amp;gt;&lt;/code&gt; - 필터가 사용할 정적인 데이터를 정의&lt;/p&gt;

&lt;h2 id=&quot;애노테이션을-이용한-필터-배치&quot;&gt;애노테이션을 이용한 필터 배치&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@WebFilter&lt;/code&gt; 애노테이션을 사용하여 필터의 소스 파일에 직접 배치 정보 설정&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@WebFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;urlPatterns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;URL&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;initParams&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
				&lt;span class=&quot;nd&quot;&gt;@WebInitParam&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;매개변수 이름&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;매개변수&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;값&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ExampleFilter&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Filter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>TaeHee-Park</name><email>qkrxogml41@naver.com</email></author><category term="servlet" /><category term="web" /><category term="server" /><category term="java" /><category term="filter" /><summary type="html">Filter 서블릿 실행 전후에 작업을 할 때 사용하는 기술</summary></entry><entry><title type="html">ARCore for Unity</title><link href="https://pth41.github.io/posts/2020-02-18-arcore-for-unity/" rel="alternate" type="text/html" title="ARCore for Unity" /><published>2020-02-18T00:00:00+09:00</published><updated>2020-02-19T11:55:00+09:00</updated><id>https://pth41.github.io/posts/arcore-for-unity</id><content type="html" xml:base="https://pth41.github.io/posts/2020-02-18-arcore-for-unity/">&lt;p&gt;&lt;strong&gt;Unity를 사용해서 ARCore를 시작해보는 방법과 기능들을 알아보자&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;개발-환경-준비&quot;&gt;개발 환경 준비&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;무료버전 유니티 다운로드 &lt;a href=&quot;https://store.unity.com/kr/download?ref=personal&quot;&gt;Unity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/1.JPG&quot; width=&quot;500px&quot; height=&quot;400px&quot; title=&quot;Terms&quot; alt=&quot;Terms&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ARCore SDK for Unity 다운로드 &lt;a href=&quot;https://github.com/google-ar/arcore-unity-sdk/releases&quot;&gt;ARCore SDK for Unity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;arcore를-사용할-프로젝트-생성&quot;&gt;ARCore를 사용할 프로젝트 생성&lt;/h2&gt;
&lt;p&gt;새로운 유니티 프로젝트 생성&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/2.JPG&quot; width=&quot;600px&quot; height=&quot;500px&quot; title=&quot;Create_Project&quot; alt=&quot;Create_Project&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;다운받은 ARCore sdk unitypackage를 실행하여 Import&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/2.1.jpg&quot; width=&quot;400px&quot; height=&quot;300px&quot; title=&quot;SDK_Import&quot; alt=&quot;SDK_Import&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;안드로이드로 빌드셋
    &lt;ul&gt;
      &lt;li&gt;File메뉴 -&amp;gt; Build Settings (Ctrl+Shift+B)&lt;/li&gt;
      &lt;li&gt;안드로이드 선택 후 Switch Platform&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;플레이어 세팅&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/2.2.jpg&quot; width=&quot;500px&quot; height=&quot;400px&quot; title=&quot;BuildSettings&quot; alt=&quot;BuildSettings&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id=&quot;playersettings-설정&quot;&gt;PlayerSettings 설정&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Other Settings 열기&lt;/li&gt;
  &lt;li&gt;Multithreaded Rendering Off&lt;/li&gt;
  &lt;li&gt;Package Name 정하기&lt;/li&gt;
  &lt;li&gt;Minimum, Target API 7.0 ‘Nougat’ 이상&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/3.JPG&quot; width=&quot;400px&quot; height=&quot;300px&quot; title=&quot;PlayerSettings1&quot; alt=&quot;PlayerSettings1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;XR Settings에서 ARCore Supported 체크&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/4.JPG&quot; width=&quot;400px&quot; height=&quot;300px&quot; title=&quot;PlayerSettings2&quot; alt=&quot;PlayerSettings2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id=&quot;그-외&quot;&gt;그 외&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Edit메뉴
    &lt;ul&gt;
      &lt;li&gt;Preferences&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;SDK, JDK, NDK설정&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/edit.png&quot; width=&quot;300px&quot; height=&quot;200px&quot; title=&quot;Edit&quot; alt=&quot;Edit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/images/arcore/sjn.png&quot; width=&quot;550px&quot; height=&quot;450px&quot; title=&quot;SJN&quot; alt=&quot;SJN&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;helloar-샘플-앱&quot;&gt;HelloAR 샘플 앱&lt;/h2&gt;
&lt;p&gt;프로젝트가 준비되었으니 샘플 앱을 실행해보자&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Assets &amp;gt; GoogleARCore &amp;gt; Examples &amp;gt; HelloAR &amp;gt; Scenes &amp;gt; HelloAR 열기&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/rud.JPG&quot; width=&quot;500px&quot; height=&quot;400px&quot; title=&quot;Open_HelloAR&quot; alt=&quot;Open_HelloAR&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Add Open Scenes&lt;/li&gt;
  &lt;li&gt;Build And Run&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/build.jpg&quot; width=&quot;500px&quot; height=&quot;400px&quot; title=&quot;Build_HelloAR&quot; alt=&quot;Build_HelloAR&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
테스트 할 수 있는 환경이면 Build and Run
아니라면 Build하여 생성된 apk파일을 디바이스로 옮겨 실행&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/run1.jpg&quot; width=&quot;250px&quot; height=&quot;150px&quot; title=&quot;Run_HelloAR1&quot; alt=&quot;Run_HelloAR1&quot; /&gt; 
&lt;img src=&quot;/assets/images/arcore/run2.jpg&quot; width=&quot;250px&quot; height=&quot;150px&quot; title=&quot;Run_HelloAR2&quot; alt=&quot;Run_HelloAR2&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
처음 실행시키면 카메라를 통해 평면을 찾는다&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/run3.jpg&quot; width=&quot;250px&quot; height=&quot;150px&quot; title=&quot;Run_HelloAR3&quot; alt=&quot;Run_HelloAR3&quot; /&gt; 
&lt;img src=&quot;/assets/images/arcore/run4.jpg&quot; width=&quot;250px&quot; height=&quot;150px&quot; title=&quot;Run_HelloAR4&quot; alt=&quot;Run_HelloAR4&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
평면위에 터치를 하면 해당 위치에 Andy가 생성
생성된 객체는 카메라를 움직여도 그 자리에 고정&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/run5.jpg&quot; width=&quot;250px&quot; height=&quot;150px&quot; title=&quot;Run_HelloAR5&quot; alt=&quot;Run_HelloAR5&quot; /&gt; 
&lt;img src=&quot;/assets/images/arcore/run6.jpg&quot; width=&quot;250px&quot; height=&quot;150px&quot; title=&quot;Run_HelloAR6&quot; alt=&quot;Run_HelloAR6&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
현실 조명에 따라 Andy의 셰이더가 반응&lt;/p&gt;

&lt;h2 id=&quot;unity-arcore-사용&quot;&gt;Unity ARcore 사용&lt;/h2&gt;
&lt;p&gt;이제 직접 ARcore를 사용한다면 어떤 기능을 쓸 수 있는지 알아보자&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ARCore Device(AR 카메라) Prefab을 scene에 배치
    &lt;ul&gt;
      &lt;li&gt;폰 뒷면에 있는 카메라를 사용하여 실제 이미지를 캡처하고 
AR장면의 배경으로 사용할 수 있는 First Person Camera 게임 오브젝트를 보유&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Tracked Pose Driver -&amp;gt; scene 카메라와 전화기의 카메라(움직임)을 동기화&lt;/li&gt;
  &lt;li&gt;Environmental Light prefab을 scene에 배치
    &lt;ul&gt;
      &lt;li&gt;ARCore의 주변 밝기 데이터에 ARCore 셰이더가 액세스 가능&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/ard.png&quot; width=&quot;400px&quot; height=&quot;300px&quot; title=&quot;ard&quot; alt=&quot;ard&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/fpc.png&quot; width=&quot;400px&quot; height=&quot;300px&quot; title=&quot;fpc&quot; alt=&quot;fpc&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/5.JPG&quot; width=&quot;400px&quot; height=&quot;300px&quot; title=&quot;prefab&quot; alt=&quot;prefab&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id=&quot;environmental-light-사용&quot;&gt;Environmental Light 사용&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Environmental Light 배치
    &lt;ul&gt;
      &lt;li&gt;AR장면의 밝기을 조정하는 Prefab&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;모델 Matreial의 Shader를 DiffuseWithLightEstimation로 설정&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/le.png&quot; width=&quot;600px&quot; height=&quot;500px&quot; title=&quot;le&quot; alt=&quot;le&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id=&quot;motion-tracking&quot;&gt;Motion Tracking&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;모션 트래킹 기능은 ARCore Device에 탑재&lt;/li&gt;
  &lt;li&gt;휴대전화가 세계에서 이동할 때 현실세계에 관련된 위치를 파악하는 것&lt;/li&gt;
  &lt;li&gt;캡처된 카메라 이미지에서 형상 포인트를 정하고 감지하여 위치 변화를 계산&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/arcore/mt.jpg&quot; width=&quot;550px&quot; height=&quot;450px&quot; title=&quot;motion_tracking&quot; alt=&quot;motion_tracking&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h2 id=&quot;모션-트래킹-확인&quot;&gt;모션 트래킹 확인&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;HelloARController 스크립트 코드 참조
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Update()&lt;/code&gt; 메소드 각 프레임에서 중요작업 처리&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;세션은 ARCore의 카메라 프레임에 대한 정보를 보유&lt;/li&gt;
  &lt;li&gt;코드는 현재 세션의 TrackingState가 실제로 추적 중인지 테스트
추적 중이지 않으면 화면 제한시간을 15초로 설정
종료하기 전에 추적 상태를 복구&lt;/li&gt;
  &lt;li&gt;Motion tracking 기능은 평면 감지 기능을 제공&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;c1&quot;&gt;// 모션 추적이 추적 중인지 확인합니다.&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SessionStatus&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Tracking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lostTrackingSleepTimeout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;nc&quot;&gt;Screen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sleepTimeout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lostTrackingSleepTimeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_IsQuitting&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;IsValid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nc&quot;&gt;SearchingForPlaneUI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SetActive&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;실제-세계에서-새-planes-및-기존-planes-감지&quot;&gt;실제 세계에서 새 planes 및 기존 planes 감지&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;ARCore는 실제 세계에서 추적할 새 planes를 찾음&lt;br /&gt;
평면은 일반적인 표면에 있는 것으로 보이는 점의 군집&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;발견된 각 평면에 대해 새 게임 오브젝트가 생성되어 해당 평면을 시각화하고 추적&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;새 평면 및 기존 평면이 아직 감지되지 않는 한 “Seaching for Planes” UI텍스트 요소가 표시&lt;br /&gt;
하나 이상의 평면을 추적하면 텍스트 요소가 숨겨집니다.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;c1&quot;&gt;// 이 프레임에서 발견된 평면을 반복하고 해당 GameObjects를 인스턴스화하여 시각화&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;GetTrackables&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TrackedPlane&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_NewPlanes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TrackableQueryFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_NewPlanes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// 평면 시각화 prefab을 인스턴스화하고 새 평면을 추적하도록 설정합니다. 변환이 다음처럼 설정&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// Unity World에서 Prefab의 mesh 이후 identity rotation의 원점이 업데이트&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// 좌표를 맞춤&lt;/span&gt;
      &lt;span class=&quot;nc&quot;&gt;GameObject&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;planeObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Instantiate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TrackedPlanePrefab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;zero&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Quaternion&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;identity&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;planeObject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;GetComponent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TrackedPlaneVisualizer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;().&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Initialize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_NewPlanes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]);&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// 유효한 평면이 없으면 snackbarUI를 사용하지 않음&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;GetTrackables&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;TrackedPlane&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_AllPlanes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;showSearchingUI&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m_AllPlanes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m_AllPlanes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;TrackingState&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TrackingState&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Tracking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;showSearchingUI&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nc&quot;&gt;SearchingForPlaneUI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SetActive&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;showSearchingUI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;가상-개체-배치를-위한-사용자-입력-처리&quot;&gt;가상 개체 배치를 위한 사용자 입력 처리&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Update()&lt;/code&gt;메서드는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;planes&lt;/code&gt; 들이 추적되고 시각화된 후에 AndyAndroid개체를 평면에 배치하기 위한 사용자 입력을 처리&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;사용자가 화면을 탭 할 때, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Frame.Raycast()&lt;/code&gt;는 탭 위치에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;raycast&lt;/code&gt;를 사용해 사용자가 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;planes&lt;/code&gt; 또는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oriented points&lt;/code&gt;을 탭 했는지 여부를 감지&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;사용자가 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;planes&lt;/code&gt; 또는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;oriented points&lt;/code&gt;의 표면을 누르면 사용자가 누른 위치에 있는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TrackableHit pose&lt;/code&gt;에서 AndyAndroid개체가 인스턴스화&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hit pose&lt;/code&gt;는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Anchor&lt;/code&gt;를 생성하는데 사용
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Anchor&lt;/code&gt;는 Andy 게임 개체를 실제 세계와 비교해 같은 위치에 유지시켜줌&lt;/li&gt;
      &lt;li&gt;더 이상 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Anchor&lt;/code&gt;가 필요하지 않은 경우 Unity의 GameObject인 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Destroy()&lt;/code&gt;메서드를 호출&lt;br /&gt;
이 신호는 ARCore가 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Anchor&lt;/code&gt; 추적을 중지하라는 것&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;이 카메라 위치는 Andy가 자신의 위치에서 카메라를 보는 것처럼 보이도록 Andy 객체의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;transform&lt;/code&gt;을 조정하는 데 사용&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Andy 객체의 변환은 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hit&lt;/code&gt;의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Anchor&lt;/code&gt;를 상속하므로 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Anchor&lt;/code&gt; 객체는 사용자가 전화기를 이동할 때 사용자가 놓은 위치에 유지&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Raycast는 플레이어가 평면을 검색하기 위해 터치한 위치와 대비 &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// TrackableHit - ARCore에서 추적한 물리적 개체에 대한 Raycast히트에 대한 정보를 포함 &lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;TrackableHit&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;TrackableHitFlags&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;raycastFilter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TrackableHitFlags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;PlaneWithinPolygon&lt;/span&gt;  
      &lt;span class=&quot;nc&quot;&gt;TrackableHitFlags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;FeaturePointWithSurfaceNormal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;touch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;touch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;raycastFilter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andyObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Instantiate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;AndyAndroidPrefab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Pose&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Pose&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;rotation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

      &lt;span class=&quot;c1&quot;&gt;// ARCore가 물리적 환경에 대한 이해가 진화함에 따라 hitpoint를 추적할 수 있도록 anchor를 작성&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Trackable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;CreateAnchor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Pose&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

      &lt;span class=&quot;c1&quot;&gt;// 앤디는 카메라를 봐야 하지만 여전히 평면과 같은 수평에 있음&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Flags&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TrackableHitFlags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;PlaneWithinPolygon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TrackableHitFlags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;// 카메라 위치를 잡고 y성분을 hit position와 일치&lt;/span&gt;
          &lt;span class=&quot;nc&quot;&gt;Vector3&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cameraPositionSameY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;FirstPersonCamera&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;cameraPositionSameY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Pose&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

          &lt;span class=&quot;c1&quot;&gt;// Have Andy look toward the camera respecting his &quot;up&quot; perspective, which may be from ceiling.&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;andyObject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;LookAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cameraPositionSameY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andyObject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;up&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

      &lt;span class=&quot;c1&quot;&gt;// Make Andy model a child of the anchor.&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;andyObject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;parent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;anchor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>TaeHee-Park</name><email>qkrxogml41@naver.com</email></author><category term="arcore" /><category term="unity" /><summary type="html">Unity를 사용해서 ARCore를 시작해보는 방법과 기능들을 알아보자</summary></entry><entry><title type="html">서블릿 기초 정리2</title><link href="https://pth41.github.io/posts/2020-02-18-servlet2/" rel="alternate" type="text/html" title="서블릿 기초 정리2" /><published>2020-02-18T00:00:00+09:00</published><updated>2020-02-18T22:06:00+09:00</updated><id>https://pth41.github.io/posts/servlet2</id><content type="html" xml:base="https://pth41.github.io/posts/2020-02-18-servlet2/">&lt;h2 id=&quot;httpservlet-클래스&quot;&gt;HttpServlet 클래스&lt;/h2&gt;
&lt;p&gt;HttpServlet 클래스는 GenericServlet 클래스의 하위 클래스&lt;br /&gt;
따라서 HttpServlet을 상속받으면&lt;br /&gt;
GenericServlet 클래스를 상속받는 것과 마찬가지로&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javax.servlet.Servlet&lt;/code&gt; 인터페이스를 구현한 것이 됨&lt;/p&gt;

&lt;h3 id=&quot;doxxx메서드-오버라이딩&quot;&gt;doXXX()메서드 오버라이딩&lt;/h3&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ExampleServlet&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HttpServlet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;doXXX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;HttpServletRequest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HttpServletResponse&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
		    	&lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServletException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;IOException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;클라이언트 요청이 들어오면…&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;첫째로 상속받은 HttpSerlvet의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt; 메서드가 호출,&lt;/li&gt;
  &lt;li&gt;둘째로 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt;는 클라이언트 요청 방식에 따라 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doGet()&lt;/code&gt;이나 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doPost()&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doPut()&lt;/code&gt; 등의 메서드를 호출&lt;br /&gt;
따라서 HttpServlet을 상속받을 때 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt; 메서드를 직접 구현하기보다는 클라이언트의 요청 방식에 따라 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;doXXX()&lt;/code&gt; 메서드를 오버라이딩&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;응답-헤더를-이용한-refresh&quot;&gt;응답 헤더를 이용한 Refresh&lt;/h3&gt;
&lt;p&gt;일정 시간이 지나고 나서 자동으로 서버에 요청을 보내는 방법&lt;/p&gt;
&lt;div class=&quot;language-jsp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
&lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'Refresh'&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'1; url=list'&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
...
response.addHeader(&quot;Refresh&quot;, &quot;1;url=list&quot;);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;blockquote&gt;
  &lt;p&gt;응답 본문을 출력하고서 1초 뒤에 다시 서비스를 요청하라는 뜻&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p class=&quot;notice--info&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt; : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;meta&amp;gt;&lt;/code&gt;태그는 반드시 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;head&amp;gt;&lt;/code&gt;태그 안에 선언&lt;/p&gt;

&lt;h2 id=&quot;서블릿-초기화-매개변수&quot;&gt;서블릿 초기화 매개변수&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init()&lt;/code&gt;를 호출할 때 서블릿 컨테이너가 전달하는 데이터&lt;br /&gt;
데이터베이스 연결 정보와 같은 정적인 데이터를 서블릿에 전달할 때 사용&lt;/p&gt;

&lt;h3 id=&quot;dd파일에-서블릿-초기화-매개변수-설정&quot;&gt;DD파일에 서블릿 초기화 매개변수 설정&lt;/h3&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 서블릿 등록 --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;servlet&amp;gt;&lt;/span&gt;
  ...
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;init-param&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;param-name&amp;gt;&lt;/span&gt;매개변수 이름&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param-name&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;param-value&amp;gt;&lt;/span&gt;매개변수 값&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param-value&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/init-param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/servlet&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;init-param&amp;gt;&lt;/code&gt;가 서블릿 초기화 매개변수를 설정하는 태그&lt;br /&gt;
-&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;servlet&amp;gt;&lt;/code&gt;의 자식 엘리먼트&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;init-param&amp;gt;&lt;/code&gt;도 두 개의 자식 엘리먼트 가짐&lt;br /&gt;
-&amp;gt; 매개변수 이름을 지정하는&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;param-name&amp;gt;&lt;/code&gt;, 매개변수 값을 지정하는&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;param-value&amp;gt;&lt;/code&gt;&lt;br /&gt;
서블릿 초기화 매개변수들은 오직 그 매개변수를 선언한 서블릿에서만 사용 가능&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;서블릿 초기화 매개변수 사용&lt;/p&gt;
  &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInitParameter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;cm&quot;&gt;/* 매개변수 이름 */&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getInitParameter()&lt;/code&gt;는 해당 서블릿의 배치 정보가 있는 DD파일(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web.xml&lt;/code&gt;)로부터 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;init-param&amp;gt;&lt;/code&gt;의 매개변수 값을 꺼내 줌&lt;br /&gt;
반환하는 값은 문자열&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;컨텍스트-초기화-매개변수의-선언&quot;&gt;컨텍스트 초기화 매개변수의 선언&lt;/h3&gt;
&lt;p&gt;컨텍스트 초기화 매개변수 : 같은 웹 애플리케이션에 소속된 서블릿들이 공유하는 매개변수&lt;/p&gt;
&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 컨텍스트 매개변수 --&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;context-param&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;param-name&amp;gt;&lt;/span&gt;매개변수 이름&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param-name&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;param-value&amp;gt;&lt;/span&gt;매개변수 값&lt;span class=&quot;nt&quot;&gt;&amp;lt;/param-value&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/context-param&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;blockquote&gt;
  &lt;p&gt;컨텍스트 초기화 매개변수 사용&lt;/p&gt;
  &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;ServletContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getServletContext&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;p&gt;HttpServlet에게 상속받은 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getServletContext()&lt;/code&gt;를 호출하여 ServletContext 객체 준비&lt;/p&gt;
  &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;sc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInitParameter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;cm&quot;&gt;/* 매개변수 이름 */&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;p&gt;이 객체를 통해 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getInitParameter()&lt;/code&gt;를 호출하면 DD파일(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web.xml&lt;/code&gt;)에 선언된 컨텍스트 초기화 매개변수 값을 사용 가능&lt;/p&gt;
&lt;/blockquote&gt;</content><author><name>TaeHee-Park</name><email>qkrxogml41@naver.com</email></author><category term="servlet" /><category term="web" /><category term="server" /><category term="java" /><summary type="html">HttpServlet 클래스 HttpServlet 클래스는 GenericServlet 클래스의 하위 클래스 따라서 HttpServlet을 상속받으면 GenericServlet 클래스를 상속받는 것과 마찬가지로 javax.servlet.Servlet 인터페이스를 구현한 것이 됨</summary></entry><entry><title type="html">서블릿 기초 정리1</title><link href="https://pth41.github.io/posts/2020-02-17-servlet1/" rel="alternate" type="text/html" title="서블릿 기초 정리1" /><published>2020-02-17T00:00:00+09:00</published><updated>2020-02-17T22:06:00+09:00</updated><id>https://pth41.github.io/posts/servlet1</id><content type="html" xml:base="https://pth41.github.io/posts/2020-02-17-servlet1/">&lt;h2 id=&quot;서블릿-작성&quot;&gt;서블릿 작성&lt;/h2&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javax.servlet.Servlet&lt;/code&gt; 인터페이스를 통해 구현&lt;br /&gt;
서블릿 컨테이너가 서블릿에 호출할 메서드를 정의한 것이 Servlet 인터페이스&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;서블릿의 생명주기 관련 메서드
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init()&lt;/code&gt; : 서블릿 컨테이너가 서블릿을 생성한 후 초기화 작업을 수행하기 위해 호출 -&amp;gt; 클라이언트 요청 처리 전 준비 작업 작성&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt; : 클라이언트가 요청할 때 마다 호출되는 메서드 -&amp;gt; 서블릿이 해야 할 일 작성&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destroy()&lt;/code&gt; : 서블릿 컨테이너가 종료되거나 웹 앱이 멈출 때, 또는 해당 서블릿을 비 활성화 시킬 때 호출 -&amp;gt; 확보한 자원을 해제하거나 데이터를 저장하는 등 마무리 작업 작성&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;기타 메서드
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getServletConfig()&lt;/code&gt; : 서블릿 설정 정보를 다루는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServletConfig&lt;/code&gt; 객체 반환 -&amp;gt; 서블릿 이름과 초기 매개변수 값, 환경정보&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getServletInfo()&lt;/code&gt; : 문자열을 반환 -&amp;gt; 서블릿을 작성한 사람에 대한 정보나 서블릿 버번, 권리 등&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;서블릿-배치-정보-작성&quot;&gt;서블릿 배치 정보 작성&lt;/h2&gt;
&lt;p&gt;DD파일&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web.xml&lt;/code&gt;에 서블릿 배치 정보를 작성한다.&lt;/p&gt;

&lt;p class=&quot;notice--info&quot;&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web.xml&lt;/code&gt;파일은 웹 애플리케이션을 구성하는 웹 컴포넌트에 대한 구성 및 배치 정보를 제공하며, 웹 애플리케이션의 배포서술사(Deployment Descriptor;DD) 역할을 하는 XML 형식의 파일&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;servlet&amp;gt;&lt;/code&gt;태그를 사용하여 서블릿 별명과 서블릿 클래스명을 설정&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 서블릿 등록 --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;servlet&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;servlet-name&amp;gt;&lt;/span&gt;Hello&lt;span class=&quot;nt&quot;&gt;&amp;lt;/servlet-name&amp;gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Alias --&amp;gt;&lt;/span&gt;
  	&lt;span class=&quot;nt&quot;&gt;&amp;lt;servlet-class&amp;gt;&lt;/span&gt;HelloWorld&lt;span class=&quot;nt&quot;&gt;&amp;lt;/servlet-class&amp;gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Class_Name --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/servlet&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;servlet-mapping&amp;gt;&lt;/code&gt;태그를 사용하여 서블릿과 URL을 매핑&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 서블릿 URL 연결 --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;servlet-mapping&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;servlet-name&amp;gt;&lt;/span&gt;Hello&lt;span class=&quot;nt&quot;&gt;&amp;lt;/servlet-name&amp;gt;&lt;/span&gt; 
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;url-pattern&amp;gt;&lt;/span&gt;/Hello&lt;span class=&quot;nt&quot;&gt;&amp;lt;/url-pattern&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;서블릿-구동-절차&quot;&gt;서블릿 구동 절차&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;클라이언트 요청이 들어오면 서블릿 컨테이너는 서블릿을 찾음&lt;/li&gt;
  &lt;li&gt;서블릿이 없다면, 서블릿 클래스를 로딩하고 인스턴스를 준비 후 생성자를 호출. 그리고 서블릿 초기화 메서드인 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init()&lt;/code&gt;를 호출&lt;/li&gt;
  &lt;li&gt;클라이언트 요청을 처리하는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt;호출.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt;에서 만든 결과를 HTTP 프로토콜에 맞추어 클라이언트에 응답&lt;/li&gt;
  &lt;li&gt;서블릿 컨테이너를 종료하거나, 웹 애플리케이션을 종료 한다면, 서블릿 컨테이너는 종료되기 전에 생성된 모든 서블릿에 대해 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;destroy()&lt;/code&gt;호출&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;welcome-file&quot;&gt;Welcome File&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;디렉토리의 기본 웹 페이지&lt;/strong&gt;&lt;br /&gt;
DD파일&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;web.xml&lt;/code&gt;의 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;welcom-file-list&amp;gt;&lt;/code&gt; 태그를 사용하여 설정&lt;br /&gt;
이 태그의 하위 태그인 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;welcome-file&amp;gt;&lt;/code&gt;에 웰컴 파일의 이름을 적어 넣어서 등록&lt;br /&gt;
웰컴 파일이 여러 개인 경우, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;welcom-file-list&amp;gt;&lt;/code&gt;태그에 선언된 순서대로 찾음&lt;/p&gt;

&lt;h2 id=&quot;genericservlet&quot;&gt;GenericServlet&lt;/h2&gt;
&lt;p&gt;서블릿 클래스가 필요로 하는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init(), destroy(), getServletConfig(), getServletInfo()&lt;/code&gt;를 미리 구현하여 상속&lt;br /&gt;
서블릿을 만들 때 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GenericServlet&lt;/code&gt;을 상속받는다면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt;만 구현하면 됨&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ExampleServlet&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;GenericServlet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; 
	&lt;span class=&quot;kd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;HttpServletRequest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HttpServletResponse&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
		    	&lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ServletException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;IOException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service()&lt;/code&gt;의 매개변수 중에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServletRequest&lt;/code&gt;객체는 클라이언트의 요청 정보를 다룰 때 사용&lt;br /&gt;
그 중 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getParameter()&lt;/code&gt;는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GET&lt;/code&gt;이나 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; 요청으로 들어온 매개변수 값을 꺼낼 때 사용&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getParameter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ServletResponse&lt;/code&gt; 객체는 응답과 관련된 기능 제공&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setContentType()&lt;/code&gt;으로 출력할 데이터의 인코딩 형식과 문자 집합을 지정.&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setContentType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/plain&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 출력할 데이터가 텍스트이고 별도의 메타정보가 없음  &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setCharacterEncoding()&lt;/code&gt;은 출력할 데이터의 문자 집합을 지정.&lt;br /&gt;
기본값은 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ISO-8859-1&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCharacterEncoding&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;c1&quot;&gt;// 데이터를 출력할 때 유니코드 값을 `UTF-8` 형식으로 변환&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getWriter()&lt;/code&gt;는 출력 스트림 객체를 반환. 이미지나 동영상과 같은 바이너리 데이터를 출력할 때는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getOutputStream()&lt;/code&gt;을 사용&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;PrintWriter&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getWriter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;  
&lt;span class=&quot;c1&quot;&gt;// `getWriter()`를 호출하기 전에 `setContentType()`나 `setCharacterEncoding()`을 먼저 호출&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
Servlet3.0 사양부터 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@WebServlet&lt;/code&gt; 애노테이션을 사용하여 서블릿 배치 정보 작성 가능
서블릿의 URL 정보를 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@WebServlet&lt;/code&gt;의 괄호 안에 기술&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@WebServlet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/url&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>TaeHee-Park</name><email>qkrxogml41@naver.com</email></author><category term="servlet" /><category term="web" /><category term="server" /><category term="java" /><summary type="html">서블릿 작성 javax.servlet.Servlet 인터페이스를 통해 구현 서블릿 컨테이너가 서블릿에 호출할 메서드를 정의한 것이 Servlet 인터페이스 서블릿의 생명주기 관련 메서드 init() : 서블릿 컨테이너가 서블릿을 생성한 후 초기화 작업을 수행하기 위해 호출 -&amp;gt; 클라이언트 요청 처리 전 준비 작업 작성 service() : 클라이언트가 요청할 때 마다 호출되는 메서드 -&amp;gt; 서블릿이 해야 할 일 작성 destroy() : 서블릿 컨테이너가 종료되거나 웹 앱이 멈출 때, 또는 해당 서블릿을 비 활성화 시킬 때 호출 -&amp;gt; 확보한 자원을 해제하거나 데이터를 저장하는 등 마무리 작업 작성 기타 메서드 getServletConfig() : 서블릿 설정 정보를 다루는 ServletConfig 객체 반환 -&amp;gt; 서블릿 이름과 초기 매개변수 값, 환경정보 getServletInfo() : 문자열을 반환 -&amp;gt; 서블릿을 작성한 사람에 대한 정보나 서블릿 버번, 권리 등</summary></entry></feed>