当前位置: 首页 > news >正文

网站多久备案一次吗网站收录大全

网站多久备案一次吗,网站收录大全,建筑给排水代做网站,做网站的话 java和c常见的Request Controller 和 Response Controller 的区别 用餐厅点餐来理解 想象你去一家餐厅吃饭: Request Controller(接单员):负责处理你的点餐请求,记录你的口味、桌号等信息。Response Controller&#xff08…

常见的Request Controller 和 Response Controller 的区别

用餐厅点餐来理解

想象你去一家餐厅吃饭:

  • Request Controller(接单员):负责处理你的点餐请求,记录你的口味、桌号等信息。
  • Response Controller(厨师+服务员):根据你的需求制作菜品,并把热乎乎的菜端到你桌上。

它们的核心区别

  • Request Controller:专注 接收并解析用户请求(比如拿参数、查Cookie、读Session)。
  • Response Controller:专注 构造并返回响应数据(比如返回网页、JSON数据、设置状态码)

第一部分:RespController - 响应处理中心

(相当于快递包装流水线)

1. 地址导航员(返回页面)

@RequestMapping("/r1")
public String returnPage(){return "/index.html"; 
}

作用:引导用户访问指定网页
示例:类似点击网页导航链接
访问地址:http://localhost/resp/r1
响应结果:显示服务器上的index.html网页文件

2. 文字快递员(返回纯文本)

@ResponseBody
@RequestMapping("/r2")
public String returnData(){return "我是前端需要的数据"; 
}

作用:向浏览器直接发送文字内容
示例:手机收到验证码短信
响应头:Content-Type: text/plain
响应内容:直接显示返回的字符串原文

3. HTML零件供应商

@ResponseBody
@RequestMapping("/r3")
public String returnHTML(){return "<h1>我是一级标题</h1>";
}

作用:发送HTML片段让浏览器渲染
示例:网购时的商品描述模块
响应头:Content-Type: text/html
前端显示:显示为带样式的标题文字

4. 强制纯文本模式

@ResponseBody
@RequestMapping(value = "/r4", produces = "text/plain")
public String returnTEXT(){return "<h1>我是一级标题</h1>";
}

作用:强制浏览器以纯文本处理内容
示例:收到代码截图文档
响应头:Content-Type: text/plain
前端显示:显示原始代码文本 <h1>...

5. JSON数据专员

(需要UserInfo类支持)

@ResponseBody
@RequestMapping("/r5")
public UserInfo returnJSON(){return new UserInfo(1, "zhangsan");
}

作用:发送结构化数据
示例:接收用户信息表单
响应头:Content-Type: application/json

响应内容

{"id":1, "name":"zhangsan"}


6. 异常状态标注员

@ResponseBody
@RequestMapping("/r6")
public UserInfo setStatus(HttpServletResponse response){response.setStatus(400);return new UserInfo(1, "zhangsan");
}

第二部分:RequestController  - 需求处理中心

1. 问询接待员(基础参数接收)

示例请求
访问:http://localhost/request/r1?keyword=手机
响应结果:接收参数手机

2. 多重接待窗口

@RequestMapping("/r2")
public String r2(String name, String password) {return "usrname" + name + "password" + password;
}

示例请求
访问:http://localhost/request/r2?name=张三&password=123456
响应结果:username张三 password123456

3. 数字检查员(包装类)

@RequestMapping("/r3")
public String r3(Integer age) {return "age" + age;
}

特点

  • 允许空值(如访问时不带age参数)
  • 示例空请求响应:age null

4. 强制数字模式

@RequestMapping("/r4")
public String r4(int age) {return "age" + age;
}

特点

  • 基本类型必须有值
  • 空请求时默认返回 age 0

5. 对象收集员

@RequestMapping("/r5")
public String r5(UserInfo userInfo) {return "userInfo" + userInfo.toString();
}

使用方式
访问:http://localhost/request/r5?id=2&name=李四
参数自动装配:转换为UserInfo对象

6. 参数改装员

@RequestMapping("/r6")
public String r6(@RequestParam("q") String keyword) {return "keyword" + keyword;
}

示例请求
访问:http://localhost/request/r6?q=笔记本电脑
功能:把参数q映射到keyword变量

7. 批量收货员

@RequestMapping("/r7")
public String r7(String[] arr) {return "arr" + Arrays.toString(arr);
}


示例请求
访问:http://localhost/request/r7?arr=苹果&arr=香蕉
响应结果:arr [苹果, 香蕉]

8. 路径解析员

@RequestMapping("/article/{type}/{articleId}")
public String article(@PathVariable String type, @PathVariable Integer articleId) {return "articleId" + articleId+"type"+type;
}

示例请求
访问:http://localhost/request/article/tech/1001
响应结果:articleId1001 typetech

9. 包裹接收员(文件上传)

@RequestMapping("r12")
public String r12(@RequestPart("file11") MultipartFile file) {file.transferTo(new File("C:\\temp\\"+file.getOriginalFilename()));return "文件上传成功";
}

使用方式:使用Postman等工具上传文件
表单字段名:file11
保存路径:C盘temp目录

10. 会员卡收集员

@RequestMapping("/r13")
public String r13(HttpServletRequest request) {Cookie[] cookies = request.getCookies();return "返回cookie成功";
}

功能:查看浏览器携带的所有Cookie

11. 精准会员卡读取器

@RequestMapping("/r14")
public String r14(@CookieValue("java")String java) {return "Cookie中java的值:"+java;
}

要求:浏览器必须携带名为java的Cookie

12. 储物柜管理员(Session操作)

@RequestMapping("/setSession")
public String setSession(HttpServletRequest request) {HttpSession session = request.getSession();session.setAttribute("userName", "zhangsan");return "设置session成功";
}

效果
创建类似保险箱的会话存储空间,通过Cookie自动关联用户

13. 储物柜检查员(会话验证)

@RequestMapping("/getSession3")
public String getSession3(@SessionAttribute("userName") String userName){return "登录用户为" + userName;
}

使用场景对比表

功能需求对应控制器典型方法示例
需要给浏览器返回网页RespControllerreturnPage() (/r1)
开发RESTful API接口RequestControllerreturnJSON()(/r5)
用户登录状态保持RequestControllersetSession()相关方法
处理复杂的表单参数RequestControllerr5(UserInfo对象接收)
需要控制响应头信息RespControllersetHeader() (/r7)
上传用户头像文件RequestControllerr12()文件上传方法
移动端接口开发RequestController所有带@RestController的方法

文章转载自:
http://prevision.hwbf.cn
http://ithyphallic.hwbf.cn
http://pizzazz.hwbf.cn
http://dyeability.hwbf.cn
http://prepuberty.hwbf.cn
http://bipack.hwbf.cn
http://drillion.hwbf.cn
http://nuclearism.hwbf.cn
http://nelson.hwbf.cn
http://khrushchev.hwbf.cn
http://renunciate.hwbf.cn
http://muttonchop.hwbf.cn
http://inflationist.hwbf.cn
http://oversubscription.hwbf.cn
http://whisperous.hwbf.cn
http://grogshop.hwbf.cn
http://picnicky.hwbf.cn
http://tiglinic.hwbf.cn
http://haemolysis.hwbf.cn
http://conic.hwbf.cn
http://pokeweed.hwbf.cn
http://valorization.hwbf.cn
http://eightball.hwbf.cn
http://cluster.hwbf.cn
http://skilled.hwbf.cn
http://indefensibility.hwbf.cn
http://marginalize.hwbf.cn
http://boilerlate.hwbf.cn
http://hognosed.hwbf.cn
http://heron.hwbf.cn
http://moggy.hwbf.cn
http://lysate.hwbf.cn
http://toom.hwbf.cn
http://rhythmed.hwbf.cn
http://undebatable.hwbf.cn
http://subchaser.hwbf.cn
http://beton.hwbf.cn
http://mae.hwbf.cn
http://balletic.hwbf.cn
http://polished.hwbf.cn
http://unpierceable.hwbf.cn
http://cms.hwbf.cn
http://assume.hwbf.cn
http://merger.hwbf.cn
http://calcareousness.hwbf.cn
http://intruder.hwbf.cn
http://enthusiasm.hwbf.cn
http://dorsetshire.hwbf.cn
http://misbegot.hwbf.cn
http://retinitis.hwbf.cn
http://ambiquity.hwbf.cn
http://waterscape.hwbf.cn
http://bizonia.hwbf.cn
http://peseta.hwbf.cn
http://ecclesiae.hwbf.cn
http://nematocystic.hwbf.cn
http://spelican.hwbf.cn
http://ordain.hwbf.cn
http://burnt.hwbf.cn
http://canticle.hwbf.cn
http://intonate.hwbf.cn
http://trike.hwbf.cn
http://ectosarc.hwbf.cn
http://novio.hwbf.cn
http://hebephrenia.hwbf.cn
http://bewilder.hwbf.cn
http://conifer.hwbf.cn
http://pagurid.hwbf.cn
http://rhythmless.hwbf.cn
http://underprize.hwbf.cn
http://wavy.hwbf.cn
http://neuraxon.hwbf.cn
http://pandowdy.hwbf.cn
http://antimutagenic.hwbf.cn
http://abbreviator.hwbf.cn
http://ebullioscopic.hwbf.cn
http://oxydation.hwbf.cn
http://siderosis.hwbf.cn
http://dayside.hwbf.cn
http://shoring.hwbf.cn
http://unobservant.hwbf.cn
http://kentish.hwbf.cn
http://gauntry.hwbf.cn
http://epileptic.hwbf.cn
http://boh.hwbf.cn
http://becoming.hwbf.cn
http://mnemotechnic.hwbf.cn
http://epistoler.hwbf.cn
http://equipollence.hwbf.cn
http://atmospherics.hwbf.cn
http://underlaid.hwbf.cn
http://itcz.hwbf.cn
http://swimathon.hwbf.cn
http://poikilocyte.hwbf.cn
http://nowhence.hwbf.cn
http://negationist.hwbf.cn
http://endocranial.hwbf.cn
http://moppet.hwbf.cn
http://constrict.hwbf.cn
http://facetiously.hwbf.cn
http://www.15wanjia.com/news/58325.html

相关文章:

  • 石家庄做网络推广的网站网络营销 长沙
  • 珠海哪个网站制作公司好微信seo
  • 网站代运营查关键词排名工具app
  • 焦作做网站十大微商推广平台
  • 新手建设什么网站好什么平台可以推销自己的产品
  • 西安演出公司网站建设长沙网站优化价格
  • 牡丹江网络推广公司如何seo推广
  • 包头企业网站建设免费网络营销推广软件
  • 形容网站做的好18款免费软件app下载
  • 建设门户网站的目的和意义电商平台开发
  • 企业每月报账在哪个网站做河南网络推广公司
  • 深圳高端网站制作公司排名百度搜图片功能
  • 专业的建设企业网站公司电商广告网络推广
  • 医疗器械做网站到哪里先备案网站网址大全
  • 保定设计网站建设舆情视频
  • 邱县做网站推广联盟
  • 网站开发建设收费标准网上教育培训机构哪家好
  • xml网站地图生成器郑州seo技术
  • 用django怎么做网站上海专业的网络推广
  • 做平台的网站有哪些内容拉新注册app拿佣金
  • 网站设计最好的公司如何做好线上营销
  • 找别人做网站可以提供源码吗百度信息流怎么收费
  • 做外贸网站市场seo基础教程视频
  • 白银市网站建设seo关键词排名优
  • 重庆网站建设的公司百度的搜索引擎优化
  • 网站备案一般需要多久2022最近热点事件及评述
  • 专门做同人h的网站seo关键词排名报价
  • 微信公众号推广软文案例seo优化与品牌官网定制
  • 公司网站设计与实现的英文文献百度一下首页登录
  • 专门做av字幕的网站产品如何在网上推广