uri

一文带你了解 OAuth2 协议与 Spring Security OAuth2 集成!

一曲冷凌霜 提交于 2020-01-06 21:43:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> OAuth 2.0 允许第三方应用程序访问受限的HTTP资源的授权协议,像平常大家使用 Github 、 Google 账号来登陆其他系统时使用的就是 OAuth 2.0 授权框架,下图就是使用 Github 账号登陆 Coding 系统的授权页面图: 类似使用 OAuth 2.0 授权的还有很多,本文将介绍 OAuth 2.0 相关的概念如:角色、授权类型等知识,以下是我整理一张 OAuth 2.0 授权的脑头,希望对大家了解 OAuth 2.0 授权协议有帮助。 文章将以脑图中的内容展开 OAuth 2.0 协议同时除了 OAuth 2.0 外,还会配合 Spring Security OAuth2 来搭建 OAuth2客户端 ,这也是学习 OAuth 2.0 的目的,直接应用到实际项目中,加深对 OAuth 2.0 和 Spring Security 的理解。 OAuth 2.0 角色 OAuth 2.0 中有四种类型的角色分别为: 资源Owner 、 授权服务 、 客户端 、 资源服务 ,这四个角色负责不同的工作,为了方便理解先给出一张大概的流程图,细节部分后面再分别展开: OAuth 2.0 大概授权流程 资源 Owner 资源 Owner可以理解为一个用户,如之前提到使用 Github 登陆

context.getContentResolver().query()详细用法详解

别等时光非礼了梦想. 提交于 2020-01-06 20:37:48
1.获取联系人姓名 一个简单的例子,这个函数获取设备上所有的联系人ID和联系人NAME。 [java] view plain copy public void fetchAllContacts() { ContentResolver contentResolver = this.getContentResolver(); Cursor cursor = contentResolver.query(android.provider.ContactsContract.Contacts.CONTENT_URI, null, null, null, null); cursor.getCount(); while(cursor.moveToNext()) { System.out.println(cursor.getString(cursor.getColumnIndex(android.provider.ContactsContract.Contacts._ID))); System.out.println(cursor.getString(cursor.getColumnIndex(android.provider.ContactsContract.Contacts.DISPLAY_NAME))); } cursor.close(); } 执行结果: [java] view plain

send Image from android to MySQL server

本小妞迷上赌 提交于 2020-01-06 20:18:23
问题 In Activity A, it has 3 listView . When submit button is clicked, I want to store the text and imagePath into MySQL and the image stored in PhotoUpload folder. String imagess; Uri imgURI; public void uploadImageAndText(ArrayList<ImageAndText> listItems, final String id) { JSONArray jsonArray = new JSONArray(); try { for (ImageAndText i : listItems) { JSONObject object = new JSONObject(); String type = i.getType(); String[] Type = type.split(":"); object.put("type", Type[1]); Toast.makeText

Odata v.4 $filter for the DateTime Calendar Events in the Office 365 REST API

不打扰是莪最后的温柔 提交于 2020-01-06 20:15:12
问题 I am trying to get and filter Calendar events from the Office 365 REST API with the following query: https://outlook.office.com/api/v2.0/users/user@user.com/calendars/AAAAAAAAAAA/events?$top=100&$select=BodyPreview&$filter=Start ge 2016-02-10T22:00:00Z So I want 100 results with only the BodyPreview as return value for all Events greater than 2016-02-10 22:00:00. The Error Message I receive is this one: ERROR request returned 400 error: code: 'RequestBroker-ParseUri', message: 'A binary

How to send XML in a URI for posting to a Web API app?

时间秒杀一切 提交于 2020-01-06 18:13:02
问题 I need to send a uri to a Controller method in my my Web API app which has the following signature: public HttpResponseMessage PostXMLFile(string serialNum, string siteNum, XElement xElement) Or should it be this instead: public HttpResponseMessage PostXMLFile(string serialNum, string siteNum, List<XElement> xElements) ? Anyway, as you can see, it can't be just the XML, but must have the serialNum and siteNum args, too. I'm assuming the uri can look like this: http://<machineName>:<port>/api/

Accessing URL/URI information in Rails in the environments file?

孤街浪徒 提交于 2020-01-06 18:02:15
问题 How would I access the domain name from Rails inside the environments/deveopment.rb? I want to find out whether or not I am on localhost or a real domain. Thank you! 回答1: The environment files are not processed on every request- only at startup, so there wouldn't be any particular context at the time they are processed. This is really the job for a separate environment instead of having dev do double duty. If you just want to check against the hostname or something though, you can do

Nginx 反向代理详解

ぐ巨炮叔叔 提交于 2020-01-06 16:10:24
  Nginx 服务器的反向代理服务是其最常用的重要功能,由反向代理服务也可以衍生出很多与此相关的 Nginx 服务器重要功能。 1、代理   在Java设计模式中,代理模式是这样定义的:给某个对象提供一个代理对象,并由代理对象控制原对象的引用。   可能大家不太明白这句话,在举一个现实生活中的例子:比如我们要买一间二手房,虽然我们可以自己去找房源,但是这太花费时间精力了,而且房屋质量检测以及房屋过户等一系列手续也都得我们去办,再说现在这个社会,等我们找到房源,说不定房子都已经涨价了,那么怎么办呢?最简单快捷的方法就是找二手房中介公司(为什么?别人那里房源多啊),于是我们就委托中介公司来给我找合适的房子,以及后续的质量检测过户等操作,我们只需要选好自己想要的房子,然后交钱就行了。   代理简单来说,就是如果我们想做什么,但又不想直接去做,那么这时候就找另外一个人帮我们去做。那么这个例子里面的中介公司就是给我们做代理服务的,我们委托中介公司帮我们找房子。   Nginx 主要能够代理如下几种协议,其中用到的最多的就是做Http代理服务器。 2、正向代理   弄清楚什么是代理了,那么什么又是正向代理呢?   这里我再举一个例子:大家都知道,现在国内是访问不了 Google的,那么怎么才能访问 Google呢?我们又想,美国人不是能访问 Google吗(这不废话,Google就是美国的)

Sending android audio recorded file as an attachment of an email giving error when trying to read file (URI path not absolute)

杀马特。学长 韩版系。学妹 提交于 2020-01-06 15:33:09
问题 I'm saving an audio file using Media recorder and the following code: public class AudioRecorder { final MediaRecorder recorder = new MediaRecorder(); final String path; /** * Creates a new audio recording at the given path */ public AudioRecorder(String path) { this.path = sanitizePath(path); } public static String sanitizePath(String path) { if (!path.startsWith("/")) { path = "/" + path; } if(path.endsWith("/")){ path = path + "/"; } return path; } /** * Starts a new recording. */ public

Unknown error using Digg API and URI handler (silverlight)

百般思念 提交于 2020-01-06 14:11:06
问题 For class we have to follow a tutorial to create a silverlight website that searches DIGG for a given topic. (Using this tutorial as a base: http://weblogs.asp.net/scottgu/archive/2010/02/22/first-look-at-silverlight-2.aspx) We have to use the following code to fetch the information from DIGG. private void buttonSearch_Click(object sender, RoutedEventArgs e) { string topic = textboxSearchTopic.Text; WebClient digg = new WebClient(); digg.DownloadStringCompleted += new

How to validate URIs by checking if those refer to a given domain name?

倾然丶 夕夏残阳落幕 提交于 2020-01-06 09:09:50
问题 I am running Ruby on Rails 4.1.1 and I would like to validate URIs by checking if those are within a given domain name. That is, a uri string can be sent as params to my controller and I would like to check if that uri "refers" to my application domain name www.myapp.com . Of course, the uri should be a valid URI reference. # Invalid URIs www.website.com http://www.website.com http://www.website.com/ https://www.website.com/ ftp://www.website.com/ ftps://www.website.com/ http://www.website