JavaServletProgramming.PDF

Size: px
Start display at page:

Download "JavaServletProgramming.PDF"

Transcription

1 ( ) from Yongwoo s Park Java Servlet Programming from Yongwoo s Park 1

2 Java Servlet Programming from Yongwoo s Park 2

3 (SERVLET) 4 11 (GENERICSERVLET ) Servlet 4 GenericServlet 5 ServletRequest 7 ServletResponse 9 ServletInputStream 9 ServletOutputStream 10 (GenericServlet) 11 ServletConfig 14 ServletContext HTTP (HTTPSERVLET ) HttpServlet 18 HttpServletRequest 19 HttpServletResponse 20 HTTP Cookie 38 HttpSession 44 HttpSessionBindingListener 45 HttpSessionBindingEvent HttpUtils SMTP(Send Mail Transfer Protocol) 59 Java Servlet Programming from Yongwoo s Park 3

4 from Yongwoo s Park javalangobject javaioinputstream javaxservletgenericservlet javaiooutputstream javaxservletservletinputstream javaxservletservletoutputstream javaxservletservlet javaxservletservletconfig javaxservletservletcontext javaxservletservletrequest javaxservletservletresponse javaxservletrequestdispatcher javaxservletsinglethreadmodel 1 javaxservlet HTTP(Hyper-Text Transfer Protocol),, Servlet, javaxservletgenericservlet (generic Servlet) javaxservlethttphttpservlet HTTP Servlet, (life-cycle), :, init Java Servlet Programming from Yongwoo s Park 4

5 : :, destroy,, finalize interface Servlet { WWW Request Response init(config) service(req, res) destroy() Load MyServletclass getservletconfig() getservletinfo() Unload 2,, (startup) getservletconfig (author), (version), (copyright) getservletinfo Servlet, void init(servletconfig config):,, void service(servletrequest req, ServletResponse res): void destroy():, ServletConfig getservletconfig(): / ServletConfig javalangstring getservletinfo(): (author), (version), (copyright) Java Servlet Programming from Yongwoo s Park 5

6 GenericServlet, (Web site) HTTP, HttpServlet GenericServlet Servlet ServletConfig, GenericServlet HttpServlet, GenericServlet HttpServlet, Servlet GenericServlet init destroy (lifecycle) ServletConfig,, GenericServlet ServletContext log, MyServlet extends GenericServlet { Request ServletRequest req WWW WWW ServletResponse res Response ServletInputStream ServletOutputStream service(req, res) init(config) destroy() 3, getservletinfo, - (sevlet-wide) init destroy GenericServlet, void init(): void init(servletconfig config):,, abstract void service(servletrequest req, ServletResponse res):, GenericServlet Java Servlet Programming from Yongwoo s Park 6

7 void destroy():, javalangstring getinitparameter(javalangstring name): javautilenumeration getinitparameternames(): enumeration ServletConfig getservletconfig(): / ServletConfig ServletContext getservletcontext(): ServletContext javalangstring getservletinfo(): (author), (version), (copyright) void log(javalangstring msg): void log(javalangstring message, javalangthrowable t): ServletRequest, ServletRequest, HttpServletRequest HTTP MIME, MIME, MIME, getreader, getinpuetstream, Multipart MIME Java Servlet Programming from Yongwoo s Park 7

8 ServletRequest, javautilenumeration getattributenames(): Enumeration javalangobject getattribute(javalangstring name) : void setattribute(javalangstring key, javalangobject o): javalangstring getcharacterencoding(): int getcontentlength():, 1 javalangstring getcontenttype(): MIME null javautilenumeration getparameternames(): Enumeration javalangstring getparameter(javalangstring name): javalangstring[] getparametervalues(javalangstring name): (list) (choicebox), javaiobufferedreader getreader(): BufferedReader ServletInputStream getinputstream():, ServletInputStream javalangstring getprotocol(): HTTP/11 major/minor javalangstring getremoteaddr(): IP(Internet Protocol) javalangstring getremotehost(): javalangstring getscheme(): http, https, ftp javalangstring getservername(): int getserverport(): javalangstring getrealpath(javalangstring path): API 21 ServletContextgetRealPath(javalangString) Java Servlet Programming from Yongwoo s Park 8

9 ServletResponse, MIME, ServletResponse, ServletResponse service ServletRequest, MIME ServletResponse getoutputstream ServletOutputStream, MIME getwriter PrintWriter, ServletResponse, javalangstring getcharacterencoding(): MIME ServletOutputStream getoutputstream(): ServletOutputStream javaioprintwriter getwriter(): PrintWriter void setcontentlength(int len): void setcontenttype(javalangstring type): ServletInputStream readline, (input stream) HTTP POST PUT ServletInputStream, ServletRequestgetInputStream ServletInputStream ServletInputStream, service, ServletInputStream Java Servlet Programming from Yongwoo s Park 9 ServletOutputStream service

10 , ServletInputStream javaioinputstreamread ServletInputStream, int readline(byte[] b, int off, int len):, 1 ServletOutputStream, (output stream) ServletInputStream ServletResponsegetOutputStream ServletOutputStream ServletInputStream ServletOutputStream,, ServletOutputStream, javaiooutputstream write(int) ServletOutputStream, void print(boolean b): b void print(char c): c void print(double d): d void print(float f): f void print(int i): i void print(long l): l void print(javalangstring s): s void println(): CRLF(carriage return-line feed) void println(boolean b): b CRLF void println(char c): c CRLF void println(double d): d CRLF void println(float f): f CRLF void println(int i): i CRLF void println(long l): l CRLF void println(javalangstring s): s CRLF Java Servlet Programming from Yongwoo s Park 10

11 , Setvlet GenericServlet, init, service, destroy, getservletinfo getservletconfig javaappletapplet, init, start, stop, destroy, paint, getappletinfo, (GenericServlet) import javaio*; import javautilenumeration; import javaxservlet*; public class HelloGenericServlet extends GenericServlet { static String initialname; public void init(servletconfig config) throws ServletException { superinit(config); initialname=configgetinitparameter("name"); public void service(servletrequest req, ServletResponse res) throws ServletException, IOExc eption { PrintWriter out=resgetwriter(); String name=reqgetparameter("name"); outprintln("hello, "+initialname+":init, "+name+":req"); outprintln("attribute names in this request:"); Enumeration e = reqgetattributenames(); while(ehasmoreelements()) { String key =(String)enextElement(); Object value = reqgetattribute(key); outprintln(" " + key + " = " + value); outprintln(); outprintln(" Protocol: " + reqgetprotocol()); outprintln(" Scheme: " + reqgetscheme()); outprintln(" Server Name: " + reqgetservername()); outprintln(" Server Port: " + reqgetserverport()); outprintln(" Remote Addr: " + reqgetremoteaddr()); outprintln(" Remote Host: " + reqgetremotehost()); outprintln("character Encoding: " + reqgetcharacterencoding()); outprintln(" Content Length: " + reqgetcontentlength()); outprintln(" Content Type: " + reqgetcontenttype()); Java Servlet Programming from Yongwoo s Park 11

12 outprintln(); outprintln("parameter names in this request"); e = reqgetparameternames(); while(ehasmoreelements()) { String key =(String)enextElement(); String[] values = reqgetparametervalues(key); outprint(" " + key + " = "); for(int i=0;i<valueslength;i++) { outprint(values[i] + " "); outprintln(); /* * File: d:\java\jsdk21\webpages\web-inf\servletsproperties hellocode=hellogenericservlet helloinitparams=name=yongwoo's Park */ < 1 HelloGenericServletjava>,,, HTML Java Servlet Programming from Yongwoo s Park 12

13 HTML (GenericServlet) HTML import javaio*; import javautilenumeration; import javaxservlet*; public class HelloGenericServlet2 extends GenericServlet { public void service(servletrequest req, ServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out=resgetwriter(); String name=reqgetparameter("name"); outprintln("<html>"); outprintln("<head><title>hello, "+name+"</title></head>"); outprintln("<body>"); outprintln("<h1>hello, "+name+"</h1>"); outprintln("<h2> "+reqgetparameter(" ")+" </H2>"); outprintln("</body>"); outprintln("</html>"); /* * File: d:\java\jsdk21\webpages\web-inf\servletsproperties hello2code=hellogenericservlet2 hello2initparams= */ < 2 HelloGenericServlet2java> Java Servlet Programming from Yongwoo s Park 13

14 ServletResponse setcontenttype, ( ) MIME text/html, HTML Content Type: text/html; charset=euc-kr, MIME, ISO , name/value, ServletContext ServletConfig, javalangstring getinitparameter(javalangstring name): name/value, javautilenumeration getinitparameternames(): Enumeration ServletContext getservletcontext(): ServletContext MIME Java Servlet Programming from Yongwoo s Park 14

15 , ServletContext, ServletConfiggetServletContext () ServletContext, (multiple) (virtual), ServletContext ServletContext ServletConfig, ServletgetServletConfig ServletConfig ServletContext, javalangobject getattribute(javalangstring name): javautilenumeration getattributenames(): Enumeration void removeattribute(javalangstring name): (contect) void setattribute(javalangstring name, javalangobject object): (contect) ServletContext getcontext(javalangstring uripath): URL ServletContext int getmajorversion(): API major version int getminorversion(): API minor version javalangstring getmimetype(javalangstring file): MIME javalangstring getrealpath(javalangstring path): RequestDispatcher getrequestdispatcher(javalangstring urlpath): wrapper RequestDispatcher javaneturl getresource(javalangstring path): javaioinputstream getresourceasstream(javalangstring path): javautilenumeration getservlets(): API 20 void log(javalangexception exception, javalangstring msg) : API 21 log(string message, Throwable throwable) void log(javalangstring msg): void log(javalangstring message, javalangthrowable throwable): Java Servlet Programming from Yongwoo s Park 15

16 javalangstring getserverinfo(): Servlet getservlet(javalangstring name): API 21 javautilenumeration getservletnames(): API 21 (GenericServlet) /* $Id: SnoopServletjava,v /03/17 01:17:20 duncan Exp $ * */ import javaioioexception; import javautilenumeration; import javaxservlet*; import javaxservlethttp*; /** James Duncan Davidson <duncan@engsuncom> */ public class SnoopGenericServlet extends GenericServlet { public void service(servletrequest req, ServletResponse res) throws ServletException, IOException { ServletConfig config = getservletconfig(); ServletOutputStream out = resgetoutputstream(); ressetcontenttype("text/html; charset=8859-1"); outprintln("<html>"); outprintln("<head><title>generic Snoop Servlet</title></head>"); outprintln("<body>"); outprintln("<h3>generic Snoop Servlet</H3><br>"); outprintln("init Parameters<br>"); Enumeration e = configgetinitparameternames(); while(ehasmoreelements()) { String key =(String)enextElement(); String value = configgetinitparameter(key); outprintln("\t" + key + " = " + value + "\t"); outprintln("<br>"); outprintln("server Info:"+getServletConfig()getServletContext()getServerInfo()); outprintln("<br>"); outprintln("context attributes:"); ServletContext context = configgetservletcontext(); e = contextgetattributenames(); while(ehasmoreelements()) { String key =(String)enextElement(); Object value = contextgetattribute(key); Java Servlet Programming from Yongwoo s Park 16

17 outprintln("\t" + key + " = " + value + "<br>"); outprintln("java Server: "+contextgetmajorversion()+""+contextgetminorversion()); outprintln("<br>"); outprintln("attributes<br>"); e = reqgetattributenames(); while(ehasmoreelements()) { String key =(String)enextElement(); Object value = reqgetattribute(key); outprintln("\t" + key + " = " + value + "<br>"); outprintln("<br>"); /* * outprintln("parameters<br>"); e = reqgetparameternames(); while(ehasmoreelements()) { String key =(String)enextElement(); String[] values = reqgetparametervalues(key); outprint("\t" + key + " = "); for(int i=0;i<valueslength;i++) { outprint(values[i] + " "); outprintln("<br>"); outprintln("</body>"); outprintln("</html>"); # $Id: servletsproperties,v /04/02 02:04:22 duncan Exp $ snoop2code=snoopgenericservlet snoop2initparams=initarg1=foo,initarg2=bar */ Java Servlet Programming from Yongwoo s Park 17

18 < 3 SnoopGenericServletjava> javalangobject javaioinputstream javaxservletgenericservlet javaiooutputstream javaxservletservletinputstream javaxservletservletoutputstream javaxservletservlet javaxservletservletconfig javaxservletservletcontext javaxservletservletrequest javaxservletservletresponse javaxservletrequestdispatcher javaxservletsinglethreadmodel 4 javaxservlethttp HttpServlet HTTP HTTP,, HttpServlet doget : HTTP GET dopost : HTTP POST doput : HTTP PUT dodelete : HTTP DELETE init destroy :, init, destroy getservletinfo: Java Servlet Programming from Yongwoo s Park 18

19 GET Request MyServlet extends HttpServlet { Response POST Request Response PUT Request Response WWW HttpServletRequest req HttpServletResponse res doget(req, res) dopost(req, res) doput(req, res) dodelete(req, res) ServletInputStream service( ) ServletOutputStream 5 HTTP ServletRequest HttpServletRequest HTTP HTTP HTTP HttpServlet service HttpServletRequest HttpServletRequest HTTP, javalangstring getauthtype(): (authentication scheme), "BASIC" "SSL" Cookie[] getcookies(): long getdateheader(javalangstring name): Date long javalangstring getheader(javalangstring name): javautilenumeration getheadernames(): Enumeration int getintheader(javalangstring name): javalangstring getmethod(): GET, POST, PUT, DELETE (request method) Java Servlet Programming from Yongwoo s Park 19

20 javalangstring getpathinfo(): URL javalangstring getpathtranslated(): servlet (query string), javalangstring getquerystring(): javalangstring getremoteuser():, HTTP (authentication), javalangstring getrequestedsessionid(): (session) ID javalangstring getrequesturi(): HTTP URL javalangstring getservletpath(): URL HttpSession getsession():, HttpSession getsession(boolean create):, create boolean isrequestedsessionidfromcookie(): ID boolean isrequestedsessionidfromurl(): API 21 isrequestedsessionidfromurl() boolean isrequestedsessionidfromurl(): ID URL boolean isrequestedsessionidvalid(): HttpSessionContext HTTP HTTP HttpServletResponse HttpServletResponse service HTTP,, HTTP HttpServletResponse, HttpServletResponse, void addcookie(cookie cookie): Java Servlet Programming from Yongwoo s Park 20

21 boolean containsheader(javalangstring name): javalangstring encoderedirecturl(javalangstring url): encoderedirecturl(string url) javalangstring encoderedirecturl(javalangstring url): URL sendredirect javalangstring encodeurl(javalangstring url) : encodeurl(string url) javalangstring encodeurl(javalangstring url): URL ID void senderror(int sc): void senderror(int sc, javalangstring msg): void sendredirect(javalangstring location): URL void setdateheader(javalangstring name, long date): void setheader(javalangstring name, javalangstring value) : void setintheader(javalangstring name, int value): void setstatus(int sc): void setstatus(int sc, javalangstring sm): HTTP (GenericServlet) GET POST, import javaio*; import javaxservlet*; import javaxservlethttp*; public class HelloHttpServlet extends HttpServlet { public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); Java Servlet Programming from Yongwoo s Park 21

22 outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>hello</title>"); outprintln("</head>"); outprintln("<body>"); outprintln("<h1> "+reqgetparameter("name")+"!</h1>"); outprintln("<h3> "+reqgetparameter("job")+" </H3>"); outprintln("</body>"); outprintln("</html>"); public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>hello</title>"); outprintln("</head>"); outprintln("<body>"); outprintln("<h1> "+toksc5601(reqgetparameter("name"))+"!</h1>"); outprintln("<h3> "+toksc5601(reqgetparameter("job"))+" </H3>"); outprintln("</body>"); outprintln("</html>"); public static String toksc5601(string str) throws UnsupportedEncodingException { if(str == null) { return(null); return(new String(strgetBytes("8859_1"), "KSC5601")); /* * 1) GET 1) POST Java Servlet Programming from Yongwoo s Park 22

23 */ < 4 HelloHttpServletjava>, HTTP (GenericServlet) POST HTML <HTML> <HEAD> <META http-equiv="content-type" content="text/html; charset=euc-kr"> <TITLE>Form Test</TITLE> </HEAD> <BODY> <H1>POST </H1> <P> <FORM action=" method="post"> : <input type="text" name="name" size=16><br> : <input type="text" name="job" size=40><br> <input type="submit" value=" "> </FORM> </BODY> </HTML> /* * */ Java Servlet Programming from Yongwoo s Park 23

24 < 5 HelloHttpServlethtml> HTTP,, HTML, HTML HTTP HTML <HTML> <HEAD> <TITLE>File Upload</TITLE> </HEAD> <BODY> <H1> </H1> <P> <FORM method="post" action=" enctype=multipart/form-data> : <input type="text" name="name" size=16><br> : <input type="file" name="binary"><br> <input type="submit" value=" "> </FORM> </BODY> </HTML> /* * */ < 6 FileUploadEchoServlethtml> Java Servlet Programming from Yongwoo s Park 24

25 , <FORM> <FORM> method="post" POST, GET, POST action=" enctype=multipart/form-data,, multipart/form-data : <input type="file" name="binary"> - input file,, HTML, HTTP, HTTP import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class FileUploadEchoServlet extends HttpServlet { public void dopost(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>file Upload Result</TITLE>"); outprintln("</head>"); outprintln("<body>"); outprintln("<h2> </H2>"); outprintln(" Content type: ["+reqgetcontenttype()+"]<br>"); outprintln("content length: ["+reqgetcontentlength()+"]<br>"); Java Servlet Programming from Yongwoo s Park 25

26 InputStreamReader isr = new InputStreamReader(reqgetInputStream(), "EUC-KR"); BufferedReader br = new BufferedReader(isr); for(string line;(line=brreadline())!=null;) { outprintln(line+"<br>"); outclose(); /* * outprintln("</body>"); outprintln("</html>"); */ < 7 FileUploadEchoServletjava>,, HTML, HTTP, HTTP HTML HTML <HTML> <BODY> <HEAD> <TITLE>File Upload Result</TITLE> </HEAD> <BODY> Java Servlet Programming from Yongwoo s Park 26

27 <H2> </H2> Content type: [multipart/form-data; boundary= cfc2164e07da]<BR> Content length: [10558]<BR> cfc2164e07da<BR> Content-Disposition: form-data; name="name"<br> <BR> <BR> cfc2164e07da<BR> Content-Disposition: form-data; name="binary"; filename="d:\temp\bigpenguingif"<br> Content-Type: image/gif<br> <BR> cf1124e07da--<BR> 6, HTML,, Content Type reqgetcontenttype MIME, MIME multipart/form-data?? multipart/form-data; boundary= cfc2164e07da cf1124e07da enctype=multipart/form-data (name) (binary), Content-Disposition: (name= ), (filename= ), MIME,,?? Content-Disposition: form-data; name="name" (name),, name name?? Content-Disposition: form-data; name="binary"; filename="d:\temp \bigpenguingif" (ninary), name binary, Java Servlet Programming from Yongwoo s Park 27

28 filename "D:\Temp\bigpenguingif"?? Content-Type: image/gif MIME MIME image/gif,,, cf1124e07da-- -, ID --,, HTTP HTML HTTP HTML <HTML> <HEAD> <TITLE>File Upload</TITLE> </HEAD> <BODY> <H1> </H1> <P> <FORM method="post" action=" FileUploadServlet " enctype=multipart/form-data> : <input type="text" name="name" size=16><br> : <input type="file" name="binary"><br> <input type="submit" value=" "> </FORM> </BODY> </HTML> /* * Java Servlet Programming from Yongwoo s Park 28

29 */ < 8 FileUploadServlethtml> import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class FileUploadServlet extends HttpServlet { public void dopost(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); /* OutputStreamWriter osw = new OutputStreamWriter(resgetOutputStream(); PrintWriter out = new PrintWriter(osw, "KSC5601") ); */ try { MultipartRequest multi = new MultipartRequest(req, "", 5*1024*1024); outprintln("<html>"); outprintln("<head><title>file Upload</TITLE></HEAD>"); outprintln("<body>"); outprintln("<h1> </H1>"); outprintln("<h3>params:</h3>"); outprintln("<pre>"); Enumeration params = multigetparameternames(); while(paramshasmoreelements()) { String name = (String)paramsnextElement(); String value = multigetparameter(name); outprintln(name + " = " + value); outprintln("</pre>"); outprintln("<h3>files:</h3>"); outprintln("<pre>"); Enumeration files = multigetfilenames(); while(fileshasmoreelements()) { Java Servlet Programming from Yongwoo s Park 29

30 String name = (String)filesnextElement(); String filename = multigetfilesystemname(name); String type = multigetcontenttype(name); File f = multigetfile(name); outprintln("name: " + name); outprintln("filename: " + filename); outprintln("type: " + type); if(f!= null) { outprintln("length: " + flength()); outprintln(); outprintln("</pre>"); catch(exception e) { outprintln("<pre>"); eprintstacktrace(out); outprintln("</pre>"); outprintln("</body></html>"); /* * */ < 9 FileUploadServletjava> import javaio*; import javautil*; import javaxservlet*; public class MultipartRequest { Java Servlet Programming from Yongwoo s Park 30

31 private static final int DEFAULT_MAX_POST_SIZE=1024*1024; // 1 Mega private ServletRequest req; private File dir; private int maxlen; private Hashtable parameters = new Hashtable(); // name - value private Hashtable files = new Hashtable(); // name - UploadedFile public MultipartRequest(ServletRequest req, String uploaddir) throws IOException { this(req, uploaddir, DEFAULT_MAX_POST_SIZE); public MultipartRequest(ServletRequest req, String uploaddir, int maxlen) throws IOException { // Sanity check values if(req == null) { throw new IllegalArgumentException("request cannot be null"); if(uploaddir == null) { throw new IllegalArgumentException("saveDirectory cannot be null"); if(maxlen <= 0) { throw new IllegalArgumentException("maxPostSize must be positive"); // Save the request, dir, and max size thisreq = req; dir = new File(uploadDir); thismaxlen = maxlen; // Check savedirectory is truly a directory if(!dirisdirectory()) { throw new IllegalArgumentException("Not a directory: " + uploaddir); // Check savedirectory is writable if(!dircanwrite()) { throw new IllegalArgumentException("Not writable: " + uploaddir); // Now parse the request saving data to "parameters" and "files"; // write the file contents to the savedirectory readrequest(); public Enumeration getparameternames() { return parameterskeys(); public Enumeration getfilenames() { return fileskeys(); public String getparameter(string name) { try { String param =(String)parametersget(name); if(""equals(param)) { return(null); return(param); catch(exception e) { return(null); Java Servlet Programming from Yongwoo s Park 31

32 public String getfilesystemname(string name) { try { UploadedFile file =(UploadedFile)filesget(name); return(filegetfilesystemname()); // may be null catch(exception e) { return null; public String getcontenttype(string name) { try { UploadedFile file =(UploadedFile)filesget(name); return(filegetcontenttype()); // may be null catch(exception e) { return(null); public File getfile(string name) { try { UploadedFile file =(UploadedFile)filesget(name); return(filegetfile()); // may be null catch(exception e) { return(null); protected void readrequest() throws IOException { String type = reqgetcontenttype(); if((type == null) (!typetolowercase()startswith("multipart/form-data"))) { throw new IOException("Posted content type isn't multipart/form-data"); // Check the content length to prevent denial of service attacks int len = reqgetcontentlength(); if(len > maxlen) { throw new IOException("Content length: "+len+", Limit: "+maxlen); // Get the boundary string; it's included in the content type // Should look something like " " String boundary = extractboundary(type); if(boundary == null) { throw new IOException("Separation boundary was not specified"); // Construct the special input stream we'll read from MultipartInputStreamHandler in = new MultipartInputStreamHandler(reqgetInputStream(), boundary, len); // Read the first line, should be the first boundary String line = inreadline(); if(line == null) { throw new IOException("Corrupt form data: premature ending"); Java Servlet Programming from Yongwoo s Park 32

33 // Verify that the line is the boundary if(!linestartswith(boundary)) { throw new IOException("Corrupt form data: no leading boundary"); // Now that we're just beyond the first boundary, loop over each part boolean done = false; while(!done) { done = readnextpart(in, boundary); protected boolean readnextpart(multipartinputstreamhandler in, String boundary) throws IOException { // Read the first line, should look like this: // content-disposition: form-data; name="field1"; filename="file1txt" String line = inreadline(); if(line == null) { // No parts left, we're done return(true); // Parse the content-disposition line String[] dispinfo = extractdispositioninfo(line); String disposition = dispinfo[0]; String name = dispinfo[1]; String filename = dispinfo[2]; // Now onto the next line This will either be empty // or contain a Content-Type and then an empty line line = inreadline(); if(line == null) { // No parts left, we're done return(true); // Get the content type, or null if none specified String contenttype = extractcontenttype(line); if(contenttype!= null) { // Eat the empty line line = inreadline(); if((line == null) (linelength() > 0)) { // line should be empty throw new IOException("Malformed line after content type: " + line); else { // Assume a default content type contenttype = "application/octet-stream"; // Now, finally, we read the content(end after reading the boundary) if(filename == null) { // This is a parameter String value = readparameter(in, boundary); parametersput(name, value); else { // This is a file readandsavefile(in, boundary, filename); if("unknown"equals(filename)) { filesput(name, new UploadedFile(null, null, null)); else { filesput(name, new UploadedFile(dirtoString(), filename, contenttype)); Java Servlet Programming from Yongwoo s Park 33

34 return(false); // there's more to read protected String readparameter(multipartinputstreamhandler in, String boundary) throws IOException { StringBuffer sbuf = new StringBuffer(); String line; while((line = inreadline())!= null) { if(linestartswith(boundary)) { break; sbufappend(line + "\r\n"); // add the \r\n in case there are many lines if(sbuflength() == 0) { return(null); // nothing read sbufsetlength(sbuflength() - 2); // cut off the last line's \r\n return(sbuftostring()); // no URL decoding needed protected void readandsavefile(multipartinputstreamhandler in, String boundary, String filename) throws IOException { File f = new File(dir + Fileseparator + filename); FileOutputStream fos = new FileOutputStream(f); BufferedOutputStream out = new BufferedOutputStream(fos, 8 * 1024); // 8K byte[] bbuf = new byte[100*1024]; // 100K int result; String line; // ServletInputStreamreadLine() has the annoying habit of // adding a \r\n to the end of the last line // Since we want a byte-for-byte transfer, we have to cut those chars boolean rnflag = false; while((result = inreadline(bbuf, 0, bbuflength))!= -1) { // Check for boundary if(result > 2 && bbuf[0] == '-' && bbuf[1] == '-') { // quick pre-check line = new String(bbuf, 0, result, "ISO "); if(linestartswith(boundary)) { break; // Are we supposed to write \r\n for the last iteration? if(rnflag) { outwrite('\r'); outwrite('\n'); rnflag = false; // Write the buffer, postpone any ending \r\n if((result>=2)&&(bbuf[result-2]=='\r')&&(bbuf[result-1]=='\n')) { outwrite(bbuf, 0, result - 2); // skip the last 2 chars rnflag = true; // make a note to write them on the next iteration else { outwrite(bbuf, 0, result); outflush(); Java Servlet Programming from Yongwoo s Park 34

35 outclose(); fosclose(); // Extracts and returns the boundary token from a line // private String extractboundary(string line) { int index = lineindexof("boundary="); if(index == -1) { return null; String boundary = linesubstring(index + 9); // 9 for "boundary=" // The real boundary is always preceeded by an extra "--" boundary = "--" + boundary; return boundary; // Extracts and returns disposition info from a line, as a String array // with elements: disposition, name, filename Throws an IOException // if the line is malformatted // private String[] extractdispositioninfo(string line) throws IOException { // Return the line's data as an array: disposition, name, filename String[] retval = new String[3]; // Convert the line to a lowercase string without the ending \r\n // Keep the original line for error messages and for variable names String origline = line; line = origlinetolowercase(); // Get the content disposition, should be "form-data" int start = lineindexof("content-disposition: "); int end = lineindexof(";"); if(start == -1 end == -1) { throw new IOException("Content disposition corrupt: " + origline); String disposition = linesubstring(start + 21, end); if(!dispositionequals("form-data")) { throw new IOException("Invalid content disposition: " + disposition); // Get the field name start = lineindexof("name=\"", end); // start at last semicolon end = lineindexof("\"", start + 7); // skip name=\" if(start == -1 end == -1) { throw new IOException("Content disposition corrupt: " + origline); String name = origlinesubstring(start + 6, end); // Get the filename, if given String filename = null; start = lineindexof("filename=\"", end + 2); // start after name end = lineindexof("\"", start + 10); // skip filename=\" if(start!= -1 && end!= -1) { // note the!= filename = origlinesubstring(start + 10, end); // The filename may contain a full path Cut to just the filename int slash = Mathmax(filenamelastIndexOf('/'), filenamelastindexof('\\')); if(slash > -1) { filename = filenamesubstring(slash + 1); // past last slash Java Servlet Programming from Yongwoo s Park 35

36 if(""equals(filename)) { filename = "unknown"; // sanity check // Return a String array: disposition, name, filename retval[0] = disposition; retval[1] = name; retval[2] = filename; return(retval); // Extracts and returns the content type from a line, or null if the // line was empty Throws an IOException if the line is malformatted // private String extractcontenttype(string line) throws IOException { String contenttype = null; // Convert the line to a lowercase string String origline = line; line = origlinetolowercase(); // Get the content type, if any if(linestartswith("content-type")) { int start = lineindexof(" "); if(start == -1) { throw new IOException("Content type corrupt: " + origline); contenttype = linesubstring(start + 1); else if(linelength()!= 0) { // no content type, so should be empty throw new IOException("Malformed line after disposition: " + origline); return contenttype; // A class to hold information about an uploaded file // class UploadedFile { private String dir; private String filename; private String type; UploadedFile(String dir, String filename, String type) { thisdir = dir; thisfilename = filename; thistype = type; public String getcontenttype() { return(type); public String getfilesystemname() { return(filename); public File getfile() { if(dir == null filename == null) { Java Servlet Programming from Yongwoo s Park 36

37 return(null); else { return(new File(dir + Fileseparator + filename)); // A class to aid in reading multipart/form-data from a ServletInputStream // It keeps track of how many bytes have been read and detects when the // Content-Length limit has been reached This is necessary since some // servlet engines are slow to notice the end of stream // class MultipartInputStreamHandler { ServletInputStream in; String boundary; int totalexpected; int totalread = 0; byte[] buf = new byte[8 * 1024]; public MultipartInputStreamHandler(ServletInputStream in, String boundary, int totalexpected) { this in = in; thisboundary = boundary; thistotalexpected = totalexpected; // Reads the next line of input Returns null to indicate the end // of stream // public String readline() throws IOException { StringBuffer sbuf = new StringBuffer(); int result; String line; do { result = thisreadline(buf, 0, buflength); // thisreadline() does += if(result!= -1) { sbufappend(new String(buf, 0, result)); //, "ISO ")); while(result == buflength); // loop only if the buffer was filled if(sbuflength() == 0) { return(null); // nothing read, must be at the end of stream sbufsetlength(sbuflength() - 2); // cut off the trailing \r\n return(sbuftostring()); // A pass-through to ServletInputStreamreadLine() that keeps track // of how many bytes have been read and stops reading when the // Content-Length limit has been reached // public int readline(byte b[], int off, int len) throws IOException { if(totalread >= totalexpected) { return(-1); else { int result = inreadline(b, off, len); if(result > 0) { totalread += result; Java Servlet Programming from Yongwoo s Park 37

38 return(result); public static String toksc5601(string str) throws UnsupportedEncodingException { if(str == null) { return(null); return(new String(strgetBytes("8859_1"), "KSC5601")); < 10 MultipartRequestjava> Cookie,,,, (commnent), (path and domain qualifiers), (maximum age), (version number) HTTP-Response Header Set-Cookie Cookie, Set-Cookie: NAME=VALUE; expires=date; path=path; domain=domain_name; secure 7, NAME=VALUE, Java Servlet Programming from Yongwoo s Park 38

39 Set-Cookie: NAME=VALUE; expires=date;,,,,, WINDOW_ROOT\\Profiles\\ ID\\Cookie domain=domain_name;, path=path; Secure, secure SSL, HTTP HttpServletResponse addcookie, HttpServletResponse addcookie HTTP (HTTP response headers) 20, 4KB HTTP (HTTP request headers), HttpServletRequest getcookies Cookie, Netscape 0 RFC Cookie, Cookie(javalangString name, javalangstring value): javalangstring getcomment(): javalangstring getdomain(): int getmaxage(): javalangstring getname(): javalangstring getpath(): boolean getsecure(): javalangstring getvalue(): Java Servlet Programming from Yongwoo s Park 39

40 int getversion(): void setcomment(javalangstring purpose): version 0 void setdomain(javalangstring pattern): void setmaxage(int expiry): void setpath(javalangstring uri): void setsecure(boolean flag): HTTPS SSL void setvalue(javalangstring newvalue): void setversion(int v):,,, <HTML> <HEAD> <META http-equiv="content-type" content="text/html; charset=euc-kr"> <TITLE>Login</TITLE> </HEAD> <BODY> <H1> </H1> <P> <FORM action=" method="post"> USER: <input type=text name=user><br> PASS: <input type=password name=pass><br> <input type=submit value="login"> </FORM> </BODY> </HTML> /* * Java Servlet Programming from Yongwoo s Park 40

41 */ < 11 Loginhtml> import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class LoginServlet extends HttpServlet { public void dopost(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html;charset=euc-kr"); PrintWriter out = resgetwriter(); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>login</title>"); outprintln("</head>"); outprintln("<body>"); String user = reqgetparameter("user"); user = new String(usergetBytes("ISO "), "EUC-KR"); String pass = reqgetparameter("pass"); if(("park"equals(user)) && ("Park"equals(pass))) { Cookie logincookie = new Cookie("BBS-Park", "Login"); Cookie usercookie = new Cookie("Username", user); resaddcookie(logincookie); resaddcookie(usercookie); outprintln("<h1> </H1><BR>"); outprintln("<a HREF=\" "); else { outprintln("<h1> </H1><BR>"); outprintln("<a HREF=\"/Loginhtml\"> "); outprintln("</body>"); outprintln("</html>"); Java Servlet Programming from Yongwoo s Park 41

42 /* * outclose(); */ < 12 LoginServletjava> import javaio*; import javaxservlet*; import javaxservlethttp*; public class StartServiceServlet extends HttpServlet { public void doget(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>hello</title>"); outprintln("</head>"); outprintln("<body>"); int match=0; String user = null; boolean login=false; Cookie[] cookies = reqgetcookies(); if(cookies!= null) { for(int i=0;i<cookieslength;i++) { if(("bbs-park"equals(cookies[i]getname())) && ("Login"equals(cookies[i]getValue()))) { login = true; match++; else if("username"equals(cookies[i]getname())) { user = cookies[i]getvalue(); match++; if(match >= 2) { break; Java Servlet Programming from Yongwoo s Park 42

43 outprintln("<center>"); if(login) { outprintln("<h2> "+user+"!</h2>"); outprintln("<h3> </H3>"); else { outprintln("<h2> </H2><BR>"); outprintln("<a HREF=\"/Loginhtml\"> "); outprintln("</body>"); outprintln("</html>"); /* * public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { doget(req, res); 1) 2) ( ) */ < 13 LoginServletjava> Java Servlet Programming from Yongwoo s Park 43

44 , Loginhtml: HTML LoginServletjava: HTML,, StartServiceServletjava:,, HTML,, HttpSession,,,, ( ),,, ( ), HttpSession (session identifier), (creation time ), (session context) HttpSession, javalangstring getid(): ID long getcreationtime(): January 1, 1970 GMT long getlastaccessedtime(): int getmaxinactiveinterval(): Java Servlet Programming from Yongwoo s Park 44

45 javalangobject getvalue(javalangstring name ): javalangstring[] getvaluenames(): void invalidate():, boolean isnew(): void putvalue(javalangstring name, javalangobject value): void removevalue(javalangstring name): void setmaxinactiveinterval(int interval): HttpSessionBindingListener HttpSessionBindingListener HttpSessionBindingEvent HttpSessionBindingListener void valuebound(httpsessionbindingevent event): void valueunbound(httpsessionbindingevent event): HttpSessionBindingEvent HttpSessionBindingListener, HttpSession putvalue, HttpSession removevalue HttpSessionBindingEvent Java Servlet Programming from Yongwoo s Park 45

46 , HttpSessionBindingEvent(HttpSession session, javalangstring name): javalangstring getname(): HttpSession getsession(): HTTP HTTP, (persistence),,,, HttpSession,,, HTTP import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class SessionSnoop extends HttpServlet { public void doget(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html;charset=euc-kr"); PrintWriter out = resgetwriter(); HttpSession session = reqgetsession(true); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>session Snoop</TITLE>"); outprintln("</head>"); Java Servlet Programming from Yongwoo s Park 46

47 outprintln("<body>"); outprintln("<h1>session Snoop</H1>"); Integer count = (Integer)sessiongetValue("SessionSnoopCount"); if(count == null) { count = new Integer(1); else { count = new Integer(countintValue() + 1); sessionputvalue("sessionsnoopcount", count); outprintln(" : "+count+"<br>"); outprintln("<p>"); outprintln("<h3> :</H3>"); String[] names = sessiongetvaluenames(); for(int i=0;i<nameslength;i++) { outprintln(names[i]+": "+sessiongetvalue(names[i])+"<br>"); outprintln("<h3> :</H3>"); outprintln(" ID: " + sessiongetid() + "<BR>"); outprintln(" : " + sessionisnew() + "<BR>"); outprintln(" : " + sessiongetcreationtime()); outprintln("<i>(" + new Date(sessiongetCreationTime()) + ")</I><BR>"); outprintln(" : " + sessiongetlastaccessedtime()); outprintln("<i>(" + new Date(sessiongetLastAccessedTime()) + ")</I><BR>"); outprintln(" ( ): " + reqisrequestedsessionidfromcookie() + "<BR>"); outprintln(" (URL): " + reqisrequestedsessionidfromurl() + "<BR>"); outprintln(" : " + reqisrequestedsessionidvalid() + "<BR>"); outprintln("<a HREF=\""+resencodeURL(reqgetRequestURI())+"\">"); outprintln("url </A>"); /* * outprintln("</body>"); outprintln("</html>"); 1) Java Servlet Programming from Yongwoo s Park 47

48 */ < 14 LoginServletjava> HTTP import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class SessionSnoop extends HttpServlet { public void doget(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html;charset=euc-kr"); PrintWriter out = resgetwriter(); HttpSession session = reqgetsession(true); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>session Snoop</TITLE>"); outprintln("</head>"); outprintln("<body>"); outprintln("<h1>session Snoop</H1>"); Integer count = (Integer)sessiongetValue("SessionSnoopCount"); if(count == null) { count = new Integer(1); else { Java Servlet Programming from Yongwoo s Park 48

49 count = new Integer(countintValue() + 1); sessionputvalue("sessionsnoopcount", count); outprintln(" : "+count+"<br>"); outprintln("<p>"); outprintln("<h3> :</H3>"); String[] names = sessiongetvaluenames(); for(int i=0;i<nameslength;i++) { outprintln(names[i]+": "+sessiongetvalue(names[i])+"<br>"); outprintln("<h3> :</H3>"); outprintln(" ID: " + sessiongetid() + "<BR>"); outprintln(" : " + sessionisnew() + "<BR>"); outprintln(" : " + sessiongetcreationtime()); outprintln("<i>(" + new Date(sessiongetCreationTime()) + ")</I><BR>"); outprintln(" : " + sessiongetlastaccessedtime()); outprintln("<i>(" + new Date(sessiongetLastAccessedTime()) + ")</I><BR>"); outprintln(" ( ): " + reqisrequestedsessionidfromcookie() + "<BR>"); outprintln(" (URL): " + reqisrequestedsessionidfromurl() + "<BR>"); outprintln(" : " + reqisrequestedsessionidvalid() + "<BR>"); outprintln("<a HREF=\""+resencodeURL(reqgetRequestURI())+"\">"); outprintln("url </A>"); /* * outprintln("</body>"); outprintln("</html>"); 1) Java Servlet Programming from Yongwoo s Park 49

50 */ < 15 SessionSnoopjava>, HttpSession HttpServletRequest getsession(boolean), boolean HttpSession true HttpSession true HttpSession, isnew, 30, 30,, HttpSession, ( SessionSnopcount), HTTP import javaio*; import javaxservlet*; import javaxservlethttp*; public class ShoppingCartServlet extends HttpServlet { public void doget(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html;charset=euc-kr"); Java Servlet Programming from Yongwoo s Park 50

51 PrintWriter out = resgetwriter(); HttpSession session = reqgetsession(true); outprintln("<html>"); outprintln("<body>"); outprintln("<head>"); outprintln("<title>park Home Shopping</TITLE>"); outprintln("</head>"); outprintln("<body>"); outprintln("<h1> </H1><BR>"); String shoppingitems[] = { "Mouse", "Keyboard", "Monitor", "Speaker", "CDROM", "Floppy Disk", "Hard Disk", "Network Adapter", "Modem", "VGA Adapter", "Printer", "Case" ; int shoppingchecks[] = { 10000, 10000, , 30000, 70000, 15000, , 50000, 40000, , , ; String shoppingstep = reqgetparameter("shoppingstep"); if("checkout"equals(shoppingstep)) { String[] items = (String[])sessiongetValue("ShorppingCartitems"); if(items == null) { outprintln("<h2> </H2>"); sessionputvalue("shorppingcartcheck", new Integer(0)); else { int check=0; outprintln(" :<BR>"); outprintln("<ul>"); for(int i=0;i<itemslength;i++) { outprintln("<li>"+items[i]); for(int j=0;j<shoppingitemslength;j++) { if(shoppingitems[j]equals(items[i])) { check += shoppingchecks[j]; outprintln("</ul>"); sessionputvalue("shorppingcartcheck", new Integer(check)); Integer i = (Integer)sessiongetValue("ShorppingCartcheck"); outprintln("<h2> "+i+" </H2>"); else { if("additem"equals(shoppingstep)) { String addeditems[] = reqgetparametervalues("addeditems"); if(addeditems == null) { outprintln("<h2> </H2>"); else { String olditems[] = (String[])sessiongetValue("ShorppingCartitems"); String newitems[] = null; int addedcount = 0; if(olditems!= null) { newitems = new String[oldItemslength+addedItemslength]; for(int i=0;i<olditemslength;i++) { newitems[addedcount++] = olditems[i]; else { newitems = new String[addedItemslength]; Java Servlet Programming from Yongwoo s Park 51

52 for(int i=0;i<addeditemslength;i++) { newitems[addedcount++] = addeditems[i]; sessionputvalue("shorppingcartitems", newitems); String[] items = (String[])sessiongetValue("ShorppingCartitems"); if(items == null) { outprintln("<b> </B>"); else { outprintln(" :<BR>"); outprintln("<ul>"); for(int i=0;i<itemslength;i++) { outprintln("<li>"+items[i]); outprintln("</ul>"); outprintln("<form ACTION=\" METHOD=POST>"); outprintln(" <input type=hidden name=shoppingstep value=additem multiple>"); outprintln(" <select name=\"addeditems\" size=4 multiple>"); for(int i=0;i<shoppingitemslength;i++) { outprintln(" <option value=\""+shoppingitems[i]+"\">"+shoppingitems[i]); outprintln(" </select>"); outprintln(" <input type=submit value=\" \">"); outprintln("</form>"); outprintln("<form ACTION=\" METHOD=POST>"); outprintln(" <input type=hidden name=shoppingstep value=checkout multiple>"); outprintln(" <input type=submit value=\" \">"); outprintln("</form>"); outprintln("</body>"); outprintln("</html>"); outclose(); /* * public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { doget(req, res); Java Servlet Programming from Yongwoo s Park 52

53 */ < 16 ShoppingCartServletjava> HTTP, FORM HIDDEN URL, GET, POST POST 8 Java Servlet Programming from Yongwoo s Park 53

54 9, 10 HttpUtils HTTP Java Servlet Programming from Yongwoo s Park 54

55 HttpUtils, HttpUtils(): HttpUtils static javalangstringbuffer getrequesturl(httpservletrequest req): HttpServletRequest URL static javautilhashtable parsepostdata(int len, ServletInputStream in): HTTP POST application/x-www-form-urlencoded MIME HTML static javautilhashtable parsequerystring(javalangstring s):, getrequesturl URL, getquerystring GET HTTP, parsepostdata POST, getquerystring GET = (key) (value) Hashtable, parsepostdata POST = Hashtable,,, HTML FORM CGI,, servletproperties, HTML <HTML> <HEAD><TITLE>GuestBook</TITLE></HEAD> <BODY> <CENTER> Java Servlet Programming from Yongwoo s Park 55

56 <H1> </H1> <FORM action= method=post> <input type=hidden name=function value=write> <center> <table bgcolor=#faeddc cellspacing=0 cellpadding=6> <tr> <td><br><input type=text name=author size=10></td> <td><br><input type=text name=phone size=14></td> </tr> <tr><td colspan=2> <br><input type=text name=title size=40></td></tr></td></tr> <tr><td colspan=2> <br><textarea name=content rows=3 cols=40></textarea></td></tr> <tr> <td>html<br><input type=text name=html size=30></td> <td> <br><input type=text name=e_mail size=30></td> </tr> <tr> <br> <td align=right><input type=reset value= ></td> <td align=left> <input type=submit value= ></td> </tr> </table> </FORM> </BODY> </HTML> /* * */ < 17 GuestBookhtml> Java Servlet Programming from Yongwoo s Park 56

57 import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class GuestBookServlet extends HttpServlet implements SingleThreadModel { String guestbookpath; public void init(servletconfig config) throws ServletException { superinit(config); guestbookpath = getinitparameter("guestbookpath"); if(guestbookpath == null) { Enumeration initparams = getinitparameternames(); Systemerrprintln(" : "); while(initparamshasmoreelements()) { Systemerrprintln(initParamsnextElement()); Systemerrprintln(" "); throw new UnavailableException (this, "!"); public void doget(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); outprintln("<html>"); outprintln("<head>"); outprintln("<title>writing</title>"); outprintln("</head>"); outprintln("<body>"); try { String functionstr = reqgetparametervalues("function")[0]; if(functionstrequalsignorecase("write")) { // FileWriter guestbookfile = new FileWriter(guestBookPath, true); // PrintWriter tofile = new PrintWriter(guestBookFile); tofileprintln("<begin>"); TimeZone tz = new SimpleTimeZone(9*60*60*1000, "KST"); //, Date today = new Date(); TimeZonesetDefault(tz); tofileprintln("date: " + todaytostring()); Enumeration values = reqgetparameternames(); // while(valueshasmoreelements()) { String name = (String)valuesnextElement(); String value = reqgetparametervalues(name)[0]; Java Servlet Programming from Yongwoo s Park 57

58 if(namecompareto("submit")!= 0) { tofileprintln(name + ": " + toksc5601(value)); tofileprintln("<end>"); guestbookfileclose(); outprintln("<h1>"); outprintln("success"); outprintln("</h1>"); else { outprintln("<h1>"); outprintln("fail" + functionstr + "" + guestbookpath); outprintln("</h1>"); catch(ioexception e) { // eprintstacktrace(); outprintln("<h1>"); outprintln(" "); outprintln("</h1>"); outprintln("</body>"); outprintln("</html>"); outclose(); public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { doget(req, res); public static String toksc5601( String str ) throws UnsupportedEncodingException { if(str == null) { return(null); return(new String(strgetBytes("8859_1"), "KSC5601")); /* * */ < 18 GuestBookServletjava> Java Servlet Programming from Yongwoo s Park 58

59 servletproperties # $Id: servletsproperties,v /04/02 02:04:22 duncan Exp $ # Define servlets here # <servletname>code=<servletclass> # <servletname>initparams=<name=value>,<name=value> snoopcode=snoopservlet snoopinitparams=initarg1=foo,initarg2=bar snoop2code=snoopgenericservlet snoop2initparams=initarg1=foo,initarg2=bar hellocode=hellogenericservlet helloinitparams=name=yongwoo's Park hello2code=hellogenericservlet2 hello2initparams= jspcode=comsunjspruntimejspservlet # guestbook servlet # # D:\\Java\\jsdk21\\webpages\\guestbook\\GuestBooktxt guestbookcode=guestbookservlet guestbookinitparams=guestbookpath=d:\\java\\jsdk21\\webpages\\guestbook\\guestbooktxt < 19 servletsproperties > <BEGIN> Date: Wed Oct 27 04:00:55 GMT+09: HTML: Author: Title: Phone: 02-22xx-xxxx Content: ~ E_Mail: ywpark@csekonkukackr Function: Write <END> < 20 D:\\Java\\jsdk21\\webpages\\guestbook\\GuestBooktxt > Java Servlet Programming from Yongwoo s Park 59

60 , SMTP(Simple Mail Transfer Protocol), SMTP,,, (SUBJECT), ( ),,, HTML FORM CGI,, servletproperties, HTML <HTML> <HEAD><TITLE>Send Mail</TITLE></HEAD> <BODY> <CENTER> <H1> </H1> <FORM action= method=post> <table bgcolor=#faeddc cellspacing=0 cellpadding=6> <tr> <td> <br><input type=text name=mailfrom size=40></td> <td><br><input type=text name=rtcpto size=40></td> </tr> <tr><td colspan=2> <br><input type=text name=subject size=40></td></tr></td></tr> <tr><td colspan=2> <br><textarea name=body rows=3 cols=60></textarea></td></tr> <tr> <br> <td align=right><input type=reset value= ></td> <td align=left> <input type=submit value= ></td> </tr> </table> </FORM> </BODY> </HTML> Java Servlet Programming from Yongwoo s Park 60

61 /* * */ < 21 SendMailServlethtml> SMTP import javaio*; import javanet*; import javautil*; import javaxservlet*; import javaxservlethttp*; public class SendMailServlet extends HttpServlet implements SingleThreadModel { String smtpserver; PrintStream ps = null; BufferedReader dis = null; public void init(servletconfig config) throws ServletException { superinit(config); smtpserver = getinitparameter("smtpserver"); if(smtpserver == null) { Enumeration initparams = getinitparameternames(); Systemerrprintln(" : "); while(initparamshasmoreelements()) { Systemerrprintln(initParamsnextElement()); Systemerrprintln("SMTP "); Java Servlet Programming from Yongwoo s Park 61

62 throw new UnavailableException (this, "Not given a SMTP server to send a mail!"); public void doget(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException { ressetcontenttype("text/html; charset=euc-kr"); PrintWriter out = resgetwriter(); outprintln("<html>"); outprintln("<head>"); outprintln("<title>send Mail</TITLE>"); outprintln("</head>"); outprintln("<body>"); String END_OF_DATA = "\r\n\r\n"; Socket smtp = null; try { smtp = new Socket(smtpServer, 25); // SMTP 25 OutputStream os = smtpgetoutputstream(); ps = new PrintStream(os); InputStream is = smtpgetinputstream(); dis = new BufferedReader(new InputStreamReader(is)); catch(ioexception e) { Systemoutprintln("Error connecting: " + e); String mailfrom = toksc5601(reqgetparameter("mailfrom")); String rcptto = toksc5601(reqgetparameter("rtcpto")); String subject = toksc5601(reqgetparameter("subject")); String body = toksc5601(reqgetparameter("body")); outprintln("<h1>"); if(mailfrom == null rcptto == null subject == null body == null) { outprintln("mailfrom or rtcpto or subject or body is empty"); else { try { String localhost = InetAddressgetLocalHost()getHostName(); // Local send("helo " + localhost); receive(); send("mail FROM: " + mailfrom); receive(); send("rcpt TO: " + rcptto); receive(); send("data"); receive(); send("subject: " + subject); receive(); send(body+end_of_data); receive(); send("quit"); receive(); smtpclose(); outprintln(" "); catch(ioexception e) { outprintln(" "); outprintln("</h1>"); outprintln("</body>"); outprintln("</html>"); Java Servlet Programming from Yongwoo s Park 62

63 outclose(); void send(string s) throws IOException { psprintln(s); psflush(); Systemoutprintln("Java request: " + s); void receive() throws IOException { String readstr = disreadline(); Systemoutprintln("SMTP response: " + readstr); public void dopost(httpservletrequest req, HttpServletResponse res) throws IOException, ServletException { doget(req, res); public static String toksc5601( String str ) throws UnsupportedEncodingException { if(str == null) { return(null); return(new String(strgetBytes("8859_1"), "KSC5601")); /* * */ < 22 SendMailServletjava> SMTP servletproperties # $Id: servletsproperties,v /04/02 02:04:22 duncan Exp $ # Define servlets here # <servletname>code=<servletclass> # <servletname>initparams=<name=value>,<name=value> Java Servlet Programming from Yongwoo s Park 63

14-Servlet

14-Servlet JAVA Programming Language Servlet (GenericServlet) HTTP (HttpServlet) 2 (1)? CGI 3 (2) http://jakarta.apache.org JSDK(Java Servlet Development Kit) 4 (3) CGI CGI(Common Gateway Interface) /,,, Client Server

More information

KYO_SCCD.PDF

KYO_SCCD.PDF 1. Servlets. 5 1 Servlet Model. 5 1.1 Http Method : HttpServlet abstract class. 5 1.2 Http Method. 5 1.3 Parameter, Header. 5 1.4 Response 6 1.5 Redirect 6 1.6 Three Web Scopes : Request, Session, Context

More information

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r Jakarta is a Project of the Apache

More information

JavaGeneralProgramming.PDF

JavaGeneralProgramming.PDF , Java General Programming from Yongwoo s Park 1 , Java General Programming from Yongwoo s Park 2 , Java General Programming from Yongwoo s Park 3 < 1> (Java) ( 95/98/NT,, ) API , Java General Programming

More information

chapter6.doc

chapter6.doc Chapter 6. http..? ID. ID....... ecrm(ebusiness )., ecrm.. Cookie.....,. 20, 300 4. JSP. Cookie API javax.servlet.http. 3. 1. 2. 3. API. Cookie(String name, String value). name value. setxxx. getxxx. public

More information

04장

04장 20..29 1: PM ` 199 ntech4 C9600 2400DPI 175LPI T CHAPTER 4 20..29 1: PM ` 200 ntech4 C9600 2400DPI 175LPI T CHAPTER 4.1 JSP (Comment) HTML JSP 3 home index jsp HTML JSP 15 16 17 18 19 20

More information

2장 변수와 프로시저 작성하기

2장  변수와 프로시저 작성하기 Chapter. RequestDispatcher 활용 요청재지정이란? RequestDispatcher 활용 요청재지정구현예제 Chapter.9 : RequestDispatcher 활용 1. 요청재지정이란? 클라이언트로부터요청받은 Servlet 프로그램이응답을하지않고다른자원에수행흐름을넘겨다른자원의처리결과를대신응답하는것또는다른자원의수행결과를포함하여응답하는것을요청재지정이라고한다.

More information

rmi_박준용_final.PDF

rmi_박준용_final.PDF (RMI) - JSTORM http://wwwjstormpekr (RMI)- Document title: Document file name: Revision number: Issued by: Document Information (RMI)- rmi finaldoc Issue Date: Status:

More information

12-file.key

12-file.key 11 (String).. java.lang.stringbuffer. s String s = "abcd"; s = s + "e"; a b c d e a b c d e ,., "910359,, " "910359" " " " " (token) (token),, (delimiter). java.util.stringtokenizer String s = "910359,,

More information

歯JavaExceptionHandling.PDF

歯JavaExceptionHandling.PDF (2001 3 ) from Yongwoo s Park Java Exception Handling Programming from Yongwoo s Park 1 Java Exception Handling Programming from Yongwoo s Park 2 1 4 11 4 4 try/catch 5 try/catch/finally 9 11 12 13 13

More information

Microsoft PowerPoint - 7강.pptx

Microsoft PowerPoint - 7강.pptx 컴퓨터과학과 김희천교수 학습개요 내장객체 pagecontext, application, out과내장객체의사용범위를의미하는 Scope에대해학습한다. pagecontext 객체는 JSP 페이지에대한정보관리기능을제공한다. application 객체를이용하여웹어플리케이션에대한정보를관리할수있으며 out 객체는 JSP 페이지가생성하는결과를출력할때사용되는스트림기능을수행한다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

More information

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770>

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770> i ii iii iv v vi 1 2 3 4 가상대학 시스템의 국내외 현황 조사 가상대학 플랫폼 개발 이상적인 가상대학시스템의 미래상 제안 5 웹-기반 가상대학 시스템 전통적인 교수 방법 시간/공간 제약을 극복한 학습동기 부여 교수의 일방적인 내용전달 교수와 학생간의 상호작용 동료 학생들 간의 상호작용 가상대학 운영 공지사항,강의록 자료실, 메모 질의응답,

More information

서블릿의라이프사이클 뇌를자극하는 JSP & Servlet

서블릿의라이프사이클 뇌를자극하는 JSP & Servlet 서블릿의라이프사이클 뇌를자극하는 JSP & Servlet Contents v 학습목표 서블릿클래스로부터서블릿객체가만들어지고, 서블릿객체가초기화되어서서블릿이되고, 서블릿이사용되고, 최종적으로소멸되기까지의전과정을서블릿의라이프사이클이라고한다. 이장에서는서브릿의라이프사이클에관련된프로그래밍기술을배워보자. v 내용 서블릿의라이프사이클 서블릿클래스의 init 메서드의 destroy

More information

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Crash Unity SDK... Log & Crash Search. - Unity3D v4.0 ios

More information

자바-11장N'1-502

자바-11장N'1-502 C h a p t e r 11 java.net.,,., (TCP/IP) (UDP/IP).,. 1 ISO OSI 7 1977 (ISO, International Standards Organization) (OSI, Open Systems Interconnection). 6 1983 X.200. OSI 7 [ 11-1] 7. 1 (Physical Layer),

More information

API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Docum

API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Docum API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 2012.11.23 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Document Distribution Copy Number Name(Role, Title) Date

More information

J2EE Concepts

J2EE Concepts ! Introduction to J2EE (1) - J2EE Servlet/JSP/JDBC iseminar.. 1544-3355 ( ) iseminar Chat. 1 Who Are We? Business Solutions Consultant Oracle Application Server 10g Business Solutions Consultant Oracle10g

More information

뇌를 자극하는 JSP & Servlet 슬라이드

뇌를 자극하는 JSP & Servlet 슬라이드 속성 & 리스너 JSP & Servlet 2/39 Contents 학습목표 클라이언트요청에의해서블릿이실행될때에컨테이너에의해제공되는내장객체의종류와역할, 그리고접근범위특성등을알아본다. 웹컴포넌트사이의데이터전달을위한내장객체에서의속성설정과이에따른이벤트처리방법에대해알아본다. 내용 서블릿의초기화환경을표현하는 ServletConfig 객체 웹애플리케이션의실행환경을표현하는

More information

01-OOPConcepts(2).PDF

01-OOPConcepts(2).PDF Object-Oriented Programming Concepts Tel: 02-824-5768 E-mail: hhcho@selabsoongsilackr? OOP (Object) (Encapsulation) (Message) (Class) (Inheritance) (Polymorphism) (Abstract Class) (Interface) 2 1 + = (Dependency)

More information

Microsoft PowerPoint - 04-UDP Programming.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt Chapter 4. UDP Dongwon Jeong djeong@kunsan.ac.kr http://ist.kunsan.ac.kr/ Dept. of Informatics & Statistics 목차 UDP 1 1 UDP 개념 자바 UDP 프로그램작성 클라이언트와서버모두 DatagramSocket 클래스로생성 상호간통신은 DatagramPacket 클래스를이용하여

More information

02 C h a p t e r Java

02 C h a p t e r Java 02 C h a p t e r Java Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22 CHAPTER

More information

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형 바에 제네릭스(generics)를 도입하기 위한 연구는 이미 8년 전인 1996년부터라고 한다. 실제로 자바에 제네릭스를 도입하 는 몇 가지 방안들이 논문으로 나오기 시작한 것이 1998년 초임을 감 안하면 무려 8년이 지난 후에야 자바 5.0에 전격 채택되었다는 것은 이것이 얼마나 어려운 일이었나 하는 것을 보여준다. 자바의 스펙을 결정하는 표준화 절차인

More information

뇌를 자극하는 JSP & Servlet 슬라이드

뇌를 자극하는 JSP & Servlet 슬라이드 서블릿의라이프사이클 JSP & Servlet 2/39 Contents 학습목표 서블릿클래스로부터서블릿객체가만들어지고, 서블릿객체가초기화되어서서블릿이되고, 서블릿이사용되고, 최종적으로소멸되기까지의전과정을서블릿의라이프사이클이라고한다. 이장에서는서브릿의라이프사이클에관련된프로그래밍기술을배워보자. 내용 서블릿의라이프사이클 서블릿클래스의 init 메서드의 destroy

More information

JMF2_심빈구.PDF

JMF2_심빈구.PDF JMF JSTORM http://wwwjstormpekr Issued by: < > Document Information Document title: Document file name: Revision number: Issued by: JMF2_ doc Issue Date: Status: < > raica@nownurinet

More information

웹 개발자를 위한 서블릿/JSP

웹 개발자를 위한 서블릿/JSP 2. HTTP 와서블릿 2.1 HTTP 이해하기 2.1.1 HTTP 동작방식 HTTP(Hypertext Transfer Protocol) 는웹서버와웹클라이언트웹브라우저간에통신하 ( ) 기위한프로토콜( 약속) 이다. CGI나서블릿프로그래밍을하기위해서는 HTTP 프로토콜을어느정도이해할필요성이있다. 이곳에서는간단하게 HTTP 프로토콜에대해알아보자. 웹브라우저는 HTTP

More information

JMF3_심빈구.PDF

JMF3_심빈구.PDF JMF JSTORM http://wwwjstormpekr Issued by: < > Revision: Document Information Document title: Document file name: Revision number: Issued by: JMF3_ doc Issue Date:

More information

Data Provisioning Services for mobile clients

Data Provisioning Services for mobile clients 11 장. 세션과쿠키 세션의원리 세션의기본개념 1. 세션의활용 접속중인웹브라우저각각에대응하여서로다른세션이생성되고활용 2/35 1. 세션의활용 세션의원리 세션의생성시점과종료시점 session 생성시기임의의웹브라우저부터의첫번째요청을처리할때 session이생성되고관련타이머가동작한다. session 소멸시기 1) 세션타이머가만료 2) 코드상에서명시적으로세션소멸 한명의브라우저사용자에대해지속적으로관리해야하는데이터저장장소로서세션을활용

More information

3ÆÄÆ®-14

3ÆÄÆ®-14 chapter 14 HTTP >>> 535 Part 3 _ 1 L i Sting using System; using System.Net; using System.Text; class DownloadDataTest public static void Main (string[] argv) WebClient wc = new WebClient(); byte[] response

More information

1217 WebTrafMon II

1217 WebTrafMon II (1/28) (2/28) (10 Mbps ) Video, Audio. (3/28) 10 ~ 15 ( : telnet, ftp ),, (4/28) UDP/TCP (5/28) centralized environment packet header information analysis network traffic data, capture presentation network

More information

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET 135-080 679-4 13 02-3430-1200 1 2 11 2 12 2 2 8 21 Connection 8 22 UniSQLConnection 8 23 8 24 / / 9 3 UniSQL 11 31 OID 11 311 11 312 14 313 16 314 17 32 SET 19 321 20 322 23 323 24 33 GLO 26 331 GLO 26

More information

Interstage5 SOAP서비스 설정 가이드

Interstage5 SOAP서비스 설정 가이드 Interstage 5 Application Server ( Solaris ) SOAP Service Internet Sample Test SOAP Server Application SOAP Client Application CORBA/SOAP Server Gateway CORBA/SOAP Gateway Client INTERSTAGE SOAP Service

More information

혼자서일을다하는 JSP. 이젠일을 Servlet 과나눠서한다. JSP와서블릿의표현적인차이 - JSP는 <html> 내에서자바를사용할수있는수단을제공한다. - 서블릿은자바내에서 <html> 을작성할수있는수단을제공한다. - JSP나서블릿으로만웹페이지를작성하면자바와다양한코드가

혼자서일을다하는 JSP. 이젠일을 Servlet 과나눠서한다. JSP와서블릿의표현적인차이 - JSP는 <html> 내에서자바를사용할수있는수단을제공한다. - 서블릿은자바내에서 <html> 을작성할수있는수단을제공한다. - JSP나서블릿으로만웹페이지를작성하면자바와다양한코드가 혼자서일을다하는 JSP. 이젠일을 Servlet 과나눠서한다. JSP와서블릿의표현적인차이 - JSP는 내에서자바를사용할수있는수단을제공한다. - 서블릿은자바내에서 을작성할수있는수단을제공한다. - JSP나서블릿으로만웹페이지를작성하면자바와다양한코드가웹페이지내에뒤섞여있어서웹페이지의화면설계가점점어려워진다. - 서블릿이먼저등장하였으나, 자바내에

More information

untitled

untitled Push... 2 Push... 4 Push... 5 Push... 13 Push... 15 1 FORCS Co., LTD A Leader of Enterprise e-business Solution Push (Daemon ), Push Push Observer. Push., Observer. Session. Thread Thread. Observer ID.

More information

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사) Java Program Performance Tuning ( ) n (Primes0) static List primes(int n) { List primes = new ArrayList(n); outer: for (int candidate = 2; n > 0; candidate++) { Iterator iter = primes.iterator(); while

More information

CD-RW_Advanced.PDF

CD-RW_Advanced.PDF HP CD-Writer Program User Guide - - Ver. 2.0 HP CD-RW Adaptec Easy CD Creator Copier, Direct CD. HP CD-RW,. Easy CD Creator 3.5C, Direct CD 3.0., HP. HP CD-RW TEAM ( 02-3270-0803 ) < > 1. CD...3 CD...5

More information

교육2 ? 그림

교육2 ? 그림 Interstage 5 Apworks EJB Application Internet Revision History Edition Date Author Reviewed by Remarks 1 2002/10/11 2 2003/05/19 3 2003/06/18 EJB 4 2003/09/25 Apworks5.1 [ Stateless Session Bean ] ApworksJava,

More information

Microsoft PowerPoint - aj-lecture3.ppt [호환 모드]

Microsoft PowerPoint - aj-lecture3.ppt [호환 모드] JSP 내장객체 JSP 내장객체 524730-1 2019 년봄학기 3/25/2019 박경신 내장객체 (Implicit Objects) JSP 페이지에서사용할수있도록 JSP 컨테이너에미리정의된객체 JSP 페이지가서블릿프로그램으로번역될때 JSP 컨테이너가자동으로내장객체를멤버변수, 매개변수등의각종참조변수 ( 객체 ) 로포함 JSP 페이지에별도의 import 문없이자유롭게사용가능

More information

<param-value> 파라미터의값 </param-value> </init-param> </servlet> <servlet-mapping> <url-pattern>/ 매핑문자열 </url-pattern> </servlet-mapping> - 위의예에서 ServletC

<param-value> 파라미터의값 </param-value> </init-param> </servlet> <servlet-mapping> <url-pattern>/ 매핑문자열 </url-pattern> </servlet-mapping> - 위의예에서 ServletC 내장객체의정리 헷갈리는내장객체들정리하기 - 컨테이너안에서는수많은객체들이스스로의존재목적에따라서일을한다. - ServletContext, ServletConfig 객체는컨텍스트초기화와서블릿초기화정보를가지고있다. - 이외에도다음의객체들이서블릿과 JSP와 EL에서각각의역할을수행한다. 서블릿의객체 JspWriter HttpServletRequest HttpServletResponse

More information

07 자바의 다양한 클래스.key

07 자바의 다양한 클래스.key [ 07 ] . java.lang Object, Math, String, StringBuffer Byte, Short, Integer, Long, Float, Double, Boolean, Character. java.util Random, StringTokenizer Calendar, GregorianCalendar, Date. Collection, List,

More information

신림프로그래머_클린코드.key

신림프로그래머_클린코드.key CLEAN CODE 6 11st Front Dev. Team 6 1. 2. 3. checked exception 4. 5. 6. 11 : 2 4 : java (50%), javascript (35%), SQL/PL-SQL (15%) : Spring, ibatis, Oracle, jquery ? , (, ) ( ) 클린코드를 무시한다면 . 6 1. ,,,!

More information

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드] - Socket Programming in Java - 목차 소켓소개 자바에서의 TCP 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 Q/A 에코프로그램 - EchoServer 에코프로그램 - EchoClient TCP Programming 1 소켓소개 IP, Port, and Socket 포트 (Port): 전송계층에서통신을수행하는응용프로그램을찾기위한주소

More information

Remote UI Guide

Remote UI Guide Remote UI KOR Remote UI Remote UI PDF Adobe Reader/Adobe Acrobat Reader. Adobe Reader/Adobe Acrobat Reader Adobe Systems Incorporated.. Canon. Remote UI GIF Adobe Systems Incorporated Photoshop. ..........................................................

More information

Microsoft PowerPoint - aj-lecture7.ppt [호환 모드]

Microsoft PowerPoint - aj-lecture7.ppt [호환 모드] Servlet 이해하기 웹 MVC 524730-1 2019 년봄학기 4/29/2019 박경신 Servlet 자바플랫폼에서컴포넌트기반의웹애플리케이션개발기술 JSP는서블릿기술에기반함 Servlet의프리젠테이션문제를해결하기위해 JSP가등장 이로인해웹애플리케이션의유지보수어려움심각. JSP 모델2가주목받으며다시서블릿에대한중요성부각 Servlet 변천 1 서블릿문제점대두

More information

NoSQL

NoSQL MongoDB Daum Communications NoSQL Using Java Java VM, GC Low Scalability Using C Write speed Auto Sharding High Scalability Using Erlang Read/Update MapReduce R/U MR Cassandra Good Very Good MongoDB Good

More information

Microsoft PowerPoint - 03-TCP Programming.ppt

Microsoft PowerPoint - 03-TCP Programming.ppt Chapter 3. - Socket in Java - 목차 소켓소개 자바에서의 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 에코프로그램 - EchoServer 에코프로그램 - EchoClient Q/A 1 1 소켓소개 IP,, and Socket 포트 (): 전송계층에서통신을수행하는응용프로그램을찾기위한주소 소켓 (Socket):

More information

뇌를 자극하는 JSP & Servlet 슬라이드

뇌를 자극하는 JSP & Servlet 슬라이드 쿠키와세션 JSP & Servlet 2/51 Contents 학습목표 셋이상의화면으로구성된웹애플리케이션을작성할때에는 JSP 페이지나서블릿클래스들이서로데이터를주고받도록만들어야할필요가있다. 이장에서는이럴때필요한쿠키와세션기술에대해알아보자. 내용 쿠키와세션 쿠키기술 세션기술 / HttpSession 3/50 1. 쿠키와세션 (1) 세션 (Session) - 정의 클라이언트의연속적인요청또는그요청에대한서비스기간

More information

09-interface.key

09-interface.key 9 Database insert(record r): boolean find(key k): Record 1 Record getkey(): Key * Record Key Database.? Key equals(key y): boolean Database insert(record r): boolean find(key k): Record * Database OK 1

More information

SRC PLUS 제어기 MANUAL

SRC PLUS 제어기 MANUAL ,,,, DE FIN E I N T R E A L L O C E N D SU B E N D S U B M O TIO

More information

chapter3.doc

chapter3.doc Chapter 3 : / Hello JSP Hello (?) Hello jsp List 31 hello jsp hellojsp jsp? html tag jsp jsp jsp 31 http://wwwjava2xmlcom hello jsp List 32

More information

JAVA Bean & Session - Cookie

JAVA Bean & Session - Cookie JAVA Bean & Session - Cookie [ 우주최강미남 ] 발표내용소개 자바빈 (Java Bean) 자바빈의개요 자바빈의설계규약 JSP 에서자바빈사용하기 자바빈의영역 세션과쿠키 (Session & Cookie) 쿠키의개요 쿠키설정 (HTTP 서블릿 API) 세션의개요 JSP 에서의세션관리 Java Bean Q. 웹사이트를개발한다는것과자바빈?? 웹사이트라는것은크게디자이너와프로그래머가함께개발합니다.

More information

JSP 의내장객체 response 객체 - response 객체는 JSP 페이지의실행결과를웹프라우저로돌려줄때사용되는객체이다. - 이객체는주로켄텐츠타입이나문자셋등의데이터의부가정보 ( 헤더정보 ) 나쿠키 ( 다음에설명 ) 등을지정할수있다. - 이객체를사용해서출력의방향을다른

JSP 의내장객체 response 객체 - response 객체는 JSP 페이지의실행결과를웹프라우저로돌려줄때사용되는객체이다. - 이객체는주로켄텐츠타입이나문자셋등의데이터의부가정보 ( 헤더정보 ) 나쿠키 ( 다음에설명 ) 등을지정할수있다. - 이객체를사용해서출력의방향을다른 JSP 의내장객체 response 객체 - response 객체는 JSP 페이지의실행결과를웹프라우저로돌려줄때사용되는객체이다. - 이객체는주로켄텐츠타입이나문자셋등의데이터의부가정보 ( 헤더정보 ) 나쿠키 ( 다음에설명 ) 등을지정할수있다. - 이객체를사용해서출력의방향을다른 URL로바꿀수있다. 예 ) response.sendredirect("http://www.paran.com");

More information

3장

3장 C H A P T E R 03 CHAPTER 03 03-01 03-01-01 Win m1 f1 e4 e5 e6 o8 Mac m1 f1 s1.2 o8 Linux m1 f1 k3 o8 AJAX

More information

Java Agent Plugin Guide

Java Agent Plugin Guide Java Agent Plugin Guide Whatap Support Version 1.0.2 Table of Contents Java Agent Plugin 가이드..................................................................................... 1 1. 에이전트옵션..........................................................................................

More information

다른 JSP 페이지호출 forward() 메서드 - 하나의 JSP 페이지실행이끝나고다른 JSP 페이지를호출할때사용한다. 예 ) <% RequestDispatcher dispatcher = request.getrequestdispatcher(" 실행할페이지.jsp");

다른 JSP 페이지호출 forward() 메서드 - 하나의 JSP 페이지실행이끝나고다른 JSP 페이지를호출할때사용한다. 예 ) <% RequestDispatcher dispatcher = request.getrequestdispatcher( 실행할페이지.jsp); 다른 JSP 페이지호출 forward() 메서드 - 하나의 JSP 페이지실행이끝나고다른 JSP 페이지를호출할때사용한다. 예 ) RequestDispatcher dispatcher = request.getrequestdispatcher(" 실행할페이지.jsp"); dispatcher.forward(request, response); - 위의예에서와같이 RequestDispatcher

More information

MasoJava4_Dongbin.PDF

MasoJava4_Dongbin.PDF JSTORM http://wwwjstormpekr Issued by: < > Revision: Document Information Document title: Document file name: MasoJava4_Dongbindoc Revision number: Issued by: < > SI, dbin@handysoftcokr

More information

Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 11 년 10 월 26 일수요일

Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 11 년 10 월 26 일수요일 Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 Introduce Me!!! Job Jeju National University Student Ubuntu Korean Jeju Community Owner E-Mail: ned3y2k@hanmail.net Blog: http://ned3y2k.wo.tc Facebook: http://www.facebook.com/gyeongdae

More information

<4D F736F F F696E74202D20C1A63234C0E520C0D4C3E2B7C228B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63234C0E520C0D4C3E2B7C228B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 24 장입출력 이번장에서학습할내용 스트림이란? 스트림의분류 바이트스트림 문자스트림 형식입출력 명령어행에서입출력 파일입출력 스트림을이용한입출력에대하여살펴봅시다. 스트림 (stream) 스트림 (stream) 은 순서가있는데이터의연속적인흐름 이다. 스트림은입출력을물의흐름처럼간주하는것이다. 스트림들은연결될수있다. 중간점검문제 1. 자바에서는입출력을무엇이라고추상화하는가?

More information

Java

Java Java http://cafedaumnet/pway Chapter 1 1 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength();

More information

T100MD+

T100MD+ User s Manual 100% ) ( x b a a + 1 RX+ TX+ DTR GND TX+ RX+ DTR GND RX+ TX+ DTR GND DSR RX+ TX+ DTR GND DSR [ DCE TYPE ] [ DCE TYPE ] RS232 Format Baud 1 T100MD+

More information

13-Java Network Programming

13-Java Network Programming JAVA Programming Language JAVA Network Programming IP Address(Internet Protocol Address) URL(Uniform Resource Location) TCP(Transmission Control Protocol) Socket UDP(User Datagram Protocol) Client / Server

More information

IBM blue-and-white template

IBM blue-and-white template IBM Software Group 웹기반의 DB2 개발환경구축및 DB2 Information Integrator 를이용한정보통합데모 한국 IBM 소프트웨어사업부 정진영대리 (jyjeong@kr.ibm.com) Agenda Preparation JAVA ENV JAVA CONNECTION PHP ENV PHP CONNECTION Preparation Installation

More information

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh Page 1 of 6 Learn Korean Ep. 13: Whether (or not) and If Let s go over how to say Whether and If. An example in English would be I don t know whether he ll be there, or I don t know if he ll be there.

More information

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O Orange for ORACLE V4.0 Installation Guide ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE...1 1....2 1.1...2 1.2...2 1.2.1...2 1.2.2 (Online Upgrade)...11 1.3 ORANGE CONFIGURATION ADMIN...12 1.3.1 Orange Configuration

More information

<4D F736F F F696E74202D20C1A63235C0E520B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63235C0E520B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 25 장네트워크프로그래밍 이번장에서학습할내용 네트워크프로그래밍의개요 URL 클래스 TCP를이용한통신 TCP를이용한서버제작 TCP를이용한클라이언트제작 UDP 를이용한통신 자바를이용하여서 TCP/IP 통신을이용하는응응프로그램을작성하여봅시다. 서버와클라이언트 서버 (Server): 사용자들에게서비스를제공하는컴퓨터 클라이언트 (Client):

More information

歯Writing_Enterprise_Applications_2_JunoYoon.PDF

歯Writing_Enterprise_Applications_2_JunoYoon.PDF Writing Enterprise Applications with Java 2 Platform, Enterprise Edition - part2 JSTORM http//wwwjstormpekr Revision Document Information Document title Writing Enterprise Applications

More information

Contents Contents 2 1 Abstract 3 2 Infer Checkers Eradicate Infer....

Contents Contents 2 1 Abstract 3 2 Infer Checkers Eradicate Infer.... SV2016 정적분석보고서 201214262 라가영 201313250 서지혁 June 9, 2016 1 Contents Contents 2 1 Abstract 3 2 Infer 3 2.1 Checkers................................ 3 2.2 Eradicate............................... 3 2.3 Infer..................................

More information

Data Provisioning Services for mobile clients

Data Provisioning Services for mobile clients 7 장. Form 처리와파일업로드 제 7 장 HTML 태그 1. 폼 (Form) 태그소개 사용자에게정보를요청하고적당한대답을얻어낼수있는텍스트박스나체크박스등을제공한다. 사용자로부터의정보를서버에게전달할수있는 submit( 전달 ) 버튼을제공한다. submit 버튼은새페이지 (JSP 에의해생성되는동적페이지 ) 를열기위해사용된다. 2/33 제 1 장

More information

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

More information

05-class.key

05-class.key 5 : 2 (method) (public) (private) (interface) 5.1 (Method), (public method) (private method) (constructor), 3 4 5.2 (client). (receiver)., System.out.println("Hello"); (client object) (receiver object)

More information

1

1 1 1....6 1.1...6 2. Java Architecture...7 2.1 2SDK(Software Development Kit)...8 2.2 JRE(Java Runtime Environment)...9 2.3 (Java Virtual Machine, JVM)...10 2.4 JVM...11 2.5 (runtime)jvm...12 2.5.1 2.5.2

More information

PHP & ASP

PHP & ASP 단어장프로젝트 프로젝트2 단어장 select * from address where address like '% 경기도 %' td,li,input{font-size:9pt}

More information

뇌를 자극하는 JSP & Servlet 슬라이드

뇌를 자극하는 JSP & Servlet 슬라이드 서블릿의기초 Servlet & JSP 2/70 Contents 학습목표 서블릿클래스는자바클래스형태로구현되는웹애플리케이션프로그램이며, 일반적인자바클래스를작성할때보다지켜야할규칙이많다. 이장에서는그규칙들을배워보자. 내용 서블릿이란? 웹컨테이너란? 서블릿클래스의작성, 컴파일, 설치, 등록 톰캣관리자프로그램사용하기 웹브라우저로부터데이터입력받기 3/70 1. 서블릿이란?

More information

13주-14주proc.PDF

13주-14주proc.PDF 12 : Pro*C/C++ 1 2 Embeded SQL 3 PRO *C 31 C/C++ PRO *C NOT! NOT AND && AND OR OR EQUAL == = SQL,,, Embeded SQL SQL 32 Pro*C C SQL Pro*C C, C Pro*C, C C 321, C char : char[n] : n int, short, long : float

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 (Host) set up : Linux Backend RS-232, Ethernet, parallel(jtag) Host terminal Target terminal : monitor (Minicom) JTAG Cross compiler Boot loader Pentium Redhat 9.0 Serial port Serial cross cable Ethernet

More information

thesis-shk

thesis-shk DPNM Lab, GSIT, POSTECH Email: shk@postech.ac.kr 1 2 (1) Internet World-Wide Web Web traffic Peak periods off-peak periods peak periods off-peak periods 3 (2) off-peak peak Web caching network traffic

More information

휠세미나3 ver0.4

휠세미나3 ver0.4 andromeda@sparcs:/$ ls -al dev/sda* brw-rw---- 1 root disk 8, 0 2014-06-09 18:43 dev/sda brw-rw---- 1 root disk 8, 1 2014-06-09 18:43 dev/sda1 brw-rw---- 1 root disk 8, 2 2014-06-09 18:43 dev/sda2 andromeda@sparcs:/$

More information

0. 들어가기 전

0. 들어가기 전 컴퓨터네트워크 14 장. 웹 (WWW) (3) - HTTP 1 이번시간의학습목표 HTTP 의요청 / 응답메시지의구조와동작원리이해 2 요청과응답 (1) HTTP (HyperText Transfer Protocol) 웹브라우저는 URL 을이용원하는자원표현 HTTP 메소드 (method) 를이용하여데이터를요청 (GET) 하거나, 회신 (POST) 요청과응답 요청

More information

PART 1 CHAPTER 1 Chapter 1 Note 4 Part 1 5 Chapter 1 AcctNum = Table ("Customer").Cells("AccountNumber") AcctNum = Customer.AccountNumber Note 6 RecordSet RecordSet Part 1 Note 7 Chapter 1 01:

More information

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS ( PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (http://ddns.hanwha-security.com) Step 1~5. Step, PC, DVR Step 1. Cable Step

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V Mobile Service > IAP > Android SDK IAP SDK TOAST SDK. IAP SDK. Android Studio IDE 2.3.3 Android SDK Version 2.3.3 (API Level 10). Name Reference Version License okhttp http://square.github.io/okhttp/ 1.5.4

More information

SMB_ICMP_UDP(huichang).PDF

SMB_ICMP_UDP(huichang).PDF SMB(Server Message Block) UDP(User Datagram Protocol) ICMP(Internet Control Message Protocol) SMB (Server Message Block) SMB? : Microsoft IBM, Intel,. Unix NFS. SMB client/server. Client server request

More information

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC Step 1~5. Step, PC, DVR Step 1. Cable Step

More information

Modern Javascript

Modern Javascript ES6 - Arrow Function Class Template String Destructuring Default, Rest, Spread let, const for..of Promises Module System Map, Set * Generator * Symbol * * https://babeljs.io/ Babel is a JavaScript compiler.

More information

LXR 설치 및 사용법.doc

LXR 설치 및 사용법.doc Installation of LXR (Linux Cross-Reference) for Source Code Reference Code Reference LXR : 2002512( ), : 1/1 1 3 2 LXR 3 21 LXR 3 22 LXR 221 LXR 3 222 LXR 3 3 23 LXR lxrconf 4 24 241 httpdconf 6 242 htaccess

More information

<4D F736F F F696E74202D20B5A5C0CCC5CDBAA3C0CCBDBA5F3130C1D6C2F75F31C2F7BDC32E >

<4D F736F F F696E74202D20B5A5C0CCC5CDBAA3C0CCBDBA5F3130C1D6C2F75F31C2F7BDC32E > Chapter 8 데이터베이스응용개발 목차 사용자인터페이스와도구들 웹인터페이스와데이터베이스 웹기초 Servlet 과 JSP 대규모웹응용개발 ASP.Net 8 장. 데이터베이스응용개발 (Page 1) 1. 사용자인터페이스와도구들 대부분의데이터베이스사용자들은 SQL을사용하지않음 응용프로그램 : 사용자와데이터베이스를연결 데이터베이스응용의구조 Front-end Middle

More information

Chap12

Chap12 12 12Java RMI 121 RMI 2 121 RMI 3 - RMI, CORBA 121 RMI RMI RMI (remote object) 4 - ( ) UnicastRemoteObject, 121 RMI 5 class A - class B - ( ) class A a() class Bb() 121 RMI 6 RMI / 121 RMI RMI 1 2 ( 7)

More information

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate ALTIBASE HDB 6.1.1.5.6 Patch Notes 목차 BUG-39240 offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG-41443 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate 한뒤, hash partition

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Reasons for Poor Performance Programs 60% Design 20% System 2.5% Database 17.5% Source: ORACLE Performance Tuning 1 SMS TOOL DBA Monitoring TOOL Administration TOOL Performance Insight Backup SQL TUNING

More information

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공 메신저의새로운혁신 채팅로봇 챗봇 (Chatbot) 입문하기 소 이 메 속 : 시엠아이코리아 름 : 임채문 일 : soulgx@naver.com 1 목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper

More information

Cluster management software

Cluster management software 자바네트워크프로그래밍 (OCJP 국제공인자격취득중심 ) 충북대학교 최민 기본예제 예외클래스를정의하고사용하는예제 class NewException extends Exception { public class ExceptionTest { static void methoda() throws NewException { System.out.println("NewException

More information

5장.key

5장.key JAVA Programming 1 (inheritance) 2!,!! 4 3 4!!!! 5 public class Person {... public class Student extends Person { // Person Student... public class StudentWorker extends Student { // Student StudentWorker...!

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 1,..... @ 1 Green Project 1991 Oak Java 1995. 5 December '90 by Patrick Naughton, Mike Sheridan and James Gosling Embedded in various consumer electronic device 1992. 9. 3 Star 7 1993 www portability

More information

Polly_with_Serverless_HOL_hyouk

Polly_with_Serverless_HOL_hyouk { } "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "polly:synthesizespeech", "dynamodb:query", "dynamodb:scan", "dynamodb:putitem", "dynamodb:updateitem", "sns:publish", "s3:putobject",

More information

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f… Command JSTORM http://www.jstorm.pe.kr Command Issued by: < > Revision: Document Information Document title: Command Document file name: Revision number: Issued by: Issue

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 오류처리 손시운 ssw5176@kangwon.ac.kr 오류메시지를분석한다. 오류메시지에서많은내용을알수있다. 2 디버깅 디버거를사용하면프로그램에서쉽게오류를감지하고진단할수있다. 디버거는중단점을설정하여서프로그램의실행을제어할수있으며문장 단위로실행하거나변수의값을살펴볼수있다. 3 이클립스에서디버깅 4 이클립스에서디버깅 5 이클립스의디버깅명령어 6 예외처리

More information

4 5 4. Hi-MO 애프터케어 시스템 편 5. 오비맥주 카스 카스 후레쉬 테이블 맥주는 천연식품이다 편 처음 스타일 그대로, 부탁 케어~ Hi-MO 애프터케어 시스템 지속적인 모발 관리로 끝까지 스타일이 유지되도록 독보적이다! 근데 그거 아세요? 맥주도 인공첨가물이

4 5 4. Hi-MO 애프터케어 시스템 편 5. 오비맥주 카스 카스 후레쉬 테이블 맥주는 천연식품이다 편 처음 스타일 그대로, 부탁 케어~ Hi-MO 애프터케어 시스템 지속적인 모발 관리로 끝까지 스타일이 유지되도록 독보적이다! 근데 그거 아세요? 맥주도 인공첨가물이 1 2 On-air 3 1. 이베이코리아 G마켓 용평리조트 슈퍼브랜드딜 편 2. 아모레퍼시픽 헤라 루즈 홀릭 리퀴드 편 인쇄 광고 올해도 겨울이 왔어요. 당신에게 꼭 해주고 싶은 말이 있어요. G마켓에선 용평리조트 스페셜 패키지가 2만 6900원! 역시 G마켓이죠? G마켓과 함께하는 용평리조트 스페셜 패키지. G마켓의 슈퍼브랜드딜은 계속된다. 모바일 쇼핑 히어로

More information

10주차.key

10주차.key 10, Process synchronization (concurrently) ( ) => critical section ( ) / =>, A, B / Race condition int counter; Process A { counter++; } Process B { counter ;.. } counter++ register1 = counter register1

More information