jersey

Is there any way to know which parameter is being parsed in a Jersey @__Param fromString handler?

隐身守侯 提交于 2019-12-19 05:21:25
问题 The API I'm working with has decided to accept UUIDs as Base32 encoded strings, instead of the standard hexadecimal, dash separated format that UUID.fromString() expects. This means that I can't simply write @QueryParam UUID myUuid as a method parameter, as the conversion would fail. I'm working around this by writing a custom object with a different fromString converter to be used with the Jersey @QueryString and @FormParam annotations. I would like to be able to access the context of the

trying to connecting jaserper server using jersy api throw exception?

微笑、不失礼 提交于 2019-12-19 04:53:12
问题 When i am trying to connecting jaserper server using jersy api throw exception java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.AbstractActiveDescriptor code bellow here RestClientConfiguration configuration = new RestClientConfiguration("//localhost:80/jasperserver"); JasperserverRestClient client = new JasperserverRestClient(configuration); //Session session = client.authenticate("jasperadmin", "jasperadmin"); OperationResult<InputStream> result = client .authenticate("jasperadmin",

How do I use a custom validator with dropwizard?

混江龙づ霸主 提交于 2019-12-19 04:52:27
问题 I have a REST api written by someone else in which the method that handles the request to a particular url accepts a bunch of parameters that are populated from path parameters. @POST @Path("/{classid}/{studentid}/details") @Consumes(MediaType.MULTIPART_FORM_DATA) @SuppressWarnings("unchecked") public Response processFile(@FormDataParam("sourceFile") InputStream aStream, @PathParam("classid") String classId, @PathParam("studentid") String studentId, @Context HttpServletRequest httpRequest) {

How to customise the XML output of a Jersey JAXB serialisation

岁酱吖の 提交于 2019-12-19 03:31:14
问题 I have some @javax.xml.bind.annotation.Xml... annotated classes here intended for a RESt web service. Jersey is setup in a spring managed web container and the web service is returning a well formatted xml. We use the maven-enunciate-plugin to document the web service and create the xsd to the returned xml documents. I now would like to use the documentation xsd file as a schemaLocation within the returned xml file so that the xml validation won't complain about missing definions. How can I

Enabling OAuth1 Support on a Jersey Jax-rs web service

别等时光非礼了梦想. 提交于 2019-12-19 03:24:36
问题 I'd like to enable OAuth1 Provider support on my restful web service. Jersey supports this as described here Jersey OAuth1 Provider support. I've been trying to register it as so: public ApplicationConfig(){ super(); addRestResourceClasses(getMyResourceClasses()); register(new OAuth1ServerFeature(new DefaultOAuth1Provider(),"/oauth/access_token","/oauth/request_token")); } But, when I register the OAuth1ServerFeature, I get a 404 when trying to access my resources. Can't seem to find any

Get handler from URI in Jersey?

断了今生、忘了曾经 提交于 2019-12-19 03:24:27
问题 Inside a ContainerResponseFilter I would like to get the "handler", i.e. the class where @Path and the @GET / @PUT -annotated method matches the URL I will provide. Example: someJerseyVariable.getHandlerForURI(request.getRequestUri()); I can't find any similar method. The reason I want this, is to have statistics for how many requests each handler served and how many succeeded/failed. Any other alternatives are also welcome. 回答1: You can inject UriInfo or ExtendedUriInfo. UriInfo contains

Jersey: Consume all POST data into one object

谁说我不能喝 提交于 2019-12-19 03:21:42
问题 I am using Jersey 1.8 in my application. I am trying to consume POST data at the server. The data is of the type application/x-www-form-urlencoded . Is there a method to get all the data in one object, maybe a Map<String, Object> . I ran into Jersey's @Consumes(MediaType.APPLICATION_FORM_URLENCODED) . But using this would require me to use @FormParam , which can be tedious if the number of parameters are huge. Or maybe one way is this: @POST @Path("/urienodedeample") @Consumes(MediaType

Upgrading to Jackson 2.0 from 1.9 in Jersey not working

天涯浪子 提交于 2019-12-19 02:05:12
问题 I'm using Jackson (in Jersey) to serialize entities, and I'm migrating from Jackson 1.9 to 2.0. I followed this guide, and at first it seemed like everything worked out easily. But a closer look reveals that Jackson 1.9 is still being used to serialize my responses, and therefore ignoring my (migrated) Jackson 2.0 annotation. You can see which annotations I'm using in the following code fragment: @JsonInclude(JsonInclude.Include.NON_EMPTY) public abstract class IdEntity { @Id @JsonDeserialize

Swagger Java common header

こ雲淡風輕ζ 提交于 2019-12-19 00:23:46
问题 I have a REST API server implemented with Jersey2.0 and integrated with Swagger to automate docs and client side applications. We have our own authentication header ( X-Auth-Token ) which should be applied to all requests in order to use them (Beside the login request that retrieves the token if credentials are correct). Right now I need to manually add the the token as ApiImplicitParam annotation to each of the requests in order for the generated docs to include it: @ApiImplicitParams({

How to write an XML MessageBodyWriter provider with jersey

十年热恋 提交于 2019-12-18 13:27:45
问题 I am not trying to solve any problem in particular, but rather I am on a learning path to jersey. I have an entity class marked like this: @Entity @Table(name = "myentity") @XmlRootElement public class MyEntity implements serializable { // lots of methods... } and the corresponding jersey service @Stateless @Path("entity") public class EntityFacade { @GET @Path("{param}") @Produces({"application/xml;charset=UTF-8"}) public List<MyEntity> find(@PathParam("param") String param) { List entities