`
woshixushigang
  • 浏览: 575883 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

request.getURL()和request.getURI()

阅读更多
request.getRequestURI() 返回值类似:/ServletTest/servlet/Hello
request.getRequestURL() 返回值类似:http://localhost:8080/ServletTest/servlet/Hello

 

再如:

 

request.getContextPath() = /ServletTest

 

request.getLocalAddr() = 127.0.0.1


request.getPathInfo() = null


request.getPathTranslated() = null


request.getRemoteAddr() = 127.0.0.1


request.getRequestURI() = /ServletTest/servlet/Hello

 

request.getScheme() = http


request.getServerName() = 127.0.0.1


request.getServletPath() = /servlet/Hello

 

request.getClass() = class org.apache.catalina.connector.RequestFacade


request.getHeaderNames() = org.apache.tomcat.util.http.NamesEnumerator@1fb050c


request.getLocale() = zh_CN


request.getLocales() = org.apache.catalina.util.Enumerator@1088a1b

 

request.getParameterMap() = {}


request.getRequestURL() = http://127.0.0.1:8080/ServletTest/servlet/Hello

 

request.getUserPrincipal() = null


request.getParameterNames() = java.util.Hashtable$EmptyEnumerator@1db6942


request.getRealPath("newsPub") =

 

D:\zfsca\.metadata\.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\ServletTest\newsPub

 

request.getRealPath("/") =

 

D:\zfsca\.metadata\.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\ServletTest\

分享到:
评论

相关推荐

    android-修改头像

    Uri resultUri = result.getUri(); // 更新ImageView显示新头像 imageView.setImageURI(resultUri); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result....

    Symfony实现行为和模板中取得request参数的方法

    $fullUri = $this->getRequest()->getUri(); ``` 6. 获取URL的路径部分(不包括域名和查询字符串): ```php $pathInfo = $this->getRequest()->getPathInfo(); ``` 了解了这些基本操作后,你可以在处理用户...

    HttpClient抓取网页Demo

    System.out.println("Executing request " + httpGet.getRequestLine() + " to " + httpGet.getURI() + " ..."); CloseableHttpResponse response = httpClient.execute(httpGet); try { System.out.println("-...

    安卓H5文件上传

    需要注意的是,不同版本的安卓系统可能需要不同的处理方式,例如API 21以下的版本需要使用`ACTION_PICK`替代`ACTION_GET_CONTENT`,并且文件上传过程可能会涉及更多的安全和权限问题。在实际开发中,应根据具体需求...

    HttpClient以及获取页面内容应用

    System.out.println("executing request " + httppost.getURI()); CloseableHttpResponse response = httpclient.execute(httppost); try { HttpEntity entity = response.getEntity(); if (entity...

    Laravel开发-s3-presigned

    通过这种方式,Laravel 和 AWS SDK 结合使用,我们可以安全地在 PHP 应用程序中实现预签名 URL 文件上传功能,同时避免在客户端暴露敏感的 AWS 凭证。这种解决方案特别适用于那些希望让用户直接向 S3 存储桶上传文件...

    baobab:一个简单的网络框架

    - getUrl() 路线: - getRouteUrl() - getRouteParams() - route() 视图和控制器支持: - render() 依赖项: - getUri() - getRouter() - getRequest() - getResponse() 参数 该类实现了公共参数对象的功能...

    http-foundation:HttpFoundation组件为HTTP规范定义了一个面向对象的层

    $url = $request->getUri(); // 获取请求URL $data = $request->request->all(); // 获取POST数据 $files = $request->files->all(); // 获取上传文件 $response = new Response(); $response->setContent('Hello, ...

    Android静默安装常用工具类

    static HttpResponse httpGet(HttpRequest request) static HttpResponse httpGet(java.lang.String httpUrl) static String httpGetString(String httpUrl) 包含以上三个方法,默认使用gzip压缩,使用...

    Slim-Documentation:旧的Slim Framework 3文档

    $app->request->getUri() )); // 注册视图到容器 $app->container->singleton('view', $view); // 使用模板 $app->get('/', function (Request $request, Response $response) { $this->view->render($response,...

Global site tag (gtag.js) - Google Analytics