javax.ws.rs.QueryParam Java Examples
The following examples show how to use
javax.ws.rs.QueryParam.
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: StramWebServices.java From attic-apex-core with Apache License 2.0 | 6 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/attributes") @Produces(MediaType.APPLICATION_JSON) public JSONObject getOperatorAttributes(@PathParam("operatorName") String operatorName, @QueryParam("attributeName") String attributeName) { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new NotFoundException(); } HashMap<String, String> map = new HashMap<>(); for (Map.Entry<Attribute<?>, Object> entry : dagManager.getOperatorAttributes(operatorName).entrySet()) { if (attributeName == null || entry.getKey().getSimpleName().equals(attributeName)) { Map.Entry<Attribute<Object>, Object> entry1 = (Map.Entry<Attribute<Object>, Object>)(Map.Entry)entry; map.put(entry1.getKey().getSimpleName(), entry1.getKey().codec.toString(entry1.getValue())); } } return new JSONObject(map); }
Example #2
Source File: KpiService.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
@GET @Path("/listAvailableAlias") @UserConstraint(functionalities = { SpagoBIConstants.KPI_MANAGEMENT }) public Response listAvailableAlias(@QueryParam("ruleId") Integer ruleId, @QueryParam("ruleVersion") Integer ruleVersion, @Context HttpServletRequest req) throws EMFUserError, JSONException { logger.debug("IN"); Response out; IKpiDAO dao = getKpiDAO(req); logger.debug("Getting available aliases"); List<Alias> aliases = dao.listAliasNotInMeasure(ruleId, ruleVersion); logger.debug("Getting unavailable aliases"); List<Alias> unavaliases = dao.listAliasInMeasure(ruleId, ruleVersion); JSONObject resp = new JSONObject(); resp.put("available", new JSONArray(JsonConverter.objectToJson(aliases, aliases.getClass()))); resp.put("notAvailable", new JSONArray(JsonConverter.objectToJson(unavaliases, unavaliases.getClass()))); out = Response.ok(resp.toString()).build(); logger.debug("OUT"); return out; }
Example #3
Source File: BinanceAuthenticated.java From zheshiyigeniubidexiangmu with MIT License | 6 votes |
@GET @Path("api/v3/openOrders") /** * Get all open orders without a symbol. * * @param symbol * @param recvWindow optional * @param timestamp mandatory * @return * @throws IOException * @throws BinanceException */ List<BinanceOrder> openOrders( @QueryParam("recvWindow") Long recvWindow, @QueryParam("timestamp") long timestamp, @HeaderParam(X_MBX_APIKEY) String apiKey, @QueryParam(SIGNATURE) ParamsDigest signature) throws IOException, BinanceException;
Example #4
Source File: RestService.java From dexter with Apache License 2.0 | 6 votes |
@GET @Path("/get-belonging-entities") @ApiOperation(value = "Given a category, returns the entities that belong to the category", response = ArticleDescription.class) @Produces({ MediaType.APPLICATION_JSON }) public String getBelongingEntities( @QueryParam("id") @DefaultValue("30061715") String wikiId, @QueryParam("wn") @DefaultValue("false") String asWikiNames) { boolean addWikinames = new Boolean(asWikiNames); int id = Integer.parseInt(wikiId); IncomingNodes entityIncomingNodes = EntityCategoryNodeFactory .getIncomingNodes(EntityCategoryNodeFactory.STD_TYPE); int[] in = entityIncomingNodes.getNeighbours(id); ArticleDescription e = new ArticleDescription(); e.setOutcomingEntities(getNodes(id, e, new ArrayList<ArticleDescription>(in.length), in, addWikinames)); return gson.toJson(e); }
Example #5
Source File: ScopeService.java From keycloak with Apache License 2.0 | 6 votes |
@Path("/search") @GET @Produces(MediaType.APPLICATION_JSON) @NoCache public Response find(@QueryParam("name") String name) { this.auth.realm().requireViewAuthorization(); StoreFactory storeFactory = authorization.getStoreFactory(); if (name == null) { return Response.status(Status.BAD_REQUEST).build(); } Scope model = storeFactory.getScopeStore().findByName(name, this.resourceServer.getId()); if (model == null) { return Response.status(Status.NO_CONTENT).build(); } return Response.ok(toRepresentation(model)).build(); }
Example #6
Source File: PartitionV1.java From metacat with Apache License 2.0 | 6 votes |
/** * Return list of partitions for a table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param sortBy sort by this name * @param sortOrder sort order to use * @param offset offset of the list * @param limit size of the list * @param includeUserMetadata whether to include user metadata for every partition in the list * @param getPartitionsRequestDto request * @return list of partitions for a table */ @POST @Path("catalog/{catalog-name}/database/{database-name}/table/{table-name}/request") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) List<PartitionDto> getPartitionsForRequest( @PathParam("catalog-name") String catalogName, @PathParam("database-name") String databaseName, @PathParam("table-name") String tableName, @QueryParam("sortBy") String sortBy, @QueryParam("sortOrder") SortOrder sortOrder, @QueryParam("offset") Integer offset, @QueryParam("limit") Integer limit, @DefaultValue("false") @QueryParam("includeUserMetadata") Boolean includeUserMetadata, GetPartitionsRequestDto getPartitionsRequestDto );
Example #7
Source File: IndexLabelAPI.java From hugegraph with Apache License 2.0 | 6 votes |
@GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed({"admin", "$owner=$graph $action=schema_read"}) public String list(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("names") List<String> names) { boolean listAll = CollectionUtils.isEmpty(names); if (listAll) { LOG.debug("Graph [{}] list index labels", graph); } else { LOG.debug("Graph [{}] get index labels by names {}", graph, names); } HugeGraph g = graph(manager, graph); List<IndexLabel> labels; if (listAll) { labels = g.schema().getIndexLabels(); } else { labels = new ArrayList<>(names.size()); for (String name : names) { labels.add(g.schema().getIndexLabel(name)); } } return manager.serializer(g).writeIndexlabels(mapIndexLabels(labels)); }
Example #8
Source File: DedupQueueResource1.java From emodb with Apache License 2.0 | 6 votes |
@POST @Path("_move") @RequiresPermissions({"queue|poll|{?from}", "queue|post|{?to}"}) @Timed(name = "bv.emodb.dedupq.DedupQueueResource1.moveAsync", absolute = true) @ApiOperation (value = "Asynchronous Move operation.", notes = "Returns a Map.", response = Map.class ) public Map<String, Object> moveAsync(@QueryParam("from") String from, @QueryParam("to") String to) { checkArgument(!Strings.isNullOrEmpty(from), "from is required"); checkArgument(!Strings.isNullOrEmpty(to), "to is required"); checkArgument(!from.equals(to), "cannot move queue to itself"); String id = _queueService.moveAsync(from, to); return ImmutableMap.<String, Object>of("id", id); }
Example #9
Source File: ClaimValueInjectionEndpoint.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@GET @Path("/verifyInjectedOptionalAuthTime") @Produces(MediaType.APPLICATION_JSON) public JsonObject verifyInjectedOptionalAuthTime(@QueryParam("auth_time") Long authTime) { boolean pass = false; String msg; // auth_time Optional<Long> optAuthTimeValue = this.authTime.getValue(); if(optAuthTimeValue == null || !optAuthTimeValue.isPresent()) { msg = Claims.auth_time.name()+" value is null or missing, FAIL"; } else if(optAuthTimeValue.get().equals(authTime)) { msg = Claims.auth_time.name()+" PASS"; pass = true; } else { msg = String.format("%s: %s != %s", Claims.auth_time.name(), optAuthTimeValue, authTime); } JsonObject result = Json.createObjectBuilder() .add("pass", pass) .add("msg", msg) .build(); return result; }
Example #10
Source File: WDSBlueMixProxyResource.java From movieapp-dialog with Apache License 2.0 | 6 votes |
/** * Initializes chat with WDS This initiates the chat with WDS by requesting for a client id and conversation id(to be used in subsequent API calls) and a * response message to be displayed to the user. If it's a returning user, it sets the First_Time profile variable to "No" so that the user is not taken * through the hand-holding process. * * @param firstTimeUser specifies if it's a new user or a returning user(true/false). If it is a returning user WDS is notified via profile var. * * @return a response containing either of these two entities- {@code WDSConversationPayload} or {@code ServerErrorPayload} */ @GET @Path("/initChat") @Produces(MediaType.APPLICATION_JSON) public Response startConversation(@QueryParam("firstTimeUser") boolean firstTimeUser) { Conversation conversation = dialogService.createConversation(dialog_id); if (!firstTimeUser) { Map<String, String> profile = new HashMap<>(); profile.put("First_Time", "No"); dialogService.updateProfile(dialog_id, conversation.getClientId(), profile); } WDSConversationPayload conversationPayload = new WDSConversationPayload(); conversationPayload.setClientId(Integer.toString(conversation.getClientId())); //$NON-NLS-1$ conversationPayload.setConversationId(Integer.toString(conversation.getId())); //$NON-NLS-1$ conversationPayload.setInput(conversation.getInput()); //$NON-NLS-1$ conversationPayload.setWdsResponse(StringUtils.join(conversation.getResponse(), " ")); return Response.ok(conversationPayload, MediaType.APPLICATION_JSON_TYPE).build(); }
Example #11
Source File: VertexLabelAPI.java From hugegraph with Apache License 2.0 | 6 votes |
@GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) @RolesAllowed({"admin", "$owner=$graph $action=schema_read"}) public String list(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("names") List<String> names) { boolean listAll = CollectionUtils.isEmpty(names); if (listAll) { LOG.debug("Graph [{}] list vertex labels", graph); } else { LOG.debug("Graph [{}] get vertex labels by names {}", graph, names); } HugeGraph g = graph(manager, graph); List<VertexLabel> labels; if (listAll) { labels = g.schema().getVertexLabels(); } else { labels = new ArrayList<>(names.size()); for (String name : names) { labels.add(g.schema().getVertexLabel(name)); } } return manager.serializer(g).writeVertexLabels(labels); }
Example #12
Source File: RealmAdminResource.java From keycloak with Apache License 2.0 | 6 votes |
/** * Partial export of existing realm into a JSON file. * * @param exportGroupsAndRoles * @param exportClients * @return */ @Path("partial-export") @POST @Produces(MediaType.APPLICATION_JSON) public RealmRepresentation partialExport(@QueryParam("exportGroupsAndRoles") Boolean exportGroupsAndRoles, @QueryParam("exportClients") Boolean exportClients) { auth.realm().requireViewRealm(); boolean groupsAndRolesExported = exportGroupsAndRoles != null && exportGroupsAndRoles; boolean clientsExported = exportClients != null && exportClients; if (groupsAndRolesExported) { auth.groups().requireList(); } if (clientsExported) { auth.clients().requireView(); } // service accounts are exported if the clients are exported // this means that if clients is true but groups/roles is false the service account is exported without roles // the other option is just include service accounts if clientsExported && groupsAndRolesExported ExportOptions options = new ExportOptions(false, clientsExported, groupsAndRolesExported, clientsExported); RealmRepresentation rep = ExportUtils.exportRealm(session, realm, options, false); return stripForExport(session, rep); }
Example #13
Source File: LoginActionsService.java From keycloak with Apache License 2.0 | 6 votes |
/** * protocol independent page for restart of the flow * * @return */ @Path(RESTART_PATH) @GET public Response restartSession(@QueryParam(AUTH_SESSION_ID) String authSessionId, // optional, can get from cookie instead @QueryParam(Constants.CLIENT_ID) String clientId, @QueryParam(Constants.TAB_ID) String tabId) { event.event(EventType.RESTART_AUTHENTICATION); SessionCodeChecks checks = new SessionCodeChecks(realm, session.getContext().getUri(), request, clientConnection, session, event, authSessionId, null, null, clientId, tabId, null); AuthenticationSessionModel authSession = checks.initialVerifyAuthSession(); if (authSession == null) { return checks.getResponse(); } String flowPath = authSession.getClientNote(AuthorizationEndpointBase.APP_INITIATED_FLOW); if (flowPath == null) { flowPath = AUTHENTICATE_PATH; } AuthenticationProcessor.resetFlow(authSession, flowPath); URI redirectUri = getLastExecutionUrl(flowPath, null, authSession.getClient().getClientId(), tabId); logger.debugf("Flow restart requested. Redirecting to %s", redirectUri); return Response.status(Response.Status.FOUND).location(redirectUri).build(); }
Example #14
Source File: Service.java From rapid with MIT License | 6 votes |
@POST @Path("{id}/update") public Response updateService(@PathParam("id") String id, @QueryParam("version") int version, @DefaultValue("spec") @QueryParam("registryAuthFrom") String registryAuthFrom, JsonObject content) { WebTarget target = resource().path("services").path(id).path("update").queryParam("registryAuthFrom", registryAuthFrom); if (version != 0) { target = target.queryParam("version", version); } Response response = postResponse(target, content); try { return Response.status(response.getStatus()).entity(response.readEntity(JsonObject.class)).build(); } finally { response.close(); } }
Example #15
Source File: Activity.java From sakai with Educational Community License v2.0 | 6 votes |
/** * Returns a list of events of a user between 2 dates. This one allows to pass strings, so * this can be called as a Rest Service * @param eid is the user that we want to query * @param startDateString limit the query ti these dates. In this case as String if we call it as a rest * @param endDateString limit the query ti these dates. In this case as String if we call it as a rest * @return String as the result of the Query in xml */ @WebMethod @Path("/getUserActivityRestVersion") @Produces("text/plain") @GET public String getUserActivityRestVersion( @WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid, @WebParam(name = "eid", partName = "eid") @QueryParam("eid") String eid, @WebParam(name = "startDate", partName = "startDate") @QueryParam("startDate") String startDateString, @WebParam(name = "endDate", partName = "endDate") @QueryParam("endDate") String endDateString) { Session session = establishSession(sessionid); if (!securityService.isSuperUser()) { log.warn("WS getUserActivityStringDates(): Permission denied. Restricted to super users."); throw new RuntimeException("WS getUserActivityStringDates(): Permission denied. Restricted to super users."); } return eventQueryService.getUserActivityRestVersion(eid, startDateString, endDateString); }
Example #16
Source File: I18nWebService.java From olat with Apache License 2.0 | 6 votes |
/** * Return the translation of the key. If the "locale" parameter is not specified, the method try to use the "locale" of the user and if it hasn't, take the default * locale. * * @response.representation.200.mediaType text/plain * @response.representation.200.doc The translation of the package + key * @response.representation.200.example OK * @param packageName * The name of the package * @param key * The key to translate * @param localeKey * The locale (optional) * @param request * The HTTP request (optional) * @return */ @GET @Path("{package}/{key}") @Produces(MediaType.TEXT_PLAIN) public Response getTranslation(@PathParam("package") final String packageName, @PathParam("key") final String key, @QueryParam("locale") final String localeKey, @Context final HttpServletRequest request) { final I18nManager i18n = I18nManager.getInstance(); Locale locale = null; if (StringHelper.containsNonWhitespace(localeKey)) { locale = i18n.getLocaleOrDefault(localeKey); } else { final UserRequest ureq = RestSecurityHelper.getUserRequest(request); if (ureq != null && ureq.getLocale() != null) { locale = ureq.getLocale(); } } if (locale == null) { locale = I18nModule.getDefaultLocale(); } final boolean overlayEnabled = I18nModule.isOverlayEnabled(); final String val = i18n.getLocalizedString(packageName, key, EMPTY_ARRAY, locale, overlayEnabled, true); return Response.ok(val).build(); }
Example #17
Source File: DatabusResource1.java From emodb with Apache License 2.0 | 6 votes |
@POST @Path ("{subscription}/renew") @Consumes (MediaType.APPLICATION_JSON) @RequiresPermissions ("databus|poll|{subscription}") @Timed (name = "bv.emodb.databus.DatabusResource1.renew", absolute = true) @ApiOperation (value = "Renew operation.", notes = "Returns a SucessResponse.", response = SuccessResponse.class ) public SuccessResponse renew(@QueryParam ("partitioned") BooleanParam partitioned, @PathParam ("subscription") String subscription, @QueryParam ("ttl") @DefaultValue ("30") SecondsParam claimTtl, List<String> eventKeys, @Authenticated Subject subject) { getClient(partitioned).renew(subject, subscription, eventKeys, claimTtl.get()); return SuccessResponse.instance(); }
Example #18
Source File: SCMRepositoryEndpoint.java From pnc with Apache License 2.0 | 6 votes |
/** * {@value GET_ALL} * * @param pageParameters * @param matchUrl {@value MATCH_URL} * @param searchUrl {@value SEARCH_URL} * @return */ @Operation( summary = GET_ALL, responses = { @ApiResponse( responseCode = SUCCESS_CODE, description = SUCCESS_DESCRIPTION, content = @Content(schema = @Schema(implementation = SCMRepositoryPage.class))), @ApiResponse( responseCode = INVALID_CODE, description = INVALID_DESCRIPTION, content = @Content(schema = @Schema(implementation = ErrorResponse.class))), @ApiResponse( responseCode = SERVER_ERROR_CODE, description = SERVER_ERROR_DESCRIPTION, content = @Content(schema = @Schema(implementation = ErrorResponse.class))) }) @GET Page<SCMRepository> getAll( @Valid @BeanParam PageParameters pageParameters, @Parameter(description = MATCH_URL) @QueryParam(MATCH_QUERY_PARAM) String matchUrl, @Parameter(description = SEARCH_URL) @QueryParam(SEARCH_QUERY_PARAM) String searchUrl);
Example #19
Source File: UserRest.java From mobi with GNU Affero General Public License v3.0 | 6 votes |
/** * Resets the password of the specified User in Mobi. This action is only allowed by admin Users. * * @param context the context of the request * @param username the current username of the User to update * @param newPassword a new password for the User * @return a Response indicating the success or failure of the request */ @PUT @Path("{username}/password") @RolesAllowed("admin") @ApiOperation("Resets a Mobi User's password if User making request is the admin") public Response resetPassword(@Context ContainerRequestContext context, @PathParam("username") String username, @QueryParam("newPassword") String newPassword) { if (StringUtils.isEmpty(username)) { throw ErrorUtils.sendError("Current username must be provided", Response.Status.BAD_REQUEST); } if (StringUtils.isEmpty(newPassword)) { throw ErrorUtils.sendError("New password must be provided", Response.Status.BAD_REQUEST); } try { return changePassword(username, newPassword); } catch (IllegalArgumentException ex) { throw ErrorUtils.sendError(ex.getMessage(), Response.Status.BAD_REQUEST); } }
Example #20
Source File: PreferencesService.java From che with Eclipse Public License 2.0 | 6 votes |
@GET @Produces(APPLICATION_JSON) @GenerateLink(rel = LINK_REL_PREFERENCES) @ApiOperation( value = "Gets preferences of logged in user", notes = "If not all the preferences needed then 'filter' may be used, " + "basically it is regex for filtering preferences by names") @ApiResponses({ @ApiResponse(code = 200, message = "Preferences successfully fetched"), @ApiResponse(code = 500, message = "Internal Server Error") }) public Map<String, String> find( @ApiParam( "Regex for filtering preferences by names, e.g. '.*github.*' " + "will return all the preferences which name contains github") @QueryParam("filter") String filter) throws ServerException { if (filter == null) { return preferenceManager.find(userId()); } return preferenceManager.find(userId(), filter); }
Example #21
Source File: ContextService.java From semanticMDR with GNU General Public License v3.0 | 6 votes |
@GET @Path("/property/search") @Produces(MediaType.APPLICATION_JSON) public Response searchProperty( @CookieParam(AuthenticationService.SID) String sessionID, @PathParam("contextid") String contextID, @QueryParam("q") String keyword) { WebUtil.checkUserSession(sessionID); Repository repository = RepositoryManager.getInstance().getRepository(); Context context = repository.getContext(contextID); List<Property> propertyList = context.searchProperty(keyword, TextSearchType.WildCard); List<PropertyModel> pList = new ArrayList<PropertyModel>(); for (Property p : propertyList) { pList.add(new PropertyModel(p)); } return Response.ok(pList).build(); }
Example #22
Source File: ControlHubResource.java From datacollector with Apache License 2.0 | 6 votes |
@Path("/users") @GET @ApiOperation( value = "Get Control Hub Users", response = Map.class, authorizations = @Authorization(value = "guest") ) @Produces(MediaType.APPLICATION_JSON) @PermitAll public Response getControlHubUsers( @Context HttpServletRequest request, @QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("len") @DefaultValue("50") int len ) { checkIfControlHubEnabled(); return ControlHubUtil.getControlHubUsers(request, controlHubBaseUrl, offset, len); }
Example #23
Source File: TestsAndQuizzes.java From sakai with Educational Community License v2.0 | 5 votes |
/** * createAssessmentFromExportFile - WS Endpoint, exposing the SamLite createImportedAssessment() * * @param String sessionid the id of a valid admin session * @param String siteid the enterprise/sakai id of the site to be archived * @param String siteproperty the property that holds the enterprise site id * @param String xmlfile path to the IMS QTI document containing the assessment * @return boolean returns true if assessment created successfully, false if assessment is null * * @throws AxisFault WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() returned a null QTI Document * WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() ParserConfigurationException: * WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() SaxException: * WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() IOException: * */ @WebMethod @Path("/createAssessmentFromExportFile") @Produces("text/plain") @GET public boolean createAssessmentFromExportFile( @WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid, @WebParam(name = "siteid", partName = "siteid") @QueryParam("siteid") String siteid, @WebParam(name = "siteproperty", partName = "siteproperty") @QueryParam("siteproperty") String siteproperty, @WebParam(name = "xmlfile", partName = "xmlfile") @QueryParam("xmlfile") String xmlfile) { Session session = establishSession(sessionid); Document document = null; try { document = XmlUtil.readDocument(xmlfile, true); } catch (ParserConfigurationException pce) { log.error("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() ParserConfigurationException: " + pce.getMessage(), pce); throw new RuntimeException("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() ParserConfigurationException: " + pce.getMessage()); } catch (SAXException saxe) { log.error("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() SaxException: " + saxe.getMessage(), saxe); throw new RuntimeException("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() SaxException: " + saxe.getMessage()); } catch (IOException ioe) { log.error("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() IOException: " + ioe.getMessage(), ioe); throw new RuntimeException("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() IOException: " + ioe.getMessage()); } if (document == null) { throw new RuntimeException("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() returned a null QTI Document"); } return createAssessment(siteid, siteproperty, null, null, null, document); }
Example #24
Source File: RepositoryApi.java From bitbucket-rest with Apache License 2.0 | 5 votes |
@Named("repository:list-all") @Documentation({"https://docs.atlassian.com/bitbucket-server/rest/5.0.0/bitbucket-rest.html#idm45659055274784"}) @Consumes(MediaType.APPLICATION_JSON) @Path("/repos") @Fallback(BitbucketFallbacks.RepositoryPageOnError.class) @GET RepositoryPage listAll(@Nullable @QueryParam("projectname") String project, @Nullable @QueryParam("name") String repo, @Nullable @QueryParam("permission") String permission, @Nullable @QueryParam("visibility") String visibility, @Nullable @QueryParam("start") Integer start, @Nullable @QueryParam("limit") Integer limit);
Example #25
Source File: ApiKeyResource1.java From emodb with Apache License 2.0 | 5 votes |
/** * Creates an API Key. */ @POST @Consumes("application/x.json-create-api-key") public Response createApiKey(CreateEmoApiKeyRequest request, @QueryParam("key") String key, @Authenticated Subject subject) { if (key != null) { request.setCustomRequestParameter("key", key); } CreateEmoApiKeyResponse response = _uac.createApiKey(subject, request); return Response.created(URI.create(response.getId())) .entity(response) .build(); }
Example #26
Source File: GeoServerService.java From geowave with Apache License 2.0 | 5 votes |
@POST @Produces(MediaType.APPLICATION_JSON) @Path("/cv/rm") public Response removeCoverage( @QueryParam("cvgstore") String cvgstore, @QueryParam("coverageName") String coverageName, @QueryParam("workspace") String workspace);
Example #27
Source File: SitemapResource.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@GET @Path("/{sitemapname: [a-zA-Z_0-9]*}/{pageid: [a-zA-Z_0-9]*}") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Polls the data for a sitemap.", response = PageDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 404, message = "Sitemap with requested name does not exist or page does not exist, or page refers to a non-linkable widget"), @ApiResponse(code = 400, message = "Invalid subscription id has been provided.") }) public Response getPageData(@Context HttpHeaders headers, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("sitemapname") @ApiParam(value = "sitemap name") String sitemapname, @PathParam("pageid") @ApiParam(value = "page id") String pageId, @QueryParam("subscriptionid") @ApiParam(value = "subscriptionid", required = false) String subscriptionId) { final Locale locale = localeService.getLocale(language); logger.debug("Received HTTP GET request from IP {} at '{}'", request.getRemoteAddr(), uriInfo.getPath()); if (subscriptionId != null) { try { subscriptions.setPageId(subscriptionId, sitemapname, pageId); } catch (IllegalArgumentException e) { return JSONResponse.createErrorResponse(Response.Status.BAD_REQUEST, e.getMessage()); } } boolean timeout = false; if (headers.getRequestHeader("X-Atmosphere-Transport") != null) { // Make the REST-API pseudo-compatible with openHAB 1.x // The client asks Atmosphere for server push functionality, // so we do a simply listening for changes on the appropriate items // The blocking has a timeout of 30 seconds. If this timeout is reached, // we notice this information in the response object. timeout = blockUnlessChangeOccurs(sitemapname, pageId); } PageDTO responseObject = getPageBean(sitemapname, pageId, uriInfo.getBaseUriBuilder().build(), locale, timeout); return Response.ok(responseObject).build(); }
Example #28
Source File: DenyAllClassLevel.java From thorntail with Apache License 2.0 | 5 votes |
@GET @Path("/permitAll") @PermitAll public String echoPermitAll(@Context SecurityContext sec, @QueryParam("input") String input) { Principal user = sec.getUserPrincipal(); return input + ", user="+user.getName(); }
Example #29
Source File: HttpResource.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Path("/http/get") @GET @Produces(MediaType.TEXT_PLAIN) public String httpGet(@QueryParam("test-port") int port) { return producerTemplate .to("http://localhost:" + port + "/service/get?bridgeEndpoint=true") .withHeader(Exchange.HTTP_METHOD, "GET") .request(String.class); }
Example #30
Source File: ClusterAccessor.java From helix with Apache License 2.0 | 5 votes |
@PUT @Path("{clusterId}") public Response createCluster(@PathParam("clusterId") String clusterId, @DefaultValue("false") @QueryParam("recreate") String recreate, @DefaultValue("false") @QueryParam("addCloudConfig") String addCloudConfig, String cloudConfigManifest) { boolean recreateIfExists = Boolean.parseBoolean(recreate); boolean cloudConfigIncluded = Boolean.parseBoolean(addCloudConfig); ClusterSetup clusterSetup = getClusterSetup(); CloudConfig cloudConfig = null; if (cloudConfigIncluded) { ZNRecord record; try { record = toZNRecord(cloudConfigManifest); cloudConfig = new CloudConfig.Builder(record).build(); } catch (IOException | HelixException e) { String errMsg = "Failed to generate a valid CloudConfig from " + cloudConfigManifest; LOG.error(errMsg, e); return badRequest(errMsg + " Exception: " + e.getMessage()); } } try { clusterSetup.addCluster(clusterId, recreateIfExists, cloudConfig); } catch (Exception ex) { LOG.error("Failed to create cluster {}. Exception: {}.", clusterId, ex); return serverError(ex); } return created(); }