Java Code Examples for javax.ws.rs.core.MediaType#TEXT_XML
The following examples show how to use
javax.ws.rs.core.MediaType#TEXT_XML .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkedDataServerResource.java From aliada-tool with GNU General Public License v3.0 | 6 votes |
/** * Gets job info. * * @param id the job identifier associated with this instance. * @return a response which includes the info of the job. * @since 1.0 */ @GET @Path("/jobs/{jobid}") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getJob( @Context final HttpServletRequest request, @PathParam("jobid") final Integer jobid) { LOGGER.debug(MessageCatalog._00025_GET_JOB_REQUEST); if (jobid == null) { LOGGER.error(MessageCatalog._00022_MISSING_INPUT_PARAM, "jobid"); return Response.status(Status.BAD_REQUEST).build(); } final DBConnectionManager dbConn = (DBConnectionManager) context.getAttribute("db"); final Job job = dbConn.getJob(jobid); return Response.status(Response.Status.ACCEPTED).entity(job).build(); }
Example 2
Source File: LinksDiscoveryResource.java From aliada-tool with GNU General Public License v3.0 | 6 votes |
/** * Gets job info. * * @param id the job identifier associated with this instance. * @return a response which includes the info of the job. * @since 1.0 */ @GET @Path("/jobs/{jobid}") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getJob( @Context final HttpServletRequest request, @PathParam("jobid") final Integer jobid) { LOGGER.debug(MessageCatalog._00025_GET_JOB_REQUEST); if (jobid == null) { LOGGER.error(MessageCatalog._00022_MISSING_INPUT_PARAM, "jobid"); return Response.status(Status.BAD_REQUEST).build(); } final DBConnectionManager dbConn = (DBConnectionManager) context.getAttribute("db"); final Job job = dbConn.getJob(jobid); return Response.status(Response.Status.ACCEPTED).entity(job).build(); }
Example 3
Source File: IdCardResource.java From openregistry with Apache License 2.0 | 6 votes |
/** * a method to get xml representation of primary id card attached to a person */ @GET @Produces({MediaType.APPLICATION_XML}) @Consumes({MediaType.TEXT_XML}) public IdCardRepresentation getIdCard(@PathParam("personId") String personId){ final Person person = findPersonOrThrowNotFoundException(personId); if( person.getPrimaryIdCard()==null){ //HTTP 404 logger.info("ID card Not not found."); throw new NotFoundException( String.format("The primary Id card for person identified by /people/%s URI does not exist", personId)); } return buildIdCardRepresentation(person,person.getPrimaryIdCard()); }
Example 4
Source File: UserInfo.java From maven-framework-project with MIT License | 5 votes |
@GET @Path("/age/{j}") @Produces(MediaType.TEXT_XML) public String userAge(@PathParam("j") int j) { int age = j; return "<User>" + "<Age>" + age + "</Age>" + "</User>"; }
Example 5
Source File: RDFizerResource.java From aliada-tool with GNU General Public License v3.0 | 5 votes |
/** * Returns a short summary of all jobs managed by this RDFizer instance. * Jobs are divided by status: running and completed. * For each job a minimal set of information are returned, if caller wants to know more about * a specific job then a call to {@link #getJob(Integer)} must be issued. * * @return a short summary of all jobs managed by this RDFizer instance. */ @GET @Path("/jobs") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response getJobs() { return Response.ok() .entity( new Jobs( jobInstanceRepository.findAll( new Sort( Sort.Direction.DESC, "startDate")))) .build(); }
Example 6
Source File: LinkedDataServerResource.java From aliada-tool with GNU General Public License v3.0 | 5 votes |
/** * Creates a new job on the Linked Data Server Component. * * @param id the job identifier associated with this instance. * @return a response which includes the info of the new job. * @since 1.0 */ @POST @Path("/jobs") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response newJob( @Context final HttpServletRequest request, @FormParam("jobid") final Integer jobid) { LOGGER.debug(MessageCatalog._00021_NEW_JOB_REQUEST); if (jobid == null) { LOGGER.error(MessageCatalog._00022_MISSING_INPUT_PARAM, "jobid"); return Response.status(Status.BAD_REQUEST).build(); } //Get configuration parameters final DBConnectionManager dbConn = (DBConnectionManager) context.getAttribute("db"); final JobConfiguration jobConf = dbConn.getJobConfiguration(jobid); if (jobConf == null) { LOGGER.error(MessageCatalog._00023_JOB_CONFIGURATION_NOT_FOUND, jobid); return Response.status(Status.BAD_REQUEST).build(); } //Program linking processes final LinkedDataServerSetup ldsSetup = new LinkedDataServerSetup(); final Job job = ldsSetup.setup(jobConf, dbConn); return Response.created(uriInfo.getAbsolutePathBuilder().build()).entity(job).build(); }
Example 7
Source File: RESTRuleService.java From geofence with GNU General Public License v2.0 | 5 votes |
/** * Move the provided rules to the target priority. Rules will be sorted by their priority, first rule will be updated with a priority equal to the * target priority and the next ones will get an incremented priority value. */ @GET @Path("/move") @Produces(MediaType.TEXT_XML) Response move( @QueryParam("rulesIds") String rulesIds, @QueryParam("targetPriority") Integer targetPriority ) throws BadRequestRestEx, InternalErrorRestEx;
Example 8
Source File: HelloResource.java From secure-data-service with Apache License 2.0 | 5 votes |
@GET @Produces(MediaType.TEXT_XML) public String sayXMLHello() { log.info("Content Type: text/xml"); return XML_HEADER + MESSAGE + XML_FOOTER; }
Example 9
Source File: XstreamResource.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Path("/xml/marshal") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_XML) public String xstreamXmlMarshal(PojoA pojo) { return producerTemplate.requestBody("direct:xstream-xml-marshal", pojo, String.class); }
Example 10
Source File: RESTConfigService.java From geofence with GNU General Public License v2.0 | 4 votes |
/** * @deprecated used for testing only */ @POST @Path("/instances/short") @Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML}) void setInstances(@Multipart("instances")RESTShortInstanceList instances) throws BadRequestRestEx, NotFoundRestEx, InternalErrorRestEx;
Example 11
Source File: RESTConfigService.java From geofence with GNU General Public License v2.0 | 4 votes |
/** * @deprecated used for testing only */ @POST @Path("/groups") @Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML}) void setUserGroups(@Multipart("groups")RESTFullUserGroupList groups) throws BadRequestRestEx, NotFoundRestEx, InternalErrorRestEx;
Example 12
Source File: RESTRuleService.java From geofence with GNU General Public License v2.0 | 4 votes |
@DELETE @Path("/id/{id}") @Produces(MediaType.TEXT_XML) Response delete(@PathParam("id") Long id) throws BadRequestRestEx, NotFoundRestEx;
Example 13
Source File: MCRRestAPIObjects.java From mycore with GNU General Public License v3.0 | 4 votes |
/** * upload a file into a given derivate * @param info - the injected Jersey URIInfo object * @param request - the injected HTTPServletRequest object * * @param mcrObjID - a MyCoRe Object ID * @param mcrDerID - a MyCoRe Derivate ID * * @param uploadedInputStream - the inputstream from HTTP Post * @param fileDetails - file information from HTTP Post * @param path - the target path inside the derivate * @param maindoc - true, if the file should be set as maindoc * @param unzip - true, if the file is a zip file, that should be extracted * @param md5 - the md5 sum of the uploaded file * @param size - the size of the uploaded file * @return a Jersey Response object * @throws MCRRestAPIException */ @POST @Path("/{" + PARAM_MCRID + "}/derivates/{" + PARAM_DERID + "}/contents{path:(/.*)*}") @Produces({ MediaType.TEXT_XML + ";charset=UTF-8" }) @Consumes(MediaType.MULTIPART_FORM_DATA) @MCRRequireTransaction @MCRAccessControlExposeHeaders(HttpHeaders.LOCATION) public Response uploadFile(@Context UriInfo info, @Context HttpServletRequest request, @PathParam(PARAM_MCRID) String mcrObjID, @PathParam(PARAM_DERID) String mcrDerID, @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetails, @FormDataParam("path") String path, @FormDataParam("maindoc") @DefaultValue("false") boolean maindoc, @FormDataParam("unzip") @DefaultValue("false") boolean unzip, @FormDataParam("md5") String md5, @FormDataParam("size") Long size) throws MCRRestAPIException { return MCRRestAPIUploadHelper.uploadFile(info, request, mcrObjID, mcrDerID, uploadedInputStream, fileDetails, path, maindoc, unzip, md5, size); }
Example 14
Source File: StarbucksOutletService.java From product-ei with Apache License 2.0 | 4 votes |
@POST @Path("/orders/") // @Produces(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) // produces application/json @Consumes({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) // consumes text/xml public Response addOrder(Order orderBean);
Example 15
Source File: AssociatedResource.java From lumongo with Apache License 2.0 | 4 votes |
@POST @Produces({ MediaType.TEXT_XML }) public Response post(@QueryParam(LumongoConstants.ID) String uniqueId, @QueryParam(LumongoConstants.FILE_NAME) String fileName, @QueryParam(LumongoConstants.INDEX) String indexName, @QueryParam(LumongoConstants.COMPRESSED) Boolean compressed, @QueryParam(LumongoConstants.META) List<String> meta, InputStream is) { if (uniqueId != null && fileName != null && indexName != null) { HashMap<String, String> metaMap = new HashMap<>(); if (meta != null) { for (String m : meta) { int colonIndex = m.indexOf(":"); if (colonIndex != -1) { String key = m.substring(0, colonIndex); String value = m.substring(colonIndex + 1).trim(); metaMap.put(key, value); } else { throw new WebApplicationException("Meta must be in the form key:value"); } } } try { if (compressed == null) { compressed = false; } indexManager.storeAssociatedDocument(indexName, uniqueId, fileName, is, compressed, metaMap); return Response.status(LumongoConstants.SUCCESS) .entity("Stored associated document with uniqueId <" + uniqueId + "> and fileName <" + fileName + ">").build(); } catch (Exception e) { log.error(e.getClass().getSimpleName() + ": ", e); return Response.status(LumongoConstants.INTERNAL_ERROR).entity(e.getMessage()).build(); } } else { throw new WebApplicationException(LumongoConstants.ID + " and " + LumongoConstants.FILE_NAME + " are required", LumongoConstants.BAD_REQUEST); } }
Example 16
Source File: RESTConfigService.java From geofence with GNU General Public License v2.0 | 4 votes |
/** * @deprecated used for testing only */ @POST @Path("/rules/short") @Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML}) void setRules(@Multipart("rules")RESTOutputRuleList rules) throws BadRequestRestEx, NotFoundRestEx, InternalErrorRestEx;
Example 17
Source File: StarbucksOutletService.java From micro-integrator with Apache License 2.0 | 4 votes |
@POST @Path("/orders/") // @Produces(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) // produces application/json @Consumes({ MediaType.TEXT_XML, MediaType.APPLICATION_XML }) // consumes text/xml public Response addOrder(Order orderBean);
Example 18
Source File: TestRunResource.java From teamengine with Apache License 2.0 | 3 votes |
/** * Processes a request submitted using the POST method. The request entity represents the test subject or provides * metadata about it. The entity body is written to a local file, the location of which is set as the value of the * {@code iut} parameter. * * @param etsCode * A String that identifies the test suite to be run. * @param etsVersion * A String specifying the desired test suite version. * @param entityBody * A File containing the request entity body. * @return An XML representation of the test results. */ @POST @Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_XML }) @Produces("application/xml;qs=0.5;charset='utf-8'") public Source handlePostXml( @PathParam("etsCode") String etsCode, @PathParam("etsVersion") String etsVersion, File entityBody ) { return handlePost( etsCode, etsVersion, entityBody, APPLICATION_XML ); }
Example 19
Source File: MCRRestAPIObjects.java From mycore with GNU General Public License v3.0 | 3 votes |
/** returns a list of derivates for a given MyCoRe Object * * @param info - the injected Jersey URIInfo object * @param request - the injected JAX-WS request object * * @param mcrid - a object identifier of syntax [id] or [prefix]:[id] * @param derid - a derivate identifier of syntax [id] or [prefix]:[id] * * Allowed Prefixes are "mcr" or application specific search keys * "mcr" is the default prefix for MyCoRe IDs. * * @param path - the relative path to a directory inside a derivate * @param format - specifies the return format, allowed values are: * * xml (default value) * * json * * @param depth - the level of subdirectories that should be returned * * @return a Jersey Response object * @throws MCRRestAPIException */ @GET @Produces({ MediaType.TEXT_XML + ";charset=UTF-8", MCRJerseyUtil.APPLICATION_JSON_UTF8 }) @Path("/{" + PARAM_MCRID + "}/derivates/{" + PARAM_DERID + "}/contents{path:(/.*)*}") public Response listContents(@Context UriInfo info, @Context Request request, @PathParam(PARAM_MCRID) String mcrid, @PathParam(PARAM_DERID) String derid, @PathParam("path") @DefaultValue("/") String path, @QueryParam("format") @DefaultValue("xml") String format, @QueryParam("depth") @DefaultValue("-1") int depth) throws MCRRestAPIException { return MCRRestAPIObjectsHelper.listContents(info, app, request, mcrid, derid, format, path, depth); }
Example 20
Source File: TestRunResource.java From teamengine with Apache License 2.0 | 3 votes |
/** * Processes a request submitted using the POST method. The request entity represents the test subject or provides * metadata about it. The entity body is written to a local file, the location of which is set as the value of the * {@code iut} parameter. * * @param etsCode * A String that identifies the test suite to be run. * @param etsVersion * A String specifying the desired test suite version. * @param entityBody * A File containing the request entity body. * @return An RDF (EARL) representation of the test results. */ @POST @Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_XML }) @Produces("application/rdf+xml;qs=0.75;charset='utf-8'") public Source handlePostRdf( @PathParam("etsCode") String etsCode, @PathParam("etsVersion") String etsVersion, File entityBody ) { return handlePost( etsCode, etsVersion, entityBody, APPLICATION_RDF_XML ); }