검색결과 리스트
2010/12/12에 해당되는 글 2건
- 2010.12.12 [Ruby]WEBrick 서블릿 사용하기
- 2010.12.12 [Ruby]WEBrick 서버구동
글
[Ruby]WEBrick 서블릿 사용하기
언어로그/Ruby/Rails
2010. 12. 12. 04:37
#!/usr/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 4000)
class HelloServlet < HTTPServlet::AbstractServlet
def do_GET(req, res)
res['Content-Type'] = "text/html";
res.body = %{
Hello. You're calling form a #{req['UserAgent']}
I see parameters: #{req.query.keys.join(', ')}
}
end
end
s.mount("/hello", HelloServlet)
trap("INT"){ s.shutdown }
s.start
'언어로그 > Ruby/Rails' 카테고리의 다른 글
| 자바 개발자를 위한 루비적 관점 (0) | 2011.03.04 |
|---|---|
| [Ruby]WEBrick 서블릿 사용하기 (0) | 2010.12.12 |
| [Ruby]WEBrick 서버구동 (0) | 2010.12.12 |
설정
트랙백
댓글
글
[Ruby]WEBrick 서버구동
언어로그/Ruby/Rails
2010. 12. 12. 04:30
#!/usr/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => 3000,
:DocumentRoot => File.join(Dir.pwd, "/html")
)
trap("INT") { s.shutdown }
s.start
'언어로그 > Ruby/Rails' 카테고리의 다른 글
| 자바 개발자를 위한 루비적 관점 (0) | 2011.03.04 |
|---|---|
| [Ruby]WEBrick 서블릿 사용하기 (0) | 2010.12.12 |
| [Ruby]WEBrick 서버구동 (0) | 2010.12.12 |