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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #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: 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 #16
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 #17
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 #18
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 #19
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 #20
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 #21
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 #22
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 #23
Source File: Container.java From rapid with MIT License | 5 votes |
@DELETE @Path("{id}") public Response deleteContainer(@PathParam("id") String containerId, @DefaultValue("false") @QueryParam("v") String v, @DefaultValue("false") @QueryParam("force") String force) { WebTarget target = resource().path(CONTAINERS) .path(containerId) .queryParam("v", v) .queryParam("force", force); Response response = deleteResponse(target); String entity = response.readEntity(String.class); try { if (entity.isEmpty()) { return Response.ok(Json.createObjectBuilder().add(MESSAGE, containerId + " deleted.").build()) .build(); } else { return Response.status(response.getStatus()) .entity(Json.createReader(new StringReader(entity)).read()) .build(); } } finally { response.close(); } }
Example #24
Source File: IRestBotStore.java From EDDI with Apache License 2.0 | 5 votes |
@GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Read bot.") BotConfiguration readBot(@PathParam("id") String id, @ApiParam(name = "version", required = true, format = "integer", example = "1") @QueryParam("version") Integer version);
Example #25
Source File: IRestPackageStore.java From EDDI with Apache License 2.0 | 5 votes |
@GET @Path("descriptors") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Read list of package descriptors.") List<DocumentDescriptor> readPackageDescriptors(@QueryParam("filter") @DefaultValue("") String filter, @QueryParam("index") @DefaultValue("0") Integer index, @QueryParam("limit") @DefaultValue("20") Integer limit);
Example #26
Source File: RawDatabusResource1.java From emodb with Apache License 2.0 | 5 votes |
@POST @Path("{subscription}/renew") @Consumes(MediaType.APPLICATION_JSON) public SuccessResponse renew(@PathParam("subscription") String subscription, @QueryParam("ttl") @DefaultValue("30") SecondsParam claimTtl, List<String> messageIds) { checkLegalSubscriptionName(subscription); // Check for null parameters, which will throw a 400, otherwise it throws a 5xx error checkArgument(messageIds != null, "Missing message Ids"); _eventStore.renew(subscription, messageIds, claimTtl.get(), true); return SuccessResponse.instance(); }
Example #27
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 #28
Source File: ProjectEndpoint.java From pnc with Apache License 2.0 | 5 votes |
@GET @Path("/{id}/build-configurations") public Response getBuildConfigurations( @PathParam("id") Integer id, @QueryParam(PAGE_INDEX_QUERY_PARAM) @DefaultValue(PAGE_INDEX_DEFAULT_VALUE) int pageIndex, @QueryParam(PAGE_SIZE_QUERY_PARAM) @DefaultValue(PAGE_SIZE_DEFAULT_VALUE) int pageSize, @QueryParam(SORTING_QUERY_PARAM) String sort, @QueryParam(QUERY_QUERY_PARAM) String q) { return fromCollection(buildConfigurationProvider.getAllForProject(pageIndex, pageSize, sort, q, id)); }
Example #29
Source File: FlussiRendicontazione.java From govpay with GNU General Public License v3.0 | 5 votes |
@GET @Path("/") @Produces({ "application/json" }) public Response findFlussiRendicontazione(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, @QueryParam(value=Costanti.PARAMETRO_PAGINA) @DefaultValue(value="1") Integer pagina, @QueryParam(value=Costanti.PARAMETRO_RISULTATI_PER_PAGINA) @DefaultValue(value="25") Integer risultatiPerPagina, @QueryParam("ordinamento") String ordinamento, @QueryParam("idDominio") String idDominio, @QueryParam("dataDa") String dataDa, @QueryParam("dataA") String dataA, @QueryParam("incassato") Boolean incassato, @QueryParam("idFlusso") String idFlusso, @QueryParam("stato") String stato){ this.buildContext(); return this.controller.findFlussiRendicontazione(this.getUser(), uriInfo, httpHeaders, pagina, risultatiPerPagina, ordinamento, dataDa, dataA, idDominio, incassato, idFlusso, stato); }
Example #30
Source File: TeamctiyRest.java From TeamcityTriggerHook with GNU Lesser General Public License v3.0 | 5 votes |
/** * Trigger a build on the Teamcity instance using vcs root * * @param repository The repository to trigger * @param page * @return The response. Ok if it worked. Otherwise, an error. */ @GET @Path(value = "loadjs") @Produces("text/javascript") public String loadjs(@Context final Repository repository, @QueryParam("page") final String page) { final ClassLoader classloader = Thread.currentThread().getContextClassLoader(); final InputStream is = classloader.getResourceAsStream("public/" + page); final String file = convertStreamToString(is); return file; }