javax.ws.rs.core.Response Java Examples
The following examples show how to use
javax.ws.rs.core.Response.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Persister4CollectorAPI.java From AIDR with GNU Affero General Public License v3.0 | 7 votes |
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") public Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType) throws UnknownHostException { logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); JsonDeserializer jsonD = new JsonDeserializer(); String fileName = jsonD.generateJSON2JSON_100K_BasedOnTweetCount(collectionCode, DownloadJsonType.getDownloadJsonTypeFromString(jsonType)); fileName = PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_DOWNLOAD_URL) + collectionCode+"/"+fileName; logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + fileName); //return Response.ok(fileName).build(); JSONObject obj = new JSONObject(); obj.putAll(ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); return Response.ok(obj.toJSONString()).build(); }
Example #2
Source File: AnalysisResourceTest.java From batfish with Apache License 2.0 | 6 votes |
@Test public void testDeleteAnalysisSuccess() throws IOException { String network = "network1"; String analysis = "analysis1"; Main.getWorkMgr().initNetwork(network, null); Main.getWorkMgr() .configureAnalysis( network, true, analysis, ImmutableMap.of("foo", "{}"), ImmutableList.of(), false); // should succeed first time try (Response response = getTarget(network, analysis).delete()) { assertThat(response.getStatus(), equalTo(OK.getStatusCode())); } // should fail second time try (Response response = getTarget(network, analysis).delete()) { assertThat(response.getStatus(), equalTo(NOT_FOUND.getStatusCode())); } }
Example #3
Source File: AtomicSemaphoreResource.java From atomix with Apache License 2.0 | 6 votes |
@POST @Path("/{name}/increase") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public void increase( @PathParam("name") String name, Integer permits, @Suspended AsyncResponse response) { getPrimitive(name).thenCompose(semaphore -> semaphore.increasePermits(permits != null ? permits : 1)).whenComplete((result, error) -> { if (error == null) { response.resume(Response.ok(result).build()); } else { LOGGER.warn("An error occurred", error); response.resume(Response.serverError()); } }); }
Example #4
Source File: I18nResource.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
@PUT @Path("/") @Consumes(MediaType.APPLICATION_JSON) public Response modifyI18NMessage(SbiI18NMessages message) { I18NMessagesDAO I18NMessagesDAO = null; try { I18NMessagesDAO = DAOFactory.getI18NMessageDAO(); // If updating Default Message Label, find others with particular Label and update them as well SbiI18NMessages messageBeforeUpdate = I18NMessagesDAO.getSbiI18NMessageById(message.getId()); if (!message.getLabel().equals(messageBeforeUpdate.getLabel())) { I18NMessagesDAO.updateNonDefaultI18NMessagesLabel(messageBeforeUpdate, message); } I18NMessagesDAO.updateI18NMessage(message); String encodedI18NMessage = URLEncoder.encode("" + message.getId(), "UTF-8"); return Response.created(new URI("/2.0/i18nMessages/" + encodedI18NMessage)).entity(encodedI18NMessage).build(); } catch (Exception e) { logger.error("Error while updating I18NMessage", e); throw new SpagoBIRestServiceException("Error while updating I18NMessage", buildLocaleFromSession(), e); } }
Example #5
Source File: ApiUserProfileInterface.java From entando-core with GNU Lesser General Public License v3.0 | 6 votes |
public List<String> getUserProfiles(Properties properties) throws Throwable { List<String> usernames = null; try { String userProfileType = properties.getProperty("typeCode"); IUserProfile prototype = (IUserProfile) this.getUserProfileManager().getEntityPrototype(userProfileType); if (null == prototype) { throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR, "Profile Type '" + userProfileType + "' does not exist", Response.Status.CONFLICT); } String langCode = properties.getProperty(SystemConstants.API_LANG_CODE_PARAMETER); String filtersParam = properties.getProperty("filters"); BaseFilterUtils filterUtils = new BaseFilterUtils(); EntitySearchFilter[] filters = filterUtils.getFilters(prototype, filtersParam, langCode); usernames = this.getUserProfileManager().searchId(userProfileType, filters); } catch (ApiException ae) { throw ae; } catch (Throwable t) { _logger.error("Error searching usernames", t); //ApsSystemUtils.logThrowable(t, this, "getUserProfiles"); throw new ApsSystemException("Error searching usernames", t); } return usernames; }
Example #6
Source File: DeviceAgentServiceTest.java From carbon-device-mgt with Apache License 2.0 | 6 votes |
@Test(description = "Test the device enrollment success scenario.") public void testEnrollDeviceSuccess() throws DeviceManagementException { PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService")) .toReturn(this.deviceManagementProviderService); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getAuthenticatedUser")) .toReturn(AUTHENTICATED_USER); EnrolmentInfo enrolmentInfo = demoDevice.getEnrolmentInfo(); enrolmentInfo.setStatus(EnrolmentInfo.Status.INACTIVE); demoDevice.setEnrolmentInfo(enrolmentInfo); Mockito.when(this.deviceManagementProviderService.getDevice(Mockito.any())).thenReturn(demoDevice); Response response = this.deviceAgentService.enrollDevice(demoDevice); Assert.assertNotNull(response, "Response should not be null"); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(), "The response status should be 200"); Mockito.reset(this.deviceManagementProviderService); }
Example #7
Source File: DeviceManagementServiceImpl.java From carbon-device-mgt with Apache License 2.0 | 6 votes |
@GET @Path("/{type}/{id}/location") @Override public Response getDeviceLocation( @PathParam("type") @Size(max = 45) String type, @PathParam("id") @Size(max = 45) String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) { DeviceInformationManager informationManager; DeviceLocation deviceLocation; try { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(id); deviceIdentifier.setType(type); informationManager = DeviceMgtAPIUtils.getDeviceInformationManagerService(); deviceLocation = informationManager.getDeviceLocation(deviceIdentifier); } catch (DeviceDetailsMgtException e) { String msg = "Error occurred while getting the device location."; log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } return Response.status(Response.Status.OK).entity(deviceLocation).build(); }
Example #8
Source File: NamenodeAnalyticsMethods.java From NNAnalytics with Apache License 2.0 | 6 votes |
/** * ADDDIRECTORY endpoint is an admin-level endpoint meant to add a directory for cached analysis * by NNA. */ @GET @Path("/addDirectory") @Produces({MediaType.TEXT_PLAIN}) public Response addDirectory() { try { final NameNodeLoader nnLoader = (NameNodeLoader) context.getAttribute(NNA_NN_LOADER); before(); String directory = request.getParameter("dir"); nnLoader.getSuggestionsEngine().addDirectoryToAnalysis(directory); return Response.ok(directory + " added for analysis.", MediaType.TEXT_PLAIN).build(); } catch (Exception ex) { return handleException(ex); } finally { after(); } }
Example #9
Source File: MultitenancyITCase.java From syncope with Apache License 2.0 | 6 votes |
@Test public void createUser() { assertNull(adminClient.getService(RealmService.class). search(new RealmQuery.Builder().keyword("*").build()).getResult().get(0).getPasswordPolicy()); UserCR userCR = new UserCR(); userCR.setRealm(SyncopeConstants.ROOT_REALM); userCR.setUsername(getUUIDString()); userCR.setPassword("password"); Response response = adminClient.getService(UserService.class).create(userCR); assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); UserTO user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() { }).getEntity(); assertNotNull(user); }
Example #10
Source File: DavRsCmp.java From io with Apache License 2.0 | 6 votes |
/** * OPTIONSメソッド. * @return JAX-RS Response */ @OPTIONS public Response options() { // アクセス制御 this.checkAccessContext(this.getAccessContext(), BoxPrivilege.READ); return DcCoreUtils.responseBuilderForOptions( HttpMethod.GET, HttpMethod.PUT, HttpMethod.DELETE, com.fujitsu.dc.common.utils.DcCoreUtils.HttpMethod.MKCOL, com.fujitsu.dc.common.utils.DcCoreUtils.HttpMethod.PROPFIND, com.fujitsu.dc.common.utils.DcCoreUtils.HttpMethod.PROPPATCH, com.fujitsu.dc.common.utils.DcCoreUtils.HttpMethod.ACL ).build(); }
Example #11
Source File: IdentityProviderResourceTest.java From graviteeio-access-management with Apache License 2.0 | 6 votes |
@Test public void shouldGetIdentityProvider() { final String domainId = "domain-id"; final Domain mockDomain = new Domain(); mockDomain.setId(domainId); final String identityProviderId = "identityProvider-id"; final IdentityProvider mockIdentityProvider = new IdentityProvider(); mockIdentityProvider.setId(identityProviderId); mockIdentityProvider.setName("identityProvider-name"); mockIdentityProvider.setReferenceType(ReferenceType.DOMAIN); mockIdentityProvider.setReferenceId(domainId); doReturn(Maybe.just(mockDomain)).when(domainService).findById(domainId); doReturn(Maybe.just(mockIdentityProvider)).when(identityProviderService).findById(identityProviderId); final Response response = target("domains").path(domainId).path("identities").path(identityProviderId).request().get(); assertEquals(HttpStatusCode.OK_200, response.getStatus()); final IdentityProvider identityProvider = readEntity(response, IdentityProvider.class); assertEquals(domainId, identityProvider.getReferenceId()); assertEquals(identityProviderId, identityProvider.getId()); }
Example #12
Source File: SysUserRestApi.java From submarine with Apache License 2.0 | 6 votes |
@POST @Path("/add") @SubmarineApi public Response add(SysUser sysUser) { LOG.info("add({})", sysUser.toString()); try { userService.add(sysUser); } catch (Exception e) { LOG.error(e.getMessage(), e); return new JsonResponse.Builder<>(Response.Status.OK).success(false) .message("Save user failed!").build(); } return new JsonResponse.Builder<SysUser>(Response.Status.OK) .success(true).message("Save user successfully!").result(sysUser).build(); }
Example #13
Source File: WorkFlowExecutionControllerTest.java From flux with Apache License 2.0 | 6 votes |
@Test public void testEventPost_shouldSendExecuteTaskIfItIsNotCompleted() throws Exception { final EventData testEventData = new EventData("event0", "java.lang.String", "42", "runtime"); when(eventsDAO.findBySMIdAndName("standard-machine", "event0")).thenReturn(new Event("event0", "java.lang.String", Event.EventStatus.pending, "1", null, null)); EventData[] expectedEvents = new EventData[]{new EventData("event0", "java.lang.String", "42", "runtime")}; when(eventsDAO.findTriggeredOrCancelledEventsNamesBySMId("standard-machine")).thenReturn(Collections.singletonList("event0")); when(executionNodeTaskDispatcher.forwardExecutionMessage(anyString(), anyObject())).thenReturn(Response.Status.ACCEPTED.getStatusCode()); workFlowExecutionController.postEvent(testEventData, "standard-machine"); StateMachine stateMachine = stateMachinesDAO.findById("standard-machine"); State state = stateMachinesDAO.findById("standard-machine").getStates().stream().filter((s) -> s.getId() == 4L).findFirst().orElse(null); state.setStatus(Status.errored); //post the event again, this should send msg to router again for execution workFlowExecutionController.postEvent(testEventData, "standard-machine"); verify(executionNodeTaskDispatcher, times(2)).forwardExecutionMessage(anyString(), anyObject()); verifyNoMoreInteractions(executionNodeTaskDispatcher); }
Example #14
Source File: ShowConfiguration.java From iaf with Apache License 2.0 | 6 votes |
@GET @RolesAllowed({"IbisObserver", "IbisDataAdmin", "IbisAdmin", "IbisTester"}) @Path("/configurations/{configuration}/flow") @Produces(MediaType.TEXT_PLAIN) public Response getAdapterFlow(@PathParam("configuration") String configurationName, @QueryParam("dot") boolean dot) throws ApiException { Configuration configuration = getIbisManager().getConfiguration(configurationName); if(configuration == null){ throw new ApiException("Configuration not found!"); } FlowDiagramManager flowDiagramManager = getFlowDiagramManager(); try { ResponseBuilder response = Response.status(Response.Status.OK); if(dot) { response.entity(flowDiagramManager.generateDot(configuration)).type(MediaType.TEXT_PLAIN); } else { response.entity(flowDiagramManager.get(configuration)).type("image/svg+xml"); } return response.build(); } catch (SAXException | TransformerException | IOException e) { throw new ApiException(e); } }
Example #15
Source File: ApplicationsApi.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@GET @Path("/{applicationId}/keys") @Consumes({ "application/json" }) @Produces({ "application/json" }) @ApiOperation(value = "Retrieve all application keys", notes = "Retrieve keys (Consumer key/secret) of application ", response = ApplicationKeyListDTO.class, authorizations = { @Authorization(value = "OAuth2Security", scopes = { @AuthorizationScope(scope = "apim:app_manage", description = "Retrieve, Manage applications"), @AuthorizationScope(scope = "apim:subscribe", description = "Subscribe API") }) }, tags={ "Application Keys", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. Keys are returned. ", response = ApplicationKeyListDTO.class), @ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error ", response = ErrorDTO.class), @ApiResponse(code = 404, message = "Not Found. The resource does not exist. ", response = ErrorDTO.class), @ApiResponse(code = 412, message = "Precondition Failed. The request has not been performed because one of the preconditions is not met. ", response = ErrorDTO.class) }) public Response applicationsApplicationIdKeysGet(@ApiParam(value = "Application Identifier consisting of the UUID of the Application. ",required=true) @PathParam("applicationId") String applicationId) throws APIManagementException{ return delegate.applicationsApplicationIdKeysGet(applicationId, securityContext); }
Example #16
Source File: ThingResource.java From openhab-core with Eclipse Public License 2.0 | 6 votes |
@GET @RolesAllowed({ Role.USER, Role.ADMIN }) @Path("/{thingUID}/status") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Gets thing's status.") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class), @ApiResponse(code = 404, message = "Thing not found.") }) public Response getStatus( @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") @Nullable String language, @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException { ThingUID thingUIDObject = new ThingUID(thingUID); // Check if the Thing exists, 404 if not Thing thing = thingRegistry.get(thingUIDObject); if (thing == null) { logger.info("Received HTTP GET request for thing config status at '{}' for the unknown thing '{}'.", uriInfo.getPath(), thingUID); return getThingNotFoundResponse(thingUID); } ThingStatusInfo thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, localeService.getLocale(language)); return Response.ok().entity(thingStatusInfo).build(); }
Example #17
Source File: BuildPlanController.java From container with Apache License 2.0 | 6 votes |
@POST @Path("/{plan}/instances/{instance}/logs") @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @ApiOperation(hidden = true, value = "") public Response addBuildPlanLogEntry(@PathParam("plan") final String plan, @PathParam("instance") final String instance, @Context final UriInfo uriInfo, final CreatePlanInstanceLogEntryRequest logEntry) { LOGGER.debug("Invoking addBuildPlanLogEntry"); final String entry = logEntry.getLogEntry(); if (entry == null || entry.length() <= 0) { LOGGER.info("Log entry is empty!"); return Response.status(Status.BAD_REQUEST).build(); } PlanInstance pi = planService.resolvePlanInstance(csar, serviceTemplate, null, plan, instance, PLAN_TYPE); final PlanInstanceEvent event = new PlanInstanceEvent("INFO", "PLAN_LOG", entry); planService.addLogToPlanInstance(pi, event); final URI resourceUri = uriInfo.getAbsolutePath(); return Response.ok(resourceUri).build(); }
Example #18
Source File: QuarksShieldSyncResource.java From quarkus-quickstarts with Apache License 2.0 | 6 votes |
@POST @Consumes({MediaType.TEXT_PLAIN}) public Response notificationEndpoint(@HeaderParam("x-amz-sns-message-type") String messageType, String message) throws JsonProcessingException { if (messageType == null) { return Response.status(400).build(); } if (messageType.equals(NOTIFICATION_TYPE)) { SnsNotification notification = readObject(SnsNotification.class, message); Quark quark = readObject(Quark.class, notification.getMessage()); LOGGER.infov("Quark[{0}, {1}] collision with the shield.", quark.getFlavor(), quark.getSpin()); } else if (messageType.equals(SUBSCRIPTION_CONFIRMATION_TYPE)) { SnsSubscriptionConfirmation subConf = readObject(SnsSubscriptionConfirmation.class, message); sns.confirmSubscription(cs -> cs.topicArn(topicArn).token(subConf.getToken())); LOGGER.info("Subscription confirmed. Ready for quarks collisions."); } else if (messageType.equals(UNSUBSCRIPTION_CONFIRMATION_TYPE)) { LOGGER.info("We are unsubscribed"); } else { return Response.status(400).entity("Unknown messageType").build(); } return Response.ok().build(); }
Example #19
Source File: RESTExceptionMapperTest.java From datawave with Apache License 2.0 | 6 votes |
@Test public void testToResponse_simpleException() { Exception e = new Exception(); Response response = rem.toResponse(e); MultivaluedMap<String,Object> responseMap = response.getHeaders(); Assert.assertEquals(500, response.getStatus()); Assert.assertEquals(6, responseMap.size()); Assert.assertEquals(Lists.newArrayList(true), responseMap.get(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)); Assert.assertEquals(Lists.newArrayList("*"), responseMap.get(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); Assert.assertEquals(Lists.newArrayList(864000), responseMap.get(HttpHeaders.ACCESS_CONTROL_MAX_AGE)); Assert.assertEquals(Lists.newArrayList("500-1"), responseMap.get(Constants.ERROR_CODE)); Assert.assertEquals(Lists.newArrayList("null/null"), responseMap.get(Constants.RESPONSE_ORIGIN)); Assert.assertEquals(Lists.newArrayList("X-SSL-ClientCert-Subject, X-ProxiedEntitiesChain, X-ProxiedIssuersChain, Accept, Accept-Encoding"), responseMap.get(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS)); }
Example #20
Source File: UserManagement.java From opencps-v2 with GNU Affero General Public License v3.0 | 5 votes |
@PUT @Path("/{id}/preferences") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response addPreferences(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id, @FormParam("preferences") String preferences);
Example #21
Source File: BasicSteps.java From cassandra-reaper with Apache License 2.0 | 5 votes |
@And("^reaper has no scheduled repairs for \"([^\"]*)\"$") public void reaper_has_no_scheduled_repairs_for(String clusterName) throws Throwable { synchronized (BasicSteps.class) { callAndExpect("GET", "/repair_schedule/cluster/" + clusterName, Optional.<Map<String, String>>empty(), Optional.of("[]"), Response.Status.OK); } }
Example #22
Source File: BaseResource.java From kitchen-duty-plugin-for-atlassian-jira with MIT License | 5 votes |
protected Response getUnauthorizedErrorResponse() { return Response.serverError() .entity(new RestError( RestError.errorText401, 401001, Response.Status.UNAUTHORIZED.getStatusCode())) .status(Response.Status.UNAUTHORIZED) .build(); }
Example #23
Source File: PetResource.java From swagger-maven-plugin with Apache License 2.0 | 5 votes |
@GET @Path("/findByTags") @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List") @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid tag value")}) @Deprecated public Response findPetsByTags( @ApiParam(value = "Tags to filter by", required = true, allowMultiple = true) @QueryParam("tags") String tags) { return Response.ok(petData.findPetByTags(tags)).build(); }
Example #24
Source File: NotificationRuleResourceTest.java From dependency-track with Apache License 2.0 | 5 votes |
@Test public void removeProjectFromRuleInvalidRuleTest() { Project project = qm.createProject("Acme Example", null, null, null, null, null, true, false); NotificationPublisher publisher = qm.getNotificationPublisher(DefaultNotificationPublishers.SLACK.getPublisherName()); Response response = target(V1_NOTIFICATION_RULE + "/" + UUID.randomUUID().toString() + "/project/" + project.getUuid().toString()).request() .header(X_API_KEY, apiKey) .delete(); Assert.assertEquals(404, response.getStatus(), 0); Assert.assertNull(response.getHeaderString(TOTAL_COUNT_HEADER)); String body = getPlainTextBody(response); Assert.assertEquals("The notification rule could not be found.", body); }
Example #25
Source File: ExceptionMapperTest.java From servicetalk with Apache License 2.0 | 5 votes |
@Override Response toResponse(final Throwable exception) { final Buffer buf = DEFAULT_ALLOCATOR.fromAscii(exception.getClass().getName()); return status(555) .header(CONTENT_TYPE, TEXT_PLAIN) .header(CONTENT_LENGTH, buf.readableBytes()) .entity(buf) .build(); }
Example #26
Source File: TableManagerResourceTest.java From foxtrot with Apache License 2.0 | 5 votes |
@Test public void testGetMissingTable() throws Exception { Response response = resources.client() .target(String.format("/v1/tables/%s", TEST_TABLE_NAME + "_missing")) .request() .get(); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); }
Example #27
Source File: ODataExceptionMapperImplTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testEntityProviderException() throws Exception { // prepare Exception exception = new EntityProviderException(EntityProviderException.INVALID_PROPERTY.addContent("unknown")); // execute Response response = exceptionMapper.toResponse(exception); // verify verifyResponse(response, MessageService.getMessage(Locale.ENGLISH, EntityProviderException.INVALID_PROPERTY.addContent("unknown")).getText(), HttpStatusCodes.BAD_REQUEST); }
Example #28
Source File: BadRequestTest.java From mrgeo with Apache License 2.0 | 5 votes |
@Test @Category(IntegrationTest.class) public void testInvalidServiceType() throws Exception { Response response = target("wms") .queryParam("SERVICE", "WCS") .request().get(); processXMLResponse(response, "wms-invalid-servicetype.xml", Response.Status.BAD_REQUEST); }
Example #29
Source File: RuleResource.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@GET @Path("/{ruleUID}/conditions") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Gets the rule conditions.", response = ConditionDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ConditionDTO.class, responseContainer = "List"), @ApiResponse(code = 404, message = "Rule corresponding to the given UID does not found.") }) public Response getConditions(@PathParam("ruleUID") @ApiParam(value = "ruleUID", required = true) String ruleUID) { Rule rule = ruleRegistry.get(ruleUID); if (rule != null) { return Response.ok(ConditionDTOMapper.map(rule.getConditions())).build(); } else { return Response.status(Status.NOT_FOUND).build(); } }
Example #30
Source File: BlueApi.java From swaggy-jenkins with MIT License | 5 votes |
@POST @Path("/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/replay") @Produces({ "application/json" }) @ApiOperation(value = "", notes = "Replay an organization pipeline run", response = QueueItemImpl.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "blueOcean", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully replayed a pipeline run", response = QueueItemImpl.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) }) public Response postPipelineRun(@PathParam("organization") @ApiParam("Name of the organization") String organization,@PathParam("pipeline") @ApiParam("Name of the pipeline") String pipeline,@PathParam("run") @ApiParam("Name of the run") String run) { return Response.ok().entity("magic!").build(); }