Skip to content

Commit 7da77a0

Browse files
Add files via upload
1 parent c1168e9 commit 7da77a0

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

WebContent/META-INF/MANIFEST.MF

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Class-Path:
3+

WebContent/WEB-INF/web.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
3+
<display-name>helloworld</display-name>
4+
<welcome-file-list>
5+
<welcome-file>index.html</welcome-file>
6+
<welcome-file>index.htm</welcome-file>
7+
<welcome-file>index.jsp</welcome-file>
8+
<welcome-file>default.html</welcome-file>
9+
<welcome-file>default.htm</welcome-file>
10+
<welcome-file>default.jsp</welcome-file>
11+
</welcome-file-list>
12+
</web-app>

WebContent/index.jsp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<%@ page language="java" contentType="text/html; charset=UTF-8"
2+
pageEncoding="UTF-8"%>
3+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4+
<html>
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7+
<title>Hello World</title>
8+
</head>
9+
<body>
10+
Homepage for /helloworld, the url for the Servlet is /helloworld/HelloWorldServlet
11+
</body>
12+
</html>
1.31 KB
Binary file not shown.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.azurewebsites.example;
2+
3+
import java.io.IOException;
4+
import javax.servlet.ServletException;
5+
import javax.servlet.annotation.WebServlet;
6+
import javax.servlet.http.HttpServlet;
7+
import javax.servlet.http.HttpServletRequest;
8+
import javax.servlet.http.HttpServletResponse;
9+
import java.io.PrintWriter;
10+
11+
/**
12+
* Servlet implementation class HelloWorldServlet
13+
*/
14+
@WebServlet("/HelloWorldServlet")
15+
public class HelloWorldServlet extends HttpServlet {
16+
private static final long serialVersionUID = 1L;
17+
18+
/**
19+
* @see HttpServlet#HttpServlet()
20+
*/
21+
public HelloWorldServlet() {
22+
super();
23+
// TODO Auto-generated constructor stub
24+
}
25+
26+
/**
27+
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
28+
*/
29+
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
30+
response.setContentType("text/html");
31+
PrintWriter printWriter = response.getWriter();
32+
printWriter.println("<h1>Hello World Servlet running on Azure App Service on Linux!</h1>");
33+
}
34+
35+
/**
36+
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
37+
*/
38+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
39+
// TODO Auto-generated method stub
40+
}
41+
42+
}

0 commit comments

Comments
 (0)