当前位置:网站首页>Using request headers to develop multi terminal applications
Using request headers to develop multi terminal applications
2022-07-05 09:11:00 【The corner of fufu】
servlet page
package com.ssyt.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/** * Servlet implementation class UserAgentServlet */
@WebServlet("/ua")
public class UserAgentServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/** * @see HttpServlet#HttpServlet() */
public UserAgentServlet() {
super();
// TODO Auto-generated constructor stub
}
/** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String userAgent = request.getHeader("User-Agent");
response.setContentType("text/html;charest=utf-8");
response.getWriter().println(userAgent);
String output="";
if(userAgent.indexOf("Windows NT")!=-1) {
output = "<h1>This is PC!</h1>";
}else if(userAgent.indexOf("iPhone")!=-1 || userAgent.indexOf("Android")!=-1) {
output = "<h1>This is Mobile!</h1>";
}
response.getWriter().println(output);
}
}
Web effect
PC End
Mobile
边栏推荐
- Introduction Guide to stereo vision (6): level constraints and polar correction of fusiello method
- C # draw Bezier curve with control points for lattice images and vector graphics
- TF coordinate transformation of common components of ros-9 ROS
- Wxss template syntax
- 容易混淆的基本概念 成员变量 局部变量 全局变量
- What is a firewall? Explanation of basic knowledge of firewall
- Wechat H5 official account to get openid climbing account
- 使用arm Neon操作,提高内存拷贝速度
- How many checks does kubedm series-01-preflight have
- Huber Loss
猜你喜欢

Install the CPU version of tensorflow+cuda+cudnn (ultra detailed)

Applet customization component

Priority queue (heap)
![[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization](/img/54/cb1373fbe7b21c5383580e8b638a2c.jpg)
[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization

Hi Fun Summer, play SQL planner with starrocks!

Ros- learn basic knowledge of 0 ROS - nodes, running ROS nodes, topics, services, etc

My experience from technology to product manager

Programming implementation of ROS learning 2 publisher node

Applet (use of NPM package)

Global configuration tabbar
随机推荐
Beautiful soup parsing and extracting data
Programming implementation of subscriber node of ROS learning 3 subscriber
Ministry of transport and Ministry of Education: widely carry out water traffic safety publicity and drowning prevention safety reminders
Confusing basic concepts member variables local variables global variables
Hosting environment API
LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
Introduction Guide to stereo vision (5): dual camera calibration [no more collection, I charge ~]
Array, date, string object method
My life
Applet data attribute method
Huber Loss
Programming implementation of ROS learning 6 -service node
Driver's license physical examination hospital (114-2 hang up the corresponding hospital driver physical examination)
Applet (subcontracting)
Introduction Guide to stereo vision (7): stereo matching
Newton iterative method (solving nonlinear equations)
2310. The number of bits is the sum of integers of K
[Niuke brush questions day4] jz55 depth of binary tree
Nodemon installation and use
容易混淆的基本概念 成员变量 局部变量 全局变量




