Java Code Examples for javax.ws.rs.core.MediaType.APPLICATION_XML

The following are Jave code examples for showing how to use APPLICATION_XML of the javax.ws.rs.core.MediaType class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: opencps-v2   File: PaymentFileManagement.java   View Source Code Vote up 6 votes
@PUT
@Path("/{id}/payments/{referenceUid}/approval/noattachment")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@ApiOperation(value = "Update PaymentFile")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updatePaymentFileApprovalNoAttachment(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam(value = "reference of paymentFile", required = true) @PathParam("referenceUid") String referenceUid,
		@BeanParam PaymentFileInputModel input);
 
Example 2
Project: soapbox-race-core   File: MatchMaking.java   View Source Code Vote up 6 votes
@GET
@Secured
@Path("/launchevent/{eventId}")
@Produces(MediaType.APPLICATION_XML)
public SessionInfo launchEvent(@HeaderParam("securityToken") String securityToken, @PathParam("eventId") int eventId) {
	SessionInfo sessionInfo = new SessionInfo();
	SecurityChallenge securityChallenge = new SecurityChallenge();
	securityChallenge.setChallengeId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
	securityChallenge.setLeftSize(14);
	securityChallenge.setPattern("FFFFFFFFFFFFFFFF");
	securityChallenge.setRightSize(50);
	sessionInfo.setChallenge(securityChallenge);
	sessionInfo.setEventId(eventId);
	EventSessionEntity createEventSession = eventBO.createEventSession(eventId);
	sessionInfo.setSessionId(createEventSession.getId());
	tokenSessionBO.setActiveLobbyId(securityToken, 0L);
	return sessionInfo;
}
 
Example 3
Project: kafka-streams-example   File: MetricsResource.java   View Source Code Vote up 6 votes
/**
 * Remote interface for fetching a specific machine's metric
 * @param machine
 * @return Metrics
 */
@GET
@Path("remote/{machine}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Metrics remote(@PathParam("machine") String machine) {
    LOGGER.log(Level.INFO, "Remote interface invoked for machine {0}", machine);
    Metrics metrics = null;
    try {
        metrics = getLocalMetrics(machine);
    } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Error - {0}", e.getMessage());
        e.printStackTrace();
    }

    return metrics;

}
 
Example 4
Project: hadoop   File: HsWebServices.java   View Source Code Vote up 6 votes
@GET
@Path("/mapreduce/jobs/{jobid}/tasks/{taskid}/attempts/{attemptid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TaskAttemptInfo getJobTaskAttemptId(@Context HttpServletRequest hsr,
    @PathParam("jobid") String jid, @PathParam("taskid") String tid,
    @PathParam("attemptid") String attId) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  checkAccess(job, hsr);
  Task task = AMWebServices.getTaskFromTaskIdString(tid, job);
  TaskAttempt ta = AMWebServices.getTaskAttemptFromTaskAttemptString(attId,
      task);
  if (task.getType() == TaskType.REDUCE) {
    return new ReduceTaskAttemptInfo(ta, task.getType());
  } else {
    return new TaskAttemptInfo(ta, task.getType(), false);
  }
}
 
Example 5
Project: hadoop   File: HsWebServices.java   View Source Code Vote up 6 votes
@GET
@Path("/mapreduce/jobs/{jobid}/tasks/{taskid}/counters")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public JobTaskCounterInfo getSingleTaskCounters(
    @Context HttpServletRequest hsr, @PathParam("jobid") String jid,
    @PathParam("taskid") String tid) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  checkAccess(job, hsr);
  TaskId taskID = MRApps.toTaskID(tid);
  if (taskID == null) {
    throw new NotFoundException("taskid " + tid + " not found or invalid");
  }
  Task task = job.getTask(taskID);
  if (task == null) {
    throw new NotFoundException("task not found with id " + tid);
  }
  return new JobTaskCounterInfo(task);
}
 
Example 6
Project: redirector   File: StacksController.java   View Source Code Vote up 5 votes
@GET
@Path("{serviceName}/addresses")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getAddressByStackOrFlavor(@VerifyApplicationExists @PathParam("serviceName") final String serviceName, @QueryParam("stackName") String stackName, @QueryParam("flavorName") String flavorName) {
    try {
        return Response.ok(stacksService.getAddressByStackOrFlavor(serviceName, stackName, flavorName)).build();
    } catch (IllegalArgumentException ex) {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
}
 
Example 7
Project: soapbox-race-core   File: DriverPersona.java   View Source Code Vote up 5 votes
@POST
@Secured
@Path("/DeletePersona")
@Produces(MediaType.APPLICATION_XML)
public String deletePersona(@QueryParam("personaId") Long personaId, @HeaderParam("securityToken") String securityToken) {
	tokenSessionBo.verifyPersona(securityToken, personaId);
	bo.deletePersona(personaId);
	return "<long>0</long>";
}
 
Example 8
Project: opencps-v2   File: DeliverablesManagement.java   View Source Code Vote up 5 votes
@GET
@Path("/deliverables/{id}/update/{deliverableAction}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Update deliverableAction by deliverable id")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access defined", response = ExceptionModel.class) })
public Response getDeliverableAction(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@ApiParam(value = "id of Deliverable", required = true) @PathParam("id") Long id,
		@ApiParam(value = "deliverableAction", required = true) @PathParam("deliverableAction") String deliverableAction);
 
Example 9
Project: opencps-v2   File: RegistrationManagement.java   View Source Code Vote up 5 votes
@GET
@Path("/registrations/{id}/forms/{referenceUid}/preview")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
public Response previewFile(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext,
        @ApiParam(value = "registrationId", required = true) @PathParam("id") long registrationId,
        @ApiParam(value = "referenceUid", required = true) @PathParam("referenceUid") String referenceUid);
 
Example 10
Project: redirector   File: ServersControllerOffline.java   View Source Code Vote up 5 votes
@POST
@Path("{appName}/" + RedirectorConstants.DEFAULT_SERVER_NAME)
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response addServer(@PathParam("appName") final String appName, final Snapshot snapshot){
    operationContextHolder.buildContextFromOfflineSnapshot(appName, snapshot);

    OperationResult result = serverService.saveServer(appName, (Server) snapshot.getEntityToSave(), ApplicationStatusMode.OFFLINE);
    return Response.ok(result).build();
}
 
Example 11
Project: opencps-v2   File: PaymentConfigManagement.java   View Source Code Vote up 5 votes
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add a PaymentConfig", response = PaymentConfigInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the PaymentConfig was created", response = PaymentConfigInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response addPaymentConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @BeanParam PaymentConfigInputModel input);
 
Example 12
Project: redirector   File: RedirectorTestSuiteController.java   View Source Code Vote up 5 votes
@GET
@Path("runAuto/{serviceName}/{mode}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response runTestCase(@PathParam("serviceName") final String serviceName,
                            @PathParam("mode") final String mode,
                            @Context UriInfo ui) {
    TestCaseResultList result = new TestCaseResultList();
    String baseUrl = ui.getQueryParameters().getFirst("baseURL");
    if (isExternalRestMode(mode)) {
        validateUrl(baseUrl);
    }
    result.setItems(testSuiteService.autoCreateTestCasesAndRun(serviceName, mode, baseUrl));
    return Response.ok(result).build();
}
 
Example 13
Project: opencps-v2   File: ApplicantManagement.java   View Source Code Vote up 5 votes
@PUT
@Path("/{id}/profile/{key}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get the profile of applicant", response = JSONObject.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the profile of applicant", response = JSONObject.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateApplicantProfile(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("key") String key,
		@BeanParam ProfileInputModel input);
 
Example 14
Project: opencps-v2   File: UserManagement.java   View Source Code Vote up 5 votes
@POST
@Path("/{id}/changepass")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addChangepass(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id,
		@FormParam("oldPassword") String oldPassword, @FormParam("newPassword") String newPassword);
 
Example 15
Project: fuck_zookeeper   File: SessionsResource.java   View Source Code Vote up 5 votes
@PUT
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML })
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public Response keepAliveSession(@PathParam("session") String session,
        @Context UriInfo ui, byte[] data) {

    if (!ZooKeeperService.isConnected(contextPath, session)) {
        throwNotFound(session, ui);
    }

    ZooKeeperService.resetTimer(contextPath, session);
    return Response.status(Response.Status.OK).build();
}
 
Example 16
Project: redirector   File: NamespaceController.java   View Source Code Vote up 5 votes
@GET
@Path("getOne/{name}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getNamespace(@PathParam("name") final String name) {
    NamespacedList namespacedList = namespacedListsService.getNamespacedListByName(name);
    if (namespacedList == null) {
        return Response.status(Response.Status.NOT_FOUND).build();
    }
    else {
        return Response.ok(namespacedList).build();
    }
}
 
Example 17
Project: opencps-v2   File: ServiceConfigManagement.java   View Source Code Vote up 5 votes
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Update a ServiceConfig by id", response = ServiceConfigInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceConfig was updated", response = ServiceConfigInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateServiceConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "serviceconfigId for updating") @PathParam("id") long id,
		@ApiParam(value = "body params for post") @BeanParam ServiceConfigInputModel input);
 
Example 18
Project: opencps-v2   File: OfficeSiteManagement.java   View Source Code Vote up 5 votes
@PUT
@Path("/{id}/preferences")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response updateOfficeSitePreferences(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @BeanParam OfficeSiteInputModel input);
 
Example 19
Project: GoHost   File: NotificationFacadeREST.java   View Source Code Vote up 4 votes
@POST
@Override
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void create(Notification entity) {
    super.create(entity);
}
 
Example 20
Project: satisfy   File: RestXmlService.java   View Source Code Vote up 4 votes
@PUT
@Consumes(MediaType.APPLICATION_XML)
@Path("/single-user-by-xml")
public void updateUserById(User user) {
    userStorage.updateUserById(user.getId(), user.getFirstName(), user.getLastName());
}