jsr250

How to deploy Apache CXF webservice to Glassfish

爷,独闯天下 提交于 2019-12-23 09:05:41
问题 I have a web service client generated and built with Apache CXF. Next I have JAX-RS Jersey application in which I want to call methods from that webservice. When I try to deploy this simple project to Glassfish 4.0 server I get this exception: Exception while deploying the app [pelijee] : The lifecycle method [finalizeConfig] must not throw a checked exception. Related annotation information: annotation [@javax.annotation.PostConstruct()] on annotated element [public void org.apache.cxf

Custom HTTP status response with JAX-RS (Jersey) and @RolesAllowed

流过昼夜 提交于 2019-12-18 11:07:52
问题 With my very simple JAX-RS service I'm using Tomcat with JDBC realm for authentication, therefore I'm working the the JSR 250 annotations. The thing is that I want to return a custom message body in the HTTP status response. The status code (403) should stay the same. For example, my service looks like the following: @RolesAllowed({ "ADMIN" }) @Path("/users") public class UsersService { @GET @Produces(MediaType.TEXT_PLAIN) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})

Spring Authorization via Annotations not working with custom Authentication

有些话、适合烂在心里 提交于 2019-12-11 13:36:34
问题 I've overwritten the BasicAuthenticationFilter and replaced it with our a filter to fetch a custom Authentication object from db and set it via SecurityContextHolder.getContext().setAuthentication(auth); Here is the important fraction of the security config: <http use-expressions="true" entry-point-ref="authEntryPoint"> <custom-filter position="BASIC_AUTH_FILTER" ref="basicProcessingFilter" /> <intercept-url pattern="/**" access="hasRole('user')"/> </http> <beans:bean id="authEntryPoint"

How do I add javax.annotation.Generated to Java SE 5?

南楼画角 提交于 2019-12-01 02:48:11
问题 I'm working on a project that has to run on Java SE 5 and Java SE 6. I recently started using a tool that adds @Generated annotations to generated code, and I want to keep those annotations. It looks like javax.annotation.Generated is in Java 5 EE and Java 6 SE and later, but is not in the Java 5 SE API. What's the best way to include javax.annotation.Generated when I send it to the customer, so it will run on both Java SE 5 and Java SE 6 without any problems? Do I just need to include an

Custom HTTP status response with JAX-RS (Jersey) and @RolesAllowed

泪湿孤枕 提交于 2019-11-30 01:57:37
With my very simple JAX-RS service I'm using Tomcat with JDBC realm for authentication, therefore I'm working the the JSR 250 annotations. The thing is that I want to return a custom message body in the HTTP status response. The status code (403) should stay the same. For example, my service looks like the following: @RolesAllowed({ "ADMIN" }) @Path("/users") public class UsersService { @GET @Produces(MediaType.TEXT_PLAIN) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public String getUsers() { // get users ... return ...; } } If a user with a different role than "ADMIN"