Java 类javax.ws.rs.PathParam 实例源码

项目:gitplex-mit    文件:CommitStatusResource.java   
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{projectName}/statuses/{commit}")
   @POST
   public Response save(@PathParam("projectName") String projectName, @PathParam("commit") String commit, 
        Map<String, String> commitStatus, @Context UriInfo uriInfo) {

    Project project = getProject(projectName);
    if (!SecurityUtils.canWrite(project))
        throw new UnauthorizedException();

    String state = commitStatus.get("state").toUpperCase();
    if (state.equals("PENDING"))
        state = "RUNNING";
    Verification verification = new Verification(Verification.Status.valueOf(state), 
            new Date(), commitStatus.get("description"), commitStatus.get("target_url"));
    String context = commitStatus.get("context");
    if (context == null)
        context = "default";
    verificationManager.saveVerification(project, commit, context, verification);
    UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
    uriBuilder.path(context);
    commitStatus.put("id", "1");

    return Response.created(uriBuilder.build()).entity(commitStatus).type(RestConstants.JSON_UTF8).build();
   }
项目:xsharing-services-router    文件:ControlResource.java   
@PUT
@Path("/log/change-level/{loggerName}/{newLevel}")
public Response changeLogLevel(@PathParam("loggerName") String loggerName,
                               @PathParam("newLevel") String newLevel) {

    LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
    Configuration config = ctx.getConfiguration();
    LoggerConfig loggerConfig = config.getLoggerConfig(loggerName);

    if (loggerConfig.getName().equals(LogManager.ROOT_LOGGER_NAME)) {
        return Response.ok("Not found", MediaType.TEXT_PLAIN).build();
    }

    loggerConfig.setLevel(Level.valueOf(newLevel));
    ctx.updateLoggers();  // This causes all Loggers to refetch information from their LoggerConfig.

    return Response.ok("Done", MediaType.TEXT_PLAIN).build();
}
项目:holon-examples    文件:ProductEndpoint.java   
@GET
@Path("/products/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response getProduct(@PathParam("id") Long id) {
    return getProductStore().get(id).map(p -> Response.ok(p).build())
            .orElse(Response.status(Status.NOT_FOUND).build());
}
项目:osc-core    文件:ApplianceApis.java   
@ApiOperation(value = "Creates a new appliance software version for a software function model",
        notes = "Creates a new appliance software version for a software function model",
        response = BaseResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{applianceId}/versions")
@POST
public Response createApplianceSoftwareVersion(@Context HttpHeaders headers,
        @ApiParam(value = "Id of the Appliance Model", required = true) @PathParam("applianceId") Long applianceId, @ApiParam(required = true) ApplianceSoftwareVersionDto asvDto) {

    logger.info("Creating an Appliance Software Version");
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    this.apiUtil.setIdAndParentIdOrThrow(asvDto, null, applianceId, "Appliance Sofftware Version");

    return this.apiUtil.getResponseForBaseRequest(this.addApplianceSoftwareVersionService, new BaseRequest<ApplianceSoftwareVersionDto>(asvDto));
}
项目:scott-eu    文件:ServiceProviderService1.java   
@GET
@Path("{planId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlanAsHtml(
    @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("planId") final String planId
    ) throws ServletException, IOException, URISyntaxException
{
    // Start of user code getPlanAsHtml_init
    // End of user code

    final Plan aPlan = PlannerReasonerManager.getPlan(httpServletRequest, serviceProviderId, planId);

    if (aPlan != null) {
        httpServletRequest.setAttribute("aPlan", aPlan);
        // Start of user code getPlanAsHtml_setAttributes
        // End of user code

        RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/plan.jsp");
        rd.forward(httpServletRequest,httpServletResponse);
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
项目:vc    文件:PersonResource.java   
@DELETE
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Person deletePerson(@PathParam("id") String id) {
    Person PersonResponse = Person_Service.deletePerson(id);
    return PersonResponse;
}
项目:scott-eu    文件:ServiceProviderService1.java   
@GET
@Path("places/{placeId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlaceAsHtml(
    @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("placeId") final String placeId
    ) throws ServletException, IOException, URISyntaxException
{
    // Start of user code getPlaceAsHtml_init
    // End of user code

    final Place aPlace = WarehouseControllerManager.getPlace(httpServletRequest, serviceProviderId, placeId);

    if (aPlace != null) {
        httpServletRequest.setAttribute("aPlace", aPlace);
        // Start of user code getPlaceAsHtml_setAttributes
        // End of user code

        RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/place.jsp");
        rd.forward(httpServletRequest,httpServletResponse);
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
项目:lra-service    文件:Coordinator.java   
@GET
@Path("{NestedLraId}/status")
public Response getNestedLRAStatus(@PathParam("NestedLraId")String nestedLraId) {
    if (!lraService.hasTransaction(nestedLraId)) {
        // it must have compensated TODO maybe it's better to keep nested LRAs in separate collection
        return Response.ok(CompensatorStatus.Compensated.name()).build();
    }

    Transaction lra = lraService.getTransaction(toURL(nestedLraId));
    CompensatorStatus status = lra.getLRAStatus();

    if (status == null || lra.getLRAStatus() == null) {
        LRALogger.i18NLogger.error_cannotGetStatusOfNestedLra(nestedLraId, lra.getId());
        throw new IllegalLRAStateException(nestedLraId, "The LRA is still active", "getNestedLRAStatus");
    }

    return Response.ok(lra.getLRAStatus().name()).build();
}
项目:presto-manager    文件:LogsAPI.java   
@GET
@Path("/{file}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get Presto log file")
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "Retrieved logs"),
        @ApiResponse(code = 400, message = "Invalid parameters"),
        @ApiResponse(code = 404, message = "Resource not found")})
public Response getLog(
        @PathParam("file") @ApiParam("The name of a file") String file,
        @QueryParam("from") @ApiParam("Ignore logs before this date") Instant fromDate,
        @QueryParam("to") @ApiParam("Ignore logs after this date") Instant toDate,
        @QueryParam("level") @ApiParam("Only get logs of this level") @DefaultValue(LogsHandler.DEFAULT_LOG_LEVEL) String level,
        @QueryParam("n") @ApiParam("The maximum number of log entries to get") Integer maxEntries)
{
    return logsHandler.getLogs(file, fromDate, toDate, level, maxEntries);
}
项目:bootstrap    文件:ApiTokenResource.java   
/**
 * Update a named token with a new generated one.
 * 
 * @param name
 *            Token to update.
 * @return the new generated token.
 */
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path("{name:[\\w\\-\\.]+}")
public String update(@PathParam("name") final String name) throws GeneralSecurityException {
    final SystemApiToken entity = repository.findByUserAndName(securityHelper.getLogin(), name);
    if (entity == null) {
        // No token with given name
        throw new EntityNotFoundException();
    }

    // Token has been found, update it
    final String token = newToken(entity);
    repository.saveAndFlush(entity);
    return token;
}
项目:dremio-oss    文件:HomeResource.java   
@PUT
@Path("file_format/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path)
    throws FileNotFoundException, HomeNotFoundException, NamespaceException {
  FilePath filePath = FilePath.fromURLPath(homeName, path);
  // merge file configs
  final DatasetConfig existingDSConfig = namespaceService.getDataset(filePath.toNamespaceKey());
  final FileConfig oldConfig = toFileConfig(existingDSConfig);
  final FileConfig newConfig = fileFormat.asFileConfig();
  newConfig.setCtime(oldConfig.getCtime());
  newConfig.setFullPathList(oldConfig.getFullPathList());
  newConfig.setName(oldConfig.getName());
  newConfig.setOwner(oldConfig.getOwner());
  newConfig.setLocation(oldConfig.getLocation());
  catalogService.createOrUpdateDataset(namespaceService, new NamespaceKey(HomeFileConfig.HOME_PLUGIN_NAME), filePath.toNamespaceKey(), toDatasetConfig(newConfig, DatasetType.PHYSICAL_DATASET_HOME_FILE,
    securityContext.getUserPrincipal().getName(), existingDSConfig.getId()));
  return new FileFormatUI(FileFormat.getForFile(newConfig), filePath);
}
项目:osc-core    文件:ApplianceApis.java   
@ApiOperation(value = "Deletes a Security Function Software Version",
        notes = "Deletes a Security Function Software Version if not referenced by any Distributed Appliances")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
        @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{applianceId}/versions/{ApplianceSoftwareVersionId}")
@DELETE
public Response deleteApplianceSoftwareVersion(@Context HttpHeaders headers,
        @ApiParam(value = "Id of the Appliance Model", required = true) @PathParam("applianceId") Long applianceId,
        @ApiParam(value = "Id of the Appliance Software Version",
        required = true) @PathParam("ApplianceSoftwareVersionId") Long applianceSoftwareVersionId) {
    logger.info(
            "Deleting Appliance Software Version " + applianceSoftwareVersionId + " from appliance " + applianceId);
    this.userContext.setUser(OscAuthFilter.getUsername(headers));
    return this.apiUtil.getResponseForBaseRequest(this.deleteApplianceSoftwareVersionService,
            new BaseIdRequest(applianceSoftwareVersionId, applianceId));
}
项目:scott-eu    文件:ResourceShapeService.java   
@GET
@Path("{resourceShapePath}")
@Produces({ MediaType.TEXT_HTML })
public Response getResourceShapeAsHtml(
        @PathParam("resourceShapePath") final String resourceShapePath
    ) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
{
    final Class<?> resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath);
    ResourceShape aResourceShape = null;

    if (resourceClass != null)
    {
        aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null);
        httpServletRequest.setAttribute("aResourceShape", aResourceShape);

        RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/resourceshape.jsp");
        rd.forward(httpServletRequest,httpServletResponse);
    }
    throw new WebApplicationException(Status.NOT_FOUND);
}
项目:marathonv5    文件:LiveSalesListFacadeREST.java   
@GET
@Produces({"application/xml", "application/json"})
@Path("/recent/region/producttype/{regionName}/{productTypeId}")
public List<LiveSalesList> findRecentRegionProductType(@PathParam("regionName") String regionName, @PathParam("productTypeId") Integer productTypeId) {
    CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
    javax.persistence.criteria.CriteriaQuery cq = cb.createQuery();
    Root<LiveSalesList> liveSalesList = cq.from(LiveSalesList.class);
    cq.select(liveSalesList);
    cq.where(cb.and(
            cb.equal(liveSalesList.get(LiveSalesList_.productTypeId), productTypeId), 
            cb.equal(liveSalesList.get(LiveSalesList_.region), regionName)
    ));
    Query q = getEntityManager().createQuery(cq);
    q.setMaxResults(500);
    return q.getResultList();
}
项目:dremio-oss    文件:HomeResource.java   
@POST
@Path("/folder/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Folder createFolder(FolderName name, @PathParam("path") String path) throws Exception  {
  String fullPath = PathUtils.toFSPathString(Arrays.asList(path, name.toString()));
  FolderPath folderPath = FolderPath.fromURLPath(homeName, fullPath);

  final FolderConfig folderConfig = new FolderConfig();
  folderConfig.setFullPathList(folderPath.toPathList());
  folderConfig.setName(folderPath.getFolderName().getName());
  try {
    namespaceService.addOrUpdateFolder(folderPath.toNamespaceKey(), folderConfig);
  } catch(NamespaceNotFoundException nfe) {
    throw new ClientErrorException("Parent folder doesn't exist", nfe);
  }

  return newFolder(folderPath, folderConfig, null);
}
项目:marathonv5    文件:LiveSalesListFacadeREST.java   
@GET
@Produces({"application/xml", "application/json"})
@Path("/recent/region/producttype/{regionName}/{productTypeId}/{orderLineId}")
public List<LiveSalesList> findRecentRegionProductTypeFrom(@PathParam("regionName") String regionName, @PathParam("productTypeId") Integer productTypeId, @PathParam("orderLineId") Integer orderLineId) {
    CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
    javax.persistence.criteria.CriteriaQuery cq = cb.createQuery();
    Root<LiveSalesList> liveSalesList = cq.from(LiveSalesList.class);
    cq.select(liveSalesList);
    cq.where(cb.and(
        cb.equal(liveSalesList.get(LiveSalesList_.productTypeId), productTypeId),
        cb.equal(liveSalesList.get(LiveSalesList_.region), regionName),
        cb.gt(liveSalesList.get(LiveSalesList_.orderLineId), orderLineId)
    ));
    Query q = getEntityManager().createQuery(cq);
    q.setMaxResults(500);
    return q.getResultList();
}
项目:personium-core    文件:RoleResource.java   
/**
     * Box単位のRoleリソースのルート.
     * Boxに紐付いたロール一覧を返す。
     * Box名として__を指定されたときは、Cellレベルのロールとみなす。
     * @param boxName boxName
     * @param authzHeader authzHeader
     * @return JAXRS Response
     */
    @Path("{box}")
    @GET
    public final Response cellRole(
            @PathParam("box") String boxName,
            @HeaderParam(HttpHeaders.AUTHORIZATION) final String authzHeader) {
        // アクセス制御
        this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), CellPrivilege.AUTH_READ);
        // BoxパスがCell Levelであれば、Cell レベルロールを検索して一覧で返す。
        if (BOX_PATH_CELL_LEVEL.equals(boxName)) {
            // TODO Bodyの生成
//            EntitiesResponse er = this.op.getEntities(Role.EDM_TYPE_NAME, null);
            return Response.ok().entity(boxName).build();
        }
        try {
//            EntityResponse boxEr = op.getEntity(Box.EDM_TYPE_NAME, OEntityKey.create(boxName), null);
//            EntitiesResponse rolesEr = (EntitiesResponse) op.getNavProperty(Role.EDM_TYPE_NAME,
//                    OEntityKey.create(boxName),
//                    "_role",  null);
            // TODO Bodyの生成
            return Response.ok().entity(boxName).build();
        } catch (PersoniumCoreException pce) {
            if (PersoniumCoreException.OData.NO_SUCH_ENTITY == pce) {
                throw PersoniumCoreException.Dav.BOX_NOT_FOUND;
            }
            throw pce;
        }
    }
项目:syndesis    文件:JsonDBResource.java   
@Path("/{path: .*}.json")
@Consumes(APPLICATION_JSON)
@DELETE
public Response delete(@PathParam("path") String path) {
    Response.Status status;
    if( jsondb.delete(path) ) {
        status = Response.Status.NO_CONTENT;
    } else {
        status = Response.Status.NOT_FOUND;
    }
    return Response.status(status).build();
}
项目:E-Clinic    文件:ContactRestEndPoint.java   
@DELETE
@Path("delete/{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response delete(@PathParam("id") String id) throws Throwable {
    try {
        Contact get = contactService.get(Integer.valueOf(id));
        contactService.delete(get);
    } catch (Exception ex) {
        return Response.ok().header("Exception", ex.getMessage()).build();
    }
    return Response.ok().entity("Data is deleted").build();
}
项目:verify-hub    文件:IdentityProviderResource.java   
@GET
@Path(Urls.ConfigUrls.ENABLED_ID_PROVIDERS_FOR_SIGN_IN_PATH)
@Timed
public Collection<String> getEnabledIdentityProviderEntityIdsForSignIn(
        @PathParam(Urls.ConfigUrls.ENTITY_ID_PATH_PARAM) final String transactionEntityId) {
    return getIdpListForSignIn(transactionEntityId).stream().map(idp -> idp.getEntityId()).collect(Collectors.toList());
}
项目:E-Clinic    文件:PharmacistRestEndPoint.java   
@GET
@Path("find/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response find(@PathParam("id") @Valid String id) {
    JsonObject build = null;
    try {
        Pharmacist get = pharmacistService.get(Integer.valueOf(id));
        build = Json.createObjectBuilder().add("id", get.getPharmacistId()).add("name", get.getPersonId().getFirstName()).build();

    } catch (Exception ex) {
        return Response.ok().header("Exception", ex.getMessage()).build();
    }
    return Response.ok().entity(build == null ? "No data found" : build).build();
}
项目:mid-tier    文件:LocationEventServiceExposure.java   
@GET
@Path("{category}")
@Produces({ "application/hal+json", "application/hal+json;concept=eventcategory;v=1"})
@ApiOperation(value = "obtain all events scoped to a certain category", response = EventsRepresentation.class,
        notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
                "subscribers to the customer service should be able to listen for and react to. In other words this is the authoritative" +
                "feed for the customer service, allowing for subscribers to have these grouped into categories",
        authorizations = {
                @Authorization(value = "oauth2", scopes = {}),
                @Authorization(value = "oauth2-cc", scopes = {}),
                @Authorization(value = "oauth2-ac", scopes = {}),
                @Authorization(value = "oauth2-rop", scopes = {}),
                @Authorization(value = "Bearer")
        },
        tags = {"interval", "events"},
        produces = "application/hal+json,  application/hal+json;concept=eventcategory;v=1",
        nickname = "getlocationEventsByCategory"
    )
@ApiResponses(value = {
        @ApiResponse(code = 415, message = "Content type not supported.")
    })
public Response getByCategory(@Context UriInfo uriInfo, @Context Request request,
                              @HeaderParam("Accept") String accept, @PathParam("category") String category,
                              @QueryParam("interval") String interval) {
    return eventCategoryProducers.getOrDefault(accept, this::handleUnsupportedContentType)
            .getResponse(uriInfo, request, category, interval);
}
项目:flightmanager    文件:CompanyResource.java   
/**
 * PUT method for updating or creating an instance of CompanyResource
 *
 * @param content representation for the resource
 */
@PUT
@Path("{id}")
@Consumes(MediaType.APPLICATION_JSON)
public void putCompany(@PathParam("id") long id, Company content) {
    content.setId(id);
    DAOFactory.INSTANCE.getCompanyDAO().update(content);
}
项目:E-Clinic    文件:ClinicManagerRestEndPoint.java   
@DELETE
@Path("delete/{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response delete(@PathParam("id") String id) throws Throwable {
    try {
        Clinicmanager get = clinicManagerService.get(Integer.valueOf(id));
        clinicManagerService.delete(get);
    } catch (Exception ex) {
        return Response.ok().header("Exception", ex.getMessage()).build();
    }
    return Response.ok().entity("Data is deleted").build();
}
项目:opencps-v2    文件:DossierManagement.java   
@GET
@Path("/{id}/correcting")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Owner requset correcting for Dossier", response = DossierDetailModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier has been correcting requested", response = DossierDetailModel.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 correctingDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext, @PathParam("id") String id);
项目:paraflow    文件:HelloWorldService.java   
@GET
@Path("/{param}")
public Response getMsg(@PathParam("param") String msg)
{
    String output = "Hello say : " + msg;
    return Response.status(200).entity(output).build();
}
项目:javaee8-jaxrs-sample    文件:CommentsResource.java   
@Path("{commentId}")
@DELETE
public Response deleteComment(@PathParam("commentId") Long commentId) {
    return comments.findOptionalById(commentId)
        .map(c -> comments.delete(c))
        .map(c -> Response.noContent().build())
        .orElseThrow(() -> new CommentNotFoundException(commentId));

}
项目:plugin-vm-vcloud    文件:VCloudPluginResource.java   
/**
 * Find the virtual machines matching to the given criteria. Look into
 * virtual machine name only.
 * 
 * @param node
 *            the node to be tested with given parameters.
 * @param criteria
 *            the search criteria. Case is insensitive.
 * @return virtual machines.
 */
@GET
@Path("{node:[a-z].*}/{criteria}")
@Consumes(MediaType.APPLICATION_JSON)
public List<VCloudVm> findAllByName(@PathParam("node") final String node, @PathParam("criteria") final String criteria)
        throws IOException, SAXException, ParserConfigurationException {
    // Check the node exists
    if (nodeRepository.findOneVisible(node, securityHelper.getLogin()) == null) {
        return Collections.emptyList();
    }

    // Get the VMs and parse them
    return toVms(getVCloudResource(pvResource.getNodeParameters(node),
            "/query?type=vm&format=idrecords&filter=name==*" + criteria + "*&sortAsc=name&fields=name,guestOs&pageSize=10"));
}
项目:gitplex-mit    文件:PullRequestResource.java   
@Path("/{name}/pulls/{pullRequestNumber}/commits")
@GET
public Response getCommits(@PathParam("name") String projectName, 
        @PathParam("pullRequestNumber") Long pullRequestNumber) {
    Project project = getProject(projectName);

    if (!SecurityUtils.canRead(project))
        throw new UnauthorizedException("Unauthorized access to project '" + projectName + "'");

    PullRequest request = pullRequestManager.find(project, pullRequestNumber);
    List<Map<String, Object>> entity = new ArrayList<>();
    for (RevCommit commit: request.getCommits()) {
        Map<String, Object> commitMap = new HashMap<>();
        commitMap.put("sha", commit.name());

        Map<String, Object> commitDetailMap = new HashMap<>();
        Map<String, String> authorMap = new HashMap<>();
        authorMap.put("name", commit.getAuthorIdent().getName());
        authorMap.put("email", commit.getAuthorIdent().getEmailAddress());
        authorMap.put("date", new SimpleDateFormat(RestConstants.DATE_FORMAT).format(commit.getAuthorIdent().getWhen()));
        commitDetailMap.put("author", authorMap);

        Map<String, String> committerMap = new HashMap<>();
        committerMap.put("name", commit.getCommitterIdent().getName());
        committerMap.put("email", commit.getCommitterIdent().getEmailAddress());
        committerMap.put("date", new SimpleDateFormat(RestConstants.DATE_FORMAT).format(commit.getCommitterIdent().getWhen()));
        commitDetailMap.put("committer", authorMap);

        commitMap.put("commit", commitDetailMap);

        entity.add(commitMap);
    }
    return Response.ok(entity, RestConstants.JSON_UTF8).build();
}
项目:dremio-oss    文件:ProvisioningResource.java   
@GET
@Path("/cluster/{id}")
@Produces(MediaType.APPLICATION_JSON)
public ClusterResponse getClusterInfo(@PathParam("id") final String id) throws Exception {
  ClusterEnriched cluster = service.getClusterInfo(new ClusterId(id));
  return toClusterResponse(cluster);
}
项目:opencps-v2    文件:DeliverablesManagement.java   
@GET
@Path("/deliverables/{id}/preview")
@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 info preview for 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 getPreview(@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);
项目:athena    文件:FlowsWebResource.java   
/**
 * Removes flow rules by application ID.
 * Removes a collection of flow rules generated by the given application.
 *
 * @param appId application identifier
 * @return 204 NO CONTENT
 */
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("application/{appId}")
public Response removeFlowByAppId(@PathParam("appId") String appId) {
    final ApplicationService appService = get(ApplicationService.class);
    final ApplicationId idInstant = nullIsNotFound(appService.getId(appId), APP_ID_NOT_FOUND);
    service.removeFlowRulesById(idInstant);
    return Response.noContent().build();
}
项目:E-Clinic    文件:NurseRestEndPoint.java   
@DELETE
@Path("delete/{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response delete(@PathParam("id") String id) throws Throwable {
    System.out.println("delete"+ id);
    try {
        Nurse get = nurseService.get(Integer.valueOf(id));
        nurseService.delete(get);
    } catch (Exception ex) {
        return Response.ok().header("Exception", ex.getMessage()).build();
    }
    return Response.ok().entity("Data is deleted").build();
}
项目:MaximoForgeViewerPlugin    文件:ForgeRS.java   
@GET
   @Produces(MediaType.APPLICATION_JSON)
   @Path("bubble/{urn}/thumbnail")
   public Response bubbleThumbnail(
    @Context HttpServletRequest request,
    @PathParam("urn") String urn 
) 
    throws IOException, 
           URISyntaxException 
   {
    APIImpl impl = getAPIImpl( request );
    if( impl == null )
    {
           return Response.status( Response.Status.UNAUTHORIZED ).build();     
    }

    String scope[] = { DataRESTAPI.SCOPE_VIEWABLE_READ };
    ResultAuthentication result = impl.authenticate( scope );

    if( result.isError() )
    {
        return formatReturn( result );
    }

    URL url = new URL( impl.getThumbnailURL( urn ) );
    HttpURLConnection connection = (HttpURLConnection)url.openConnection();

    connection.setRequestMethod( "GET" );
    result.setAuthHeader( connection );

       int httpStatus = connection.getResponseCode();
       if( httpStatus > 299 )
       {
        return Response.status( httpStatus )
                .header("Pragma", "no-cache")
                .header("Cache-Control", "no-cache")                
                .entity( connection.getErrorStream() )
                .build();     
       }

       // Copy Autodesk headers describing thumbnail
       Map<String, List<String>> headers = connection.getHeaderFields();
       Iterator<String> itr = headers.keySet().iterator();
       Response.ResponseBuilder builder = Response.status( httpStatus );
       while( itr.hasNext() )
       {
        String key = itr.next();
        if( key == null ) continue;
        if( !key.startsWith( "x-ads" )) continue;
        String value = connection.getHeaderField( key );
        builder.header( key, value );                
       }

       return builder.entity( connection.getInputStream() )
               .header("content-encoding", connection.getContentEncoding() )      
               .header("content-type", connection.getContentType() )      
               .build();     
   }
项目:athena    文件:MastershipWebResource.java   
/**
 * Abandons mastership of the specified device on the local node thus
 * forcing selection of a new master. If the local node is not a master
 * for this device, no master selection will occur.
 *
 * @param deviceId device identifier
 * @return status of the request - CREATED if the JSON is correct
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{deviceId}/relinquish")
public Response relinquishMastership(@PathParam("deviceId") String deviceId) {
    DeviceId id = DeviceId.deviceId(deviceId);
    mastershipService.relinquishMastershipSync(id);
    return Response.created(id.uri()).build();
}
项目:ZooKeeper    文件:SessionsResource.java   
@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();
}
项目:dremio-oss    文件:StorageResource.java   
@GET
@Path("/{name}.json")
@Produces(APPLICATION_JSON)
public PluginConfigWrapper getStoragePluginJSON(@PathParam("name") String name) {
  try {
    StoragePlugin plugin = pluginConfiguration.getPlugin(name);
    if (plugin != null) {
      return new PluginConfigWrapper(name, plugin.getConfig());
    }
  } catch (Exception e) {
    throw new BadRequestException("Failure while trying to access storage config: " + name, e);
  }
  return new PluginConfigWrapper(name, null);
}
项目:Pet-Supply-Store    文件:AbstractCRUDEndpoint.java   
/**
 * Retreive and entity with the provided ID.
 * @param id ID of the entity to find.
 * @return A Response containing the entity.
 */
@GET
@Path("/{id:[0-9][0-9]*}")
public Response findById(@PathParam("id") final Long id) {
    if (id == null) {
        return Response.status(Status.NOT_FOUND).build();
    }
    T entity = findEntityById(id);
    if (entity == null) {
        return Response.status(Status.NOT_FOUND).build();
    }
    return Response.ok(entity).build();
}
项目:ctsms    文件:SearchResource.java   
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("user/{id}/search")
public Page<NoShortcutSerializationWrapper<UserOutVO>> searchUserByCriteria(@PathParam("id") Long id, @Context UriInfo uriInfo)
        throws AuthenticationException, AuthorisationException, ServiceException {
    PSFUriPart psf = new PSFUriPart(uriInfo);
    Collection result = WebUtil.getServiceLocator().getSearchService().searchUserByCriteria(auth, id, ResourceUtils.LIST_GRAPH_MAX_USER_INSTANCES, psf);
    NoShortcutSerializationWrapper.transformVoCollection(result);
    return new Page<NoShortcutSerializationWrapper<UserOutVO>>(result, psf);
}
项目:opencps-v2    文件:DossierManagement.java   
@GET
@Path("/{id}/cancelling")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Owner requset cancalling for Dossier", response = DossierDetailModel.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier has been cancelled", response = DossierDetailModel.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 cancellingDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
        @Context Company company, @Context Locale locale, @Context User user,
        @Context ServiceContext serviceContext, @PathParam("id") String id);