package com.dzq.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; @WebServlet("/CustomInfoServlet")
public class CustomInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url=request.getRequestURL().toString();
System.out.println(url);
String uri=request.getRequestURI().toString();
System.out.println(uri);
String qStr=request.getQueryString();
System.out.println(qStr);
String ip=request.getRemoteAddr();
System.out.println(ip);
String method =request.getMethod();
System.out.println(method);
String name=request.getContextPath();
System.out.println(name);
} protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
} }

  

  

20160324 javaweb 之request的更多相关文章

  1. javaWeb中request请求转发和response重定向

    1.访问资源 运用forward方法只能重定向到同一个Web应用程序中的一个资源. 而sendRedirect方法可以让你重定向到任何URL.  2.request.get Forward代码中的&q ...

  2. JavaWeb -pageContext/request/session/application

    pageContext/request/session/application总结 一.范围差异 1. pageContext jsp页面容器 当前页面有效 2. request 请求对象 同一次请求 ...

  3. javaweb之request获取referer请求头实现防盗链

    package test.request; import java.io.IOException; import javax.servlet.ServletException; import java ...

  4. javaweb入门-----request与response的作用

    request对象和request对象的原理 1.request和response对象request对象和request对象的原理时由服务器创建的,我们来使用它们 2.request对象是来获取请求消 ...

  5. javaweb: request.getParameter()、request.setAttribute()与request.getAttribute()的作用 (转)

    出处:https://blog.csdn.net/qq_41937388/article/details/87972914 1.request.getParameter()方法是获取通过类似post, ...

  6. Javaweb学习——request&response

    request对象的作用 request是服务器对浏览器访问请求的封装 访问请求参数,通过getParameter()方法获取传递参数的值. 在进行转发请求时,需要把一些参数传递到转发后的页面进行处理 ...

  7. Java中Integer类的方法和request的setAttribute方法的使用与理解

    一.Integer类的使用方法 Interger:整数类型 1.属性. static int MAX_VALUE:返回最大的整型数: static int MIN_VALUE:返回最小的整型数: st ...

  8. 超全面的JavaWeb笔记day10<Response&Request&路径&编码>

    1.Response 2.Request 3.路径 4.编码 请求响应流程图 response 1.response概述 response是Servlet.service方法的一个参数,类型为java ...

  9. JavaWeb request对象常用操作

      JavaWeb request对象常用操作 CreateTime--2018年6月1日16点47分 Author:Marydon 一.前提 import javax.servlet.http.Ht ...

随机推荐

  1. Scheme Implementations对比

    MIT Scheme http://www.gnu.org/software/mit-scheme/ GNU Guile http://www.gnu.org/software/guile/ Rack ...

  2. WinForm触摸屏程序功能界面长时间不操作自动关闭回到主界面 z

    操作者经常会在执行了某操作后,没有返还主界面就结束了操作然后离开了,程序应该关闭功能窗体自动回到主界面方便下一位操作者操作.那么对于WinForm程序怎么实现呢? 实现原理:拦截Application ...

  3. 转载--C++ STL

    转自:http://wenku.baidu.com/view/15d18b4533687e21af45a9a4.html 1.C++ STL 之所以得到广泛的赞誉,也被很多人使用,不只是提供了像vec ...

  4. Visual Studio 2010打开水晶报表是出现二进制

    水晶报表在64位的机器下未安装成功 解决方法 到http://www.cnblogs.com/siyunianhua/p/4806513.html下载  水晶报表VS2010版IDE安装标准版SAP ...

  5. JDK源码重新编译——支持eclipse调试JDK源码--转载

    最近在研究jdk源码,发现debug时无法查看源码里的变量值. 因为sun提供的jdk并不能查看运行中的局部变量,需要重新编译一下rt.jar. 下面这六步是编译jdk的具体步骤: Step 1:   ...

  6. 动态代理入门(jdk)

    动态代理就是aop的核心,动态代理简单的就是通过创建一个代理对象,然后把原来的方法增强.很抽象,例子是王道.jdk中提供了动态代理的实现,但是它是针对接口,如果要实现动态代理,需要被代理对象的接口.这 ...

  7. tyvj P1519 博彩游戏(AC自动机+DP滚动数组)

    P1519 博彩游戏 背景 Bob最近迷上了一个博彩游戏…… 描述 这个游戏的规则是这样的:每花一块钱可以得到一个随机数R,花上N块钱就可以得到一个随机序列:有M个序列,如果某个序列是产生的随机序列的 ...

  8. Clean Code – Chapter 5 Formatting

    The Purpose of Formatting Code formatting is about communication, and communication is the professio ...

  9. 微软Azure 存储管理器的简单介绍

    Windows Azure存储用户经常希望能够在“管理器”中查看他们的数据,管理器指的是一款可用于显示存储帐户数据的工具.我们之前提供了我们所知的存储管理器列表.在本文中,我们将对此列表进行更新,使其 ...

  10. Introduction to SignalR -摘自网络

    What is SignalR? ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of ...