Java Code Examples for javax.ws.rs.Path

The following examples show how to use javax.ws.rs.Path. These examples are extracted from open source projects.
Example 1
Project: o2oa   File: WorkAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "流转一个流程实例,以非阻塞队列方式运行.", action = ActionProcessingNonblocking.class)
@PUT
@Path("{id}/processing/nonblocking")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void processingNonblocking(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) {
	ActionResult<ActionProcessingNonblocking.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionProcessingNonblocking().execute(effectivePerson, id, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 2
Project: syndesis   File: ConnectorEndpoint.java    License: Apache License 2.0 6 votes vote down vote up
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{connectorId}/actions/{actionId}")
public SyndesisMetadata actions(@PathParam("connectorId") final String connectorId, @PathParam("actionId") final String actionId,
                                final Map<String, Object> properties) {
    MetadataRetrieval adapter = findAdapter(connectorId);
    try {
        return adapter.fetch(camelContext, connectorId, actionId, properties);
    } catch (RuntimeException e) {
        LOGGER.error("Unable to fetch and process metadata for connector: {}, action: {}", connectorId, actionId);
        LOGGER.debug("Unable to fetch and process metadata for connector: {}, action: {}, properties: {}", connectorId, actionId,
            properties, e);
        throw adapter.handle(e);
    }
}
 
Example 3
Project: nexus-public   File: GolangGroupRepositoriesApiResource.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@ApiOperation("Update a Go group repository")
@ApiResponses(value = {
    @ApiResponse(code = 204, message = REPOSITORY_UPDATED),
    @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED),
    @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS),
    @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND)
})
@PUT
@Path("/{repositoryName}")
@RequiresAuthentication
@Validate
@Override
public Response updateRepository(
    final GolangGroupRepositoryApiRequest request,
    @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName)
{
  return super.updateRepository(request, repositoryName);
}
 
Example 4
Project: o2oa   File: UnitAttributeAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "获取组织属性对象.", action = ActionGet.class)
@GET
@Path("{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("组织属性标识") @PathParam("flag") String id) {
	ActionResult<ActionGet.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionGet().execute(effectivePerson, id);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 5
Project: dremio-oss   File: SQLResource.java    License: Apache License 2.0 6 votes vote down vote up
@POST
@Path("/analyze/suggest")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public SuggestionResponse suggestSQL(AnalyzeRequest analyzeRequest) {
  final String sql = analyzeRequest.getSql();
  final List<String> context = analyzeRequest.getContext();
  final int cursorPosition = analyzeRequest.getCursorPosition();

  // Setup dependencies and execute suggestion acquisition
  SQLAnalyzer SQLAnalyzer =
    SQLAnalyzerFactory.createSQLAnalyzer(
      securityContext.getUserPrincipal().getName(), sabotContext, context, true, projectOptionManager);

  List<SqlMoniker> sqlEditorHints = SQLAnalyzer.suggest(sql, cursorPosition);

  // Build response object and return
  return buildSuggestionResponse(sqlEditorHints);
}
 
Example 6
Project: o2oa   File: DataAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "对指定的document删除局部data数据.", action = ActionDeleteWithDocumentPath7.class)
@DELETE
@Path("document/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteWithDocumentWithPath7(@Suspended final AsyncResponse asyncResponse,
		@Context HttpServletRequest request, @JaxrsParameterDescribe("文档ID") @PathParam("id") String id,
		@JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0,
		@JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1,
		@JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2,
		@JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3,
		@JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4,
		@JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5,
		@JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6,
		@JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7) {
	ActionResult<ActionDeleteWithDocumentPath7.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionDeleteWithDocumentPath7().execute(effectivePerson, id, path0, path1, path2, path3, path4,
				path5, path6, path7);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 7
Project: osiris   File: SearchResourceImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override			
@Path("/room")
@GET
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Get room according to indoor location", httpMethod="GET",response=RoomDTO.class)
@ApiResponses(value = {
		@ApiResponse(code = 200, message = "Room belongs to location", response=RoomDTO.class),
		@ApiResponse(code = 400, message = "Invalid input parameter"),
		@ApiResponse(code = 404, message = "Room not found"),
		@ApiResponse(code = 500, message = "Problem in the system")})
public Response getRoomByLocation(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 			
		@ApiParam(value="Longitude of location", required=true) @Min(-180) @Max(180) @NotNull @QueryParam("longitude") Double longitude,
		@ApiParam(value="Latitude of location", required=true) @Min(-90) @Max(90) @NotNull @QueryParam("latitude") Double latitude,
		@ApiParam(value = "Floor of location", required = true) @NotNull  @QueryParam("floor") Integer floor) throws AssemblyException, RoomNotFoundException{
	validations.checkIsNotNullAndNotBlank(appIdentifier);
	validations.checkMin(-180.0, longitude);
	validations.checkMax(180.0, longitude);
	validations.checkMin(-90.0, latitude);
	validations.checkMax(90.0, latitude);
	validations.checkIsNotNull(floor);
	
	Feature room=searchManager.getRoomByLocation(appIdentifier, longitude, latitude, floor);			
	RoomDTO roomDTO=roomAssembler.createDataTransferObject(room);				
	return Response.ok(roomDTO).build();		
}
 
Example 8
@JaxrsMethodDescribe(value = "获取所有工作级别信息列表", action = ActionListAll.class)
@GET
@Path("all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void all(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
	EffectivePerson effectivePerson = this.effectivePerson(request);
	ActionResult<List<ActionListAll.Wo>> result = new ActionResult<>();
	try {
		result = new ActionListAll().execute(request, effectivePerson);
	} catch (Exception e) {
		result = new ActionResult<>();
		logger.warn("system excute ExcuteListAll got an exception.");
		logger.error(e, effectivePerson, request, null);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 9
Project: o2oa   File: TestAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "文字转换.", action = ActionExtract.class)
@POST
@Path("extract")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void extract(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionExtract.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionExtract().execute(effectivePerson, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));

}
 
Example 10
@JaxrsMethodDescribe(value = "根据ID删除节假日配置信息", action = ActionDelete.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("节假日配置信息ID") @PathParam("id") String id) {
	ActionResult<ActionDelete.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	Boolean check = true;

	if (check) {
		try {
			result = new ActionDelete().execute(request, effectivePerson, id);
		} catch (Exception e) {
			result = new ActionResult<>();
			Exception exception = new ExceptionAttendanceProcess(e, "根据ID删除考勤统计需求信息时发生异常!");
			result.error(exception);
			logger.error(e, effectivePerson, request, null);
		}
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 11
Project: o2oa   File: GroupAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "查询群组的直接下级群组.", action = ActionListWithGroupSubDirect.class)
@POST
@Path("list/group/sub/direct")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithGroupSubDirect(@Suspended final AsyncResponse asyncResponse,
		@Context HttpServletRequest request, JsonElement jsonElement) {
	ActionResult<ActionListWithGroupSubDirect.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionListWithGroupSubDirect().execute(effectivePerson, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 12
Project: Knowage-Server   File: I18nResource.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@DELETE
@Path("/deletedefault/{id}")
public Response deleteDefaultI18NMessage(@PathParam("id") Integer id) {
	I18NMessagesDAO I18NMessagesDAO = null;
	try {
		I18NMessagesDAO = DAOFactory.getI18NMessageDAO();
		SbiI18NMessages message = I18NMessagesDAO.getSbiI18NMessageById(id);
		I18NMessagesDAO.deleteNonDefaultI18NMessages(message);
		I18NMessagesDAO.deleteI18NMessage(id);
		String encodedI18NMessage = URLEncoder.encode("" + id, "UTF-8");
		return Response.ok().entity(encodedI18NMessage).build();
	} catch (Exception e) {
		logger.error("Error has occurred while deleting Default-Language I18NMessage", e);
		throw new SpagoBIRestServiceException("Error while deleting Default-Language I18NMessage", buildLocaleFromSession(), e);
	}
}
 
Example 13
Project: o2oa   File: PersonAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "判断个人是否拥有指定角色中的一个或者多个", action = ActionHasRole.class)
@POST
@Path("has/role")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void hasRole(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		JsonElement jsonElement) {
	ActionResult<ActionHasRole.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionHasRole().execute(effectivePerson, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 14
Project: vxms   File: RESTServiceChainObjectTest.java    License: Apache License 2.0 6 votes vote down vote up
@Path("/basicTestAndThen")
@GET
public void basicTestAndThen(RestHandler reply) {
  System.out.println("basicTestAndThen: " + reply);
  reply
      .response()
      .<Integer>supply(
          (future) -> {
            future.complete(1);
          })
      .<String>andThen(
          (value, future) -> {
            future.complete(value + 1 + "");
          })
      .mapToObjectResponse(
          (val, future) -> {
            Payload<String> pp = new Payload<>(val + " final");
            future.complete(pp);
          },
          new ExampleByteEncoder())
      .execute();
}
 
Example 15
Project: o2oa   File: PersonAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "查询最近登录人员对象", action = ActionListLoginRecentObject.class)
@POST
@Path("list/login/recent/object")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listLoginRecentObject(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		JsonElement jsonElement) {
	ActionResult<List<ActionListLoginRecentObject.Wo>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionListLoginRecentObject().execute(effectivePerson, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 16
Project: digdag   File: AdminResource.java    License: Apache License 2.0 6 votes vote down vote up
@Deprecated
@GET
@Path("/api/admin/attempts/{id}/userinfo")
@ApiOperation("(deprecated)")
public Config getUserInfo(@PathParam("id") long id)
        throws ResourceNotFoundException
{
    return tm.begin(() -> {
        StoredSessionAttemptWithSession session = sm.getAttemptWithSessionById(id);

        if (!session.getWorkflowDefinitionId().isPresent()) {
            // TODO: is 404 appropriate in this situation?
            throw new NotFoundException();
        }

        StoredRevision revision = pm.getRevisionOfWorkflowDefinition(session.getWorkflowDefinitionId().get());

        return revision.getUserInfo();
    }, ResourceNotFoundException.class);
}
 
Example 17
Project: Knowage-Server   File: MemberResource.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@GET
@Path("/sort/disable")
public String sorten() {
	WhatIfEngineInstance ei = getWhatIfEngineInstance();
	SpagoBIPivotModel model = (SpagoBIPivotModel) ei.getPivotModel();
	ModelConfig modelConfig = getWhatIfEngineInstance().getModelConfig();

	model.removeSubset();

	getWhatIfEngineInstance().getModelConfig().setSortingEnabled(!modelConfig.getSortingEnabled());
	if (!modelConfig.getSortingEnabled()) {
		model.setSortCriteria(null);
		model.setSorting(false);
	}

	model.removeOrder(Axis.ROWS);
	model.removeOrder(Axis.COLUMNS);
	List<Member> a = model.getSortPosMembers1();
	a.clear();

	return renderModel(model);
}
 
Example 18
Project: o2oa   File: RegistAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "校验name是否已经存在", action = ActionCheckName.class)
@GET
@Path("check/name/{name}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void checkName(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("用户名") @PathParam("name") String name) {
	ActionResult<ActionCheckName.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionCheckName().execute(effectivePerson, name);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 19
Project: o2oa   File: DataAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "对指定的work添加局部data数据.", action = ActionCreateWithWorkPath0.class)
@POST
@Path("work/{id}/{path0}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void createWithWorkPath0(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, JsonElement jsonElement) {
	ActionResult<ActionCreateWithWorkPath0.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionCreateWithWorkPath0().execute(effectivePerson, id, path0, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 20
@JaxrsMethodDescribe(value = "测试定时代理,对工作的汇报提交情况进行统计分析", action = ActionStReportStatusCaculateAll.class)
@GET
@Path("excute/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void excuteAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
	EffectivePerson effectivePerson = this.effectivePerson(request);
	ActionResult<WrapOutString> result = new ActionResult<>();
	try {
		result = new ActionStReportStatusCaculateAll().execute(request, effectivePerson);
	} catch (Exception e) {
		result = new ActionResult<>();
		result.error(e);
		logger.warn("system excute ExcuteStReportStatusCaculateAll got an exception. ");
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 21
Project: o2oa   File: ProcessAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "升级流程.", action = ActionUpgrade.class)
@POST
@Path("{id}/upgrade")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void upgrade(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
					@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
	ActionResult<ActionUpgrade.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpgrade().execute(effectivePerson, id, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 22
Project: incubator-atlas   File: LineageREST.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns lineage info about entity.
 * @param guid - unique entity id
 * @param direction - input, output or both
 * @param depth - number of hops for lineage
 * @return AtlasLineageInfo
 * @throws AtlasBaseException
 * @HTTP 200 If Lineage exists for the given entity
 * @HTTP 400 Bad query parameters
 * @HTTP 404 If no lineage is found for the given entity
 */
@GET
@Path("/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasLineageInfo getLineageGraph(@PathParam("guid") String guid,
                                        @QueryParam("direction") @DefaultValue(DEFAULT_DIRECTION)  LineageDirection direction,
                                        @QueryParam("depth") @DefaultValue(DEFAULT_DEPTH) int depth) throws AtlasBaseException {
    AtlasPerfTracer perf = null;

    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "LineageREST.getLineageGraph(" + guid + "," + direction +
                                                           "," + depth + ")");
        }

        return atlasLineageService.getAtlasLineageInfo(guid, direction, depth);
    } finally {
        AtlasPerfTracer.log(perf);
    }
}
 
Example 23
Project: o2oa   File: DataAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath3.class)
@DELETE
@Path("work/{id}/{path0}/{path1}/{path2}/{path3}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteWithWorkPath3(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0,
		@JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1,
		@JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2,
		@JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3) {
	ActionResult<ActionDeleteWithWorkPath3.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionDeleteWithWorkPath3().execute(effectivePerson, id, path0, path1, path2, path3);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 24
Project: graviteeio-access-management   File: CertificatePluginResource.java    License: Apache License 2.0 6 votes vote down vote up
@GET
@Path("schema")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get an certificate's schema",
        notes = "There is no particular permission needed. User must be authenticated.")
public void getSchema(
        @PathParam("certificate") String certificateId,
        @Suspended final AsyncResponse response) {

    // Check that the certificate exists
    certificatePluginService.findById(certificateId)
            .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId)))
            .flatMap(irrelevant -> certificatePluginService.getSchema(certificateId))
            .switchIfEmpty(Maybe.error(new CertificatePluginSchemaNotFoundException(certificateId)))
            .map(certificatePluginSchema -> Response.ok(certificatePluginSchema).build())
            .subscribe(response::resume, response::resume);
}
 
Example 25
Project: o2oa   File: TableAction.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "根据标识获取表.", action = ActionGet.class)
@GET
@Path("{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("flag") String flag) {
	ActionResult<ActionGet.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionGet().execute(effectivePerson, flag);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example 26
Project: streamline   File: WindowCatalogResource.java    License: Apache License 2.0 5 votes vote down vote up
@GET
@Path("/topologies/{topologyId}/windows")
@Timed
public Response listTopologyWindows(@PathParam("topologyId") Long topologyId, @Context UriInfo uriInfo,
                                    @Context SecurityContext securityContext) throws Exception {
    Long currentVersionId = catalogService.getCurrentVersionId(topologyId);
    return listTopologyWindows(
            buildTopologyIdAndVersionIdAwareQueryParams(topologyId, currentVersionId, uriInfo),
            topologyId,
            securityContext);
}
 
Example 27
Project: component-runtime   File: ComponentServerMock.java    License: Apache License 2.0 5 votes vote down vote up
@POST
@Path("action/execute")
public Map<String, String> execute(@QueryParam("family") final String family, @QueryParam("type") final String type,
        @QueryParam("action") final String action, @QueryParam("lang") final String lang,
        final Map<String, String> params) {
    final Map<String, String> out = new HashMap<>(params);
    out.put("family", family);
    out.put("type", type);
    out.put("action", action);
    out.put("lang", lang);
    return out;
}
 
Example 28
Project: govpay   File: Profilo.java    License: GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path("/")

@Produces({ "application/json" })
public Response getProfilo(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders){
    this.buildContext();
    return this.controller.getProfilo(this.getUser(), uriInfo, httpHeaders);
}
 
Example 29
Project: attic-apex-core   File: StramWebServices.java    License: Apache License 2.0 5 votes vote down vote up
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports/{portName}")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getPort(@PathParam("operatorName") String operatorName, @PathParam("portName") String portName)
{
  init();
  OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
  Set<LogicalPlan.InputPortMeta> inputPorts;
  Set<LogicalPlan.OutputPortMeta> outputPorts;
  if (logicalOperator == null) {
    ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName);
    if (logicalModule == null) {
      throw new NotFoundException();
    }
    inputPorts = logicalModule.getInputStreams().keySet();
    outputPorts = logicalModule.getOutputStreams().keySet();
  } else {
    inputPorts = logicalOperator.getInputStreams().keySet();
    outputPorts = logicalOperator.getOutputStreams().keySet();
  }

  try {
    JSONObject resp = getPortObject(inputPorts, outputPorts, portName);
    if (resp != null) {
      return resp;
    }
  } catch (JSONException ex) {
    throw new RuntimeException(ex);
  }
  throw new NotFoundException();
}
 
Example 30
Project: keywhiz   File: SecretResource.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Retrieve listing of secrets expiring soon in a group
 *
 * @param time timestamp for farthest expiry to include
 * @param name Group name
 * responseMessage 200 List of secrets expiring soon in group
 */
@Timed @ExceptionMetered
@Path("expiring/{time}/{name}")
@GET
@Produces(APPLICATION_JSON)
public Iterable<String> secretListingExpiringForGroup(@Auth AutomationClient automationClient,
    @PathParam("time") Long time, @PathParam("name") String name) {
  Group group = groupDAO.getGroup(name).orElseThrow(NotFoundException::new);

  List<SanitizedSecret> secrets = secretControllerReadOnly.getSanitizedSecrets(time, group);
  return secrets.stream()
      .map(SanitizedSecret::name)
      .collect(toSet());
}
 
Example 31
Project: opencps-v2   File: ServerConfigManagement.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update a ServerConfig", response = ServerConfigDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the ServerConfig was updated", response = ServerConfigDetailModel.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 updateServerConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @BeanParam ServerConfigInputModel input);
 
Example 32
Project: Knowage-Server   File: FolderResource.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
public Response getFolders(@DefaultValue("false") @QueryParam("includeDocs") Boolean recoverBIObjects, @QueryParam("perm") String permissionOnFolder,
		@QueryParam("dateFilter") String dateFilter) {
	logger.debug("IN");
	FolderManagementAPI folderManagementUtilities = new FolderManagementAPI();

	String jsonObjects = folderManagementUtilities.getFoldersAsString(recoverBIObjects, permissionOnFolder, dateFilter);

	return Response.ok(jsonObjects).build();
}
 
Example 33
Project: onedev   File: PullRequestResource.java    License: MIT License 5 votes vote down vote up
@Path("/{pullRequestId}")
@GET
public PullRequest get(@PathParam("pullRequestId") Long pullRequestId) {
	PullRequest request = pullRequestManager.load(pullRequestId);
	if (!SecurityUtils.canReadCode(request.getTargetProject()))
		throw new UnauthorizedException();
	return request;
}
 
Example 34
Project: dcos-commons   File: MultiEndpointsResource.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @see EndpointsQueries
 */
@Path("{sanitizedServiceName}/endpoints")
@GET
public Response getEndpoints(@PathParam("sanitizedServiceName") String sanitizedServiceName) {
  Optional<AbstractScheduler> service =
      multiServiceManager.getServiceSanitized(sanitizedServiceName);
  if (!service.isPresent()) {
    return ResponseUtils.serviceNotFoundResponse(sanitizedServiceName);
  }
  return EndpointsQueries.getEndpoints(
      service.get().getStateStore(),
      frameworkName,
      service.get().getCustomEndpoints(),
      schedulerConfig);
}
 
Example 35
Project: msf4j   File: InterceptorTestMicroService.java    License: Apache License 2.0 5 votes vote down vote up
@GET
@Path("/responseInterceptorBreakByUserTest")
@RequestInterceptor(TestRequestInterceptor.class)
@ResponseInterceptor({TestBreakResponseInterceptor.class, TestResponseInterceptor.class})
public String responseInterceptorBreakByUserTest() {
    return "Manual break response interceptor test";
}
 
Example 36
Project: TeaStore   File: CacheManagerEndpoint.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Closes and resets the EMF.
 * @return Status Code 200 and "clearedEMF" text if reset succeeded, 404 if it didn't.
 */
@DELETE
@Path("/emf")
public Response clearEMF() {
	CacheManager.MANAGER.resetLocalEMF();
	return Response.ok("clearedEMF").build();
}
 
Example 37
Project: conductor   File: TaskResource.java    License: Apache License 2.0 5 votes vote down vote up
@GET
@Path("/queue/polldata")
@ApiOperation("Get the last poll data for a given task type")
@Consumes({MediaType.WILDCARD})
public List<PollData> getPollData(@QueryParam("taskType") String taskType) {
	return taskService.getPollData(taskType);
}
 
Example 38
Project: alm-rest-api   File: TestRestConnector.java    License: GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path("/entity")
@Produces("application/xml")
public Entity getEntity()
{
    Entity entity = new Entity();
    entity.setName("user");
    entity.setType("delegate");

    return entity;
}
 
Example 39
@RolesAllowed("GET")
    @Path("/{id}")
    @GET
    public CategoryAJAXResponse get(@PathParam("id") String id) {
//        return response(pageCategoryAccessService.auth(request.userInfo(), id, "GET",
//            () -> categoryWebService.get(id)));
//        return response(pageCategoryAccessService.auth(request.userInfo(), id, "GET",
//            () -> categoryWebService.get(id)));
        return response(pageCategoryWebService.get(id));
    }
 
Example 40
Project: che   File: PermissionsService.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@GET
@Path("/{domain}")
@Produces(APPLICATION_JSON)
@ApiOperation(
    value = "Get permissions of current user which are related to specified domain and instance",
    response = PermissionsDto.class)
@ApiResponses({
  @ApiResponse(code = 200, message = "The permissions successfully fetched"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(code = 404, message = "Specified domain is unsupported"),
  @ApiResponse(
      code = 404,
      message = "Permissions for current user with specified domain and instance was not found"),
  @ApiResponse(
      code = 409,
      message = "Given domain requires non nullable value for instance but it is null"),
  @ApiResponse(code = 500, message = "Internal server error occurred during permissions fetching")
})
public PermissionsDto getCurrentUsersPermissions(
    @ApiParam(value = "Domain id to retrieve user's permissions") @PathParam("domain")
        String domain,
    @ApiParam(value = "Instance id to retrieve user's permissions") @QueryParam("instance")
        String instance)
    throws BadRequestException, NotFoundException, ConflictException, ServerException {
  instanceValidator.validate(domain, instance);
  return toDto(
      permissionsManager.get(
          EnvironmentContext.getCurrent().getSubject().getUserId(), domain, instance));
}