jersey

Updating Tomcat LIb Folder

允我心安 提交于 2019-12-06 11:29:06
i have an application developed by using Jersey Plugin and deployed on Tomact 7 . i have to export all the jars used in the project to the lib/ folder of Tomact .. but i dont want to.. is it possible to deploy my app without exporting jars to Tomcat lib folder . If Yes , then How ? https://t1.ap01.aws.af.cm/rest/person this is my app link and it gives following error if lib/ are not exported: HTTP Status 404 - Servlet Jersey REST Service is not available type Status report message Servlet Jersey REST Service is not available description The requested resource (Servlet Jersey REST Service is

Spring Boot REST API/Spring Security: Return custom message when authentication fails

自作多情 提交于 2019-12-06 11:23:54
I have a Spring Boot app using Jersey as the JAX-RS implementation. This is my security configuration: @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Autowired TokenAuthenticationProvider tokenAuthenticationProvider; @Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(tokenAuthenticationProvider); } @Override protected void configure(HttpSecurity http) throws Exception { http.addFilterBefore(new AuthenticationTokenFilter(

HK2 annotations not being handled

点点圈 提交于 2019-12-06 11:17:22
问题 I'm using HK2 through Jersey, and am looking to get @Immediate services working. In the process, I notice that (as it seems) none of the annotations for my services are getting registered. E.g., after spinning up my ServiceLocator and looking at my descriptor for a service annotated with @Singleton, it is still set as @PerLookup. My code for initiating my application handler is below: ApplicationHandler handler = new ApplicationHandler(resourceConfig, new AbstractBinder() { ... }); My binder

JAX-RS @HeaderParam with List, populated with only one comma separated element

六眼飞鱼酱① 提交于 2019-12-06 09:23:51
问题 This is a JAX-RS specific question. According to @HeaderParam docs: https://docs.oracle.com/javaee/7/api/javax/ws/rs/HeaderParam.html Be List, Set or SortedSet, where T satisfies 2, 3 or 4 above. The resulting collection is read-only. If the type is not one of the collection types listed in 5 above and the header parameter is represented by multiple values then the first value (lexically) of the parameter is used. It's clear from the docs that if there are multiple values for a header then it

Trouble with Jersey MIME Type “text/xml;charset=UTF-8 was not found”

元气小坏坏 提交于 2019-12-06 09:12:14
问题 Why do I get the following Exception when running the program within a jar bundle, but not getting this Exception when executing it within netbeans? com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class javax.xml.bind.JAXBElement, and Java type javax.xml.bind.JAXBElement, and MIME media type text/xml;charset=UTF-8 was not found I am building my program with maven and the assembly plugin. mvn assembly:assembly What does netbeans do different when I am running

Jersey - Obtain the contents of an OutputStream in an Interceptor before calling context.proceed()

空扰寡人 提交于 2019-12-06 08:53:28
Using an Interceptor in Jersey I can manipulate the Output, however, I also want to add a Header to the response which value is calculated from the result of the output. @Sha256Sum public class Sha256SumInterceptor implements WriterInterceptor { public static final String SHA256_HASH_HEADER_NAME = "SHA256-SUM"; @Override public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { // Retrieve the OutputStream, read the contents and calculate the hashsum. // Set the header value in context. context.proceed(); } } However, the issue is that when I

@DefaultValue in JAX-RS for dates: now() and MAX

微笑、不失礼 提交于 2019-12-06 08:50:56
I have a query parameter as following: @GET public Response myFunction(@QueryParam("start") final LocalDate start, @QueryParam("end") final LocalDate end) { ... } For this, I created a ParamConverter<LocalDate> which converts a string to a date, and vice versa. Now I want to use @DefaultValue annotation to declare a default value. I have two special default values: today (for start ) the maximum value/infinity (for end ) Is it possible to use the @DefaultValue annotation for this? How? Yes, @DefaultValue value can be used in this situation: @GET public Response foo(@QueryParam("start")

Spring MVC multiple servlets (Jersey,Dispatcher) problem

喜你入骨 提交于 2019-12-06 08:12:47
I have one DispatcherServlet for my pages, and one ServletContainer for my Jersey webservice. As it is now, no pages are rendering (404), but the service is working fine. How can I run them in conjunction? I saw this thread How to register multiple servlets in web.xml in one Spring application that seems to deal with a similar issue, though that was regarding CXF so I'm unsure how relevant it is. I also tried having a separate Jersey-servlet.xml file, but that made both the pages and the service stop working. Don't really know where to go from this point, any help much appreciated. web.xml: <

Resolve what resource+method a URI would match in Jersey

孤街醉人 提交于 2019-12-06 07:59:20
问题 In our Jersey application we like to present/restrict different parts of our API based on roles. To be specific we would like to only offer links to resources which the role can visit - i.e. already when preparing response A we would not even offer a link to a resource X if the user would not be allowed to use X anyway. To be able to distinguish those links we would like to be able to ask Jersey how it would resolve a certain URI - i.e. to what resource and to what method on that resource. If

How can I enable CDI with Jersey Test Framework?

依然范特西╮ 提交于 2019-12-06 07:56:44
问题 I found How can I inject a data source dependency into a RESTful web service with Jersey (Test Framework)? but I think I'm gonna ask a little bit different question. This is a follow-up question of @PostConstruct of abstract ancestors are not invoked I wrote a JAX-RS library and I'm trying to unit-test with Jersey Test Framework. I seems HK2 injects properly. But I found some of my life cycle interceptor method annotated with @PostConstruct or @PreDestroy aren't invoked (or only some invoked)