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的更多相关文章

  1. 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 ...

  2. 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> ...

  3. Jersey(1.19.1) - Hello World, Get started with a Web application

    1. Maven Dependency <properties> <jersey.version>1.19.1</jersey.version> </prop ...

  4. Jersey(1.19.1) - Deploying a RESTful Web Service

    JAX-RS provides a deployment agnostic abstract class Application for declaring root resource and pro ...

  5. Jersey(1.19.1) - JSON Support

    Jersey JSON support comes as a set of JAX-RS MessageBodyReader<T> and MessageBodyWriter<T&g ...

  6. Jersey(1.19.1) - Root Resource Classes

    Root resource classes are POJOs (Plain Old Java Objects) that are annotated with @Path have at least ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. C#学习笔记(九):LINQ和表达式树

    LINQ LINQ:语言集成查询(Language Integrated Query)是一组用于c#和Visual Basic语言的扩展.它允许编写C#或者Visual Basic代码以查询数据库相同 ...

  2. [IoC容器Unity] :Unity预览

    1.引言 高内聚,低耦合成为一个OO架构设计的一个参考标准.高内聚是一个模块或者一个类中成员跟这个模块或者类的关系尽量高,低耦合是不同模块或者不同类之间关系尽量简单. 拿咱国家举例来说,假如你是中国人 ...

  3. ECSHOP数据表结构完整仔细说明教程

    From:http://www.ecshop119.com/ecshopjc-868.html s_account_log //用户账目日志表 字段 类型 Null 默认 注释 log_id medi ...

  4. CSS 文本格式

    整理自:(http://www.w3school.com.cn/css/css_text.asp) Text Color 颜色属性被用来设置文字的颜色. 颜色是通过CSS最经常的指定: 十六进制值 - ...

  5. sql prompt格式设置

    sql prompt格式设置. 格式前: 格式后:

  6. apacheserver下载、安装、配置

     1.下载 下载地址:apache下载地址 点击左側"Download"下的链接,打开例如以下页面 这里能够选择版本号.我选择2.4.16.单击"2.4.16" ...

  7. .net自动生成版本号

    在 AssemblyInfo.cs 文件中 修改 一下属性 [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFi ...

  8. 一个简单的小例子让你明白c#中的委托-终于懂了!

    模拟主持人发布一个问题,由多个嘉宾来回答这个问题. 分析:从需求中抽出Host (主持人) 类和Guests (嘉宾) 类. 作为问题的发布者,Host不知道问题如何解答.因此它只能发布这个事件,将事 ...

  9. alternatives命令使用方法

    alternatives命令使用方法 alternatives是Linux下的一个功能强大的命令.仅仅能在root权限下运行.如系统中有几个命令功能十分相似,却又不能任意删除,那么能够用 altern ...

  10. 个人对maven pom.xml文件的理解

    如:一个项目可能需要引用另外两个项目的类.. 如 项目cswebbefore  需要引用cswebservice 和reports 这三个项目都有各自的pom.xml文件 cswebservice 项 ...