Jersey(1.19.1) - Security
Security information is available by obtaining the SecurityContext using @Context, which is essentially the equivalent functionality available on the HttpServletRequest.
SecurityContext can be used in conjunction with sub-resource locators to return different resources if the user principle is included in a certain role. For example, a sub-resource locator could return a different resource if a user is a preferred customer:
@Path("basket")
public ShoppingBasketResource get(@Context SecurityContext sc) {
if (sc.isUserInRole("PreferredCustomer") {
return new PreferredCustomerShoppingBaskestResource();
} else {
return new ShoppingBasketResource();
}
}
Jersey(1.19.1) - Security的更多相关文章
- Jersey(1.19.1) - Client API, Security with Http(s)URLConnection
With Http(s)URLConnection The support for security, specifically HTTP authentication and/or cookie m ...
- Jersey(1.19.1) - Hello World, Get started with Jersey using the embedded Grizzly server
Maven Dependencies The following Maven dependencies need to be added to the pom: <dependency> ...
- Jersey(1.19.1) - Hello World, Get started with a Web application
1. Maven Dependency <properties> <jersey.version>1.19.1</jersey.version> </prop ...
- Jersey(1.19.1) - Deploying a RESTful Web Service
JAX-RS provides a deployment agnostic abstract class Application for declaring root resource and pro ...
- Jersey(1.19.1) - JSON Support
Jersey JSON support comes as a set of JAX-RS MessageBodyReader<T> and MessageBodyWriter<T&g ...
- Jersey(1.19.1) - Root Resource Classes
Root resource classes are POJOs (Plain Old Java Objects) that are annotated with @Path have at least ...
- Jersey(1.19.1) - WebApplicationException and Mapping Exceptions to Responses
Previous sections have shown how to return HTTP responses and it is possible to return HTTP errors u ...
- Jersey(1.19.1) - Life-cycle of Root Resource Classes
By default the life-cycle of root resource classes is per-request, namely that a new instance of a r ...
- Jersey(1.19.1) - Client API, Uniform Interface Constraint
The Jersey client API is a high-level Java based API for interoperating with RESTful Web services. I ...
随机推荐
- JavaScript- 获取经度纬度
昨天获得一个小需求,需要取地理位置. 通过以下的JS能获得经度和纬 if(navigator.geolocation) { navigator.geolocation.getCurrentPositi ...
- EasyUI 下拉列表联动
//绑定部门.人员下拉菜单项 function BindDdl() { var $ddlbm = $("#ddlBm");//部门下拉列表 var $ddlry = $(" ...
- 文件频繁IO能有多大的差别
测试文件写同样大小的文件,单次记录较小和单次记录较大能有多大的性能差别. 最终写入同样大小的文件,小记录需要写入10w次,大记录需要写入1w次,看下最终的性能报告
- Linux学习笔记--(1)
今天用Linux 的 test 命令,发现了一个有趣的现象: 打入 " test "abc"="abc" ;echo $? " 后,结果应该 ...
- Codeforces Round #333 (Div. 2) A. Two Bases 水题
A. Two Bases Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/602/problem/ ...
- pjsip视频通信开发(上层应用)之拨号界面整体界面功能实现
在前面的几章里面写了显示.键盘.拨号.删除功能,这里我将他们进行组合,形成一个拨号键盘全部功能.首先是布局 <LinearLayout xmlns:android="http://sc ...
- MultiCardMenu
https://github.com/wujingchao/MultiCardMenu MultiCardMenu-master.zip
- Android短信彩信收发流程(应用层)
下图为ComposeMessageActivity中confirmSendMessageIfNeeded部分的信息发送流程.主要以接收者有效性的确认为主,然后转向sendMessage方法进行发送. ...
- [AngularJS] Javascript scope and AngularJS $scope
Scope resolution of our Angular documents works exactly the same way scope resolution works in plain ...
- 【zabbix系列】报警系统的设置和排除
关于邮件报警,有非常多方案,这里选择的是稳定性较好.使用较多的msmtp+mutt方案. 该方案有一个非常好的地方在于不用自己来搭建独立的mailserver,能够使用第三方mail.这样的方法不仅能 ...