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. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: o2oa   Source 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
Source Project: syndesis   Source 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
@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
@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
Source Project: dremio-oss   Source 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
Source Project: o2oa   Source 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
Source Project: osiris   Source 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
Source Project: o2oa   Source 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
Source Project: o2oa   Source 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
@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
Source Project: o2oa   Source 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
Source Project: vxms   Source 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
Source Project: o2oa   Source 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
Source Project: digdag   Source 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
@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
Source Project: o2oa   Source 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
Source Project: o2oa   Source 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
Source Project: o2oa   Source 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
Source Project: incubator-atlas   Source 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
Source Project: o2oa   Source 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
@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
Source Project: o2oa   Source 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
Source Project: streamline   Source 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
Source Project: component-runtime   Source 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
Source Project: govpay   Source 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
Source Project: attic-apex-core   Source 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
Source Project: keywhiz   Source 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());
}