jersey-2.0

Jersey + Spring deployment failure on Glassfish : CDI issue

限于喜欢 提交于 2019-12-13 02:38:23
问题 I'm tryng to setup a Glassfish + Spring configuration. Please find below the relevant part of my pom : <dependencyManagement> <dependencies> <dependency> <groupId>org.glassfish.jersey</groupId> <artifactId>jersey-bom</artifactId> <version>${jersey.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId> <scope

Grizzly Embedded Server + Jersey service + Servlet filter

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:30:48
问题 The following code runs my REST service but my servlet filter never gets called. Any ideas? WebappContext webappContext = new WebappContext("grizzly web context", ""); FilterRegistration testFilterReg = webappContext.addFilter("TestFilter", TestFilter.class); testFilterReg.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), "/*"); ResourceConfig rc = new ResourceConfig().register(MyResource.class); HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create("http:/

How to inject an unbound generic type in HK2?

佐手、 提交于 2019-12-13 01:25:26
问题 I'm writing a webservice using Jersey 2.9 and I'm also using HK2 for DI. I have a class which handles a connection to a database which can be instantiated like that: public class DBHandler { private DBConnection<?> dbConnection; @Inject public DBHandler(DBConnection<?> dbConnection) { this.dbConnection = dbConnection; } } As you can see, field dbConnection has an unbounded generic type. By binding implementation currently looks like follows: public class MyProductionBinder extends

Making Aspectj work on a Spring servlet bean

£可爱£侵袭症+ 提交于 2019-12-13 01:05:33
问题 I am trying to get an aspectprofiler working on a Jersey servlet registered in a spring project. The aspectprofiler is loaded, but don't notice when methods within the Jersey servlet are run. @EnableAutoConfiguration @Configuration @EnableAspectJAutoProxy(proxyTargetClass = true) public class App { public static void main(final String[] args) { final SpringApplicationBuilder sab = new SpringApplicationBuilder(ConsolidatedCustomerMasterApp.class); sab.run(args); } @Bean public

Sending JSON to server is giving 415 Unsupported Media Type

。_饼干妹妹 提交于 2019-12-13 00:41:31
问题 I have the following angular code: <button ng-click="ctrl.submit(light)">Switch</button> and the button click is handled by: self.submit = function(light) { console.log("=============================="); console.log("clicked button: ", light); console.log("=============================="); $http.post('/ARHomeAutomation/rest/light/state/', light).then(function(response) { console.log('headers: ' , response.headers); console.log('status: ', response.status); console.log('config: ', response

How to get plain JSON data in jersey REST implementation?

99封情书 提交于 2019-12-12 23:40:37
问题 If we have a POJO class, then we can map it with some incoming JSON. I am struggling to find out a way by which I can just have all plain json value inside. For ex. { "macro_tasks": [ { "id": "cc5cee68-c1e5-4396-987b-c68559399186", "label": "consi-1", "name": "Consi 1", "project_id": "82d1e463-1bb1-42d3-9adc-9e0d5848d139", "creator_id": null, "created_at": null, "updated_at": null, "meta_data": { "key1": "value1", "key2": 321 } } ] } Here meta_data is of JSON type which can keep changing its

Detecting client-aborting request Jersey

回眸只為那壹抹淺笑 提交于 2019-12-12 16:11:36
问题 I have Jersey providing a restfull web service. It happens often that the client aborts request done via ajax, with the ajax abort methods like is explained here abort ajax request On server side I get the following output. Which is not nice to see. Is there a way to detect an aborted request in Jersey? SEVERE: An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableException: ClientAbortException:

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

半世苍凉 提交于 2019-12-12 10:07:35
问题 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? 回答1:

Getting a whole lot of “scanned from multiple locations” warnings in simple Jersey web app

点点圈 提交于 2019-12-12 08:36:17
问题 Getting back to Java after some time, and I'm trying to get a simple RESTful API going on with Java 8, Jersey 2.27 and Jetty 9.4.9 using the command line. The app does work , but I keep getting hundreds of warnings like: 2018-04-27 01:17:24.845:WARN:oeja.AnnotationParser:main: Unrecognized runtime asm version, assuming 393216 2018-04-27 01:17:24.945:WARN:oeja.AnnotationParser:qtp988458918-12: javax.el.ArrayELResolver scanned from multiple locations: jar:file:///tmp/jetty-0.0.0.0-8081-paste4j

Jersey Multipart - Missing start boundary

▼魔方 西西 提交于 2019-12-12 08:09:11
问题 I have a server application with jersy 2.13 with Netty and I try to upload a file with "multipart/form-data" and I got this error. The Error Message: 7605 10:01:49.309 [child-group-3-1] org.jvnet.mimepull.MIMEParsingException: Missing start boundary 66242 08:57:42.713 [child-group-3-1] ERROR ROOT - No codec available to display error for 'Content-Type:multipart/form-data; boundary=----webkitformboundaryv4kegleyi4tkjp8j' My dependencies compile group: "org.glassfish.jersey.core", name: "jersey