javax.ws.rs.HeaderParam Java Examples

The following examples show how to use javax.ws.rs.HeaderParam. 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: Services.java    From olingo-odata4 with Apache License 2.0 7 votes vote down vote up
@PATCH
@Path("/{entitySetName}({entityId})")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
public Response patchEntity(
    @Context final UriInfo uriInfo,
    @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
    @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
    @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
    @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
    @PathParam("entitySetName") final String entitySetName,
    @PathParam("entityId") final String entityId,
    final String changes) {

  final Response response =
      getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
          accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
  return response.getStatus() >= 400 ?
      postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, changes) :
      patchEntityInternal(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes);
}
 
Example #2
Source File: ShoppingListApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/{id}/entries")
@ApiOperation(value = "Gets all entries from a shopping list.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_UNAUTHORIZED, message = HTTP_UNAUTHORIZED_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
PagedResponse<ShoppingListEntry> getShoppingListEntries(
    @ApiParam(value = "The id of the shopping list to return entries from.", required = true)
    @PathParam("id")
    String id,

    @ApiParam(value = "Defines the number of entries to skip.")
    @QueryParam(value = "offset")
    @Min(value = 0)
    Integer offset,

    @ApiParam(value = "Defines the maximum number of entries to be returned.")
    @QueryParam(value = "limit")
    @Min(value = 0)
    Integer limit,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage
);
 
Example #3
Source File: FeatureResourceImpl.java    From osiris with Apache License 2.0 6 votes vote down vote up
@Override
@Path("/{idFeature}")
@DELETE
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Delete a feature", httpMethod="DELETE")
@ApiResponses(value = {
		@ApiResponse(code = 204, message = "Feature was deleted"),
		@ApiResponse(code = 400, message = "Invalid input parameter (header)"),
		@ApiResponse(code = 404, message = "Feature was not found")})
public Response deleteFeature(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier, 
		@ApiParam(required=true, value="Feature identifier") @NotBlank @NotNull @PathParam("idFeature") String idFeature) throws FeatureNotExistException {
	// TODO Auto-generated method stub
	validations.checkIsNotNullAndNotBlank(appIdentifier,idFeature);
	featureManager.deleteFeature(appIdentifier, idFeature);
	return Response.noContent().build();
}
 
Example #4
Source File: ExtensionResource.java    From openhab-core with Eclipse Public License 2.0 6 votes vote down vote up
@GET
@Path("/{extensionId: [a-zA-Z_0-9-]+}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get extension with given ID.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class),
        @ApiResponse(code = 404, message = "Not found") })
public Response getById(@HeaderParam("Accept-Language") @ApiParam(value = "language") @Nullable String language,
        @PathParam("extensionId") @ApiParam(value = "extension ID") String extensionId) {
    logger.debug("Received HTTP GET request at '{}'.", uriInfo.getPath());
    Locale locale = localeService.getLocale(language);
    ExtensionService extensionService = getExtensionService(extensionId);
    Extension responseObject = extensionService.getExtension(extensionId, locale);
    if (responseObject != null) {
        return Response.ok(responseObject).build();
    }

    return Response.status(404).build();
}
 
Example #5
Source File: DataStoreShadedClientTest.java    From emodb with Apache License 2.0 6 votes vote down vote up
@GET
@Path("_table")
public List<Map<String, Object>> listTables(@HeaderParam("X-BV-API-Key") String apiKey,
                                            @QueryParam("limit") Integer limit) {
    assertEquals(apiKey, API_KEY);
    assertEquals(limit, new Integer(1));

    return ImmutableList.<Map<String, Object>>of(
            ImmutableMap.<String, Object>builder()
                    .put("name", "test:table")
                    .put("options", ImmutableMap.<String, Object>of(
                            "placement", "ugc_us:ugc",
                            "facades", ImmutableList.of()))
                    .put("template", ImmutableMap.<String, Object>of(
                            "type", "test"))
                    .put("availability", ImmutableMap.<String, Object>of(
                            "placement", "ugc_us:ugc",
                            "facade", false))
                    .build());
}
 
Example #6
Source File: Services.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/People/{type:.*}")
public Response getPeople(
    @Context final UriInfo uriInfo,
    @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
    @PathParam("type") final String type,
    @QueryParam("$top") @DefaultValue(StringUtils.EMPTY) final String top,
    @QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) final String skip,
    @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
    @QueryParam("$count") @DefaultValue(StringUtils.EMPTY) final String count,
    @QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) final String filter,
    @QueryParam("$search") @DefaultValue(StringUtils.EMPTY) final String search,
    @QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) final String orderby,
    @QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) final String skiptoken) {

  return StringUtils.isBlank(filter) && StringUtils.isBlank(search) ?
      NumberUtils.isNumber(type) ?
          getEntityInternal(uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null) :
          getEntitySet(accept, "People", type) :
      getEntitySet(uriInfo, accept, "People", top, skip, format, count, filter, orderby, skiptoken, type);
}
 
Example #7
Source File: MessageResource.java    From io with Apache License 2.0 6 votes vote down vote up
/**
 * メッセージ送信API.
 * @param version PCSバージョン
 * @param uriInfo UriInfo
 * @param reader リクエストボディ
 * @return レスポンス
 */
@POST
@Path("send")
public Response messages(
        @HeaderParam(DcCoreUtils.HttpHeaders.X_DC_VERSION) final String version,
        @Context final UriInfo uriInfo,
        final Reader reader) {
    // アクセス制御
    this.davRsCmp.checkAccessContext(this.accessContext, CellPrivilege.MESSAGE);

    // データ登録
    DcODataProducer producer = ModelFactory.ODataCtl.cellCtl(this.accessContext.getCell());
    MessageODataResource moResource = new MessageODataResource(this, producer, SentMessagePort.EDM_TYPE_NAME);
    moResource.setVersion(version);
    Response respose = moResource.createMessage(uriInfo, reader);
    return respose;
}
 
Example #8
Source File: KeyAsSegment.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/{entitySetName}/{entityId}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
public Response putNewEntity(
    @Context final UriInfo uriInfo,
    @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
    @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
    @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
    @PathParam("entitySetName") final String entitySetName,
    @PathParam("entityId") final String entityId,
    final String entity) {

  return replaceServiceName(super
      .replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity));
}
 
Example #9
Source File: BinanceAuthenticated.java    From zheshiyigeniubidexiangmu with MIT License 6 votes vote down vote up
@GET
@Path("api/v3/myTrades")
/**
 * Get trades for a specific account and symbol.
 *
 * @param symbol
 * @param limit optional, default 500; max 500.
 * @param fromId optional, tradeId to fetch from. Default gets most recent trades.
 * @param recvWindow optional
 * @param timestamp
 * @param apiKey
 * @param signature
 * @return
 * @throws IOException
 * @throws BinanceException
 */
List<BinanceTrade> myTrades(
    @QueryParam("symbol") String symbol,
    @QueryParam("limit") Integer limit,
    @QueryParam("fromId") Long fromId,
    @QueryParam("recvWindow") Long recvWindow,
    @QueryParam("timestamp") long timestamp,
    @HeaderParam(X_MBX_APIKEY) String apiKey,
    @QueryParam(SIGNATURE) ParamsDigest signature)
    throws IOException, BinanceException;
 
Example #10
Source File: ChannelTypeResource.java    From openhab-core with Eclipse Public License 2.0 6 votes vote down vote up
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets all available channel types.", response = ChannelTypeDTO.class, responseContainer = "Set")
@ApiResponses(value = @ApiResponse(code = 200, message = "OK", response = ChannelTypeDTO.class, responseContainer = "Set"))
public Response getAll(
        @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") @Nullable String language,
        @QueryParam("prefixes") @ApiParam(value = "filter UIDs by prefix (multiple comma-separated prefixes allowed, for example: 'system,mqtt')") @Nullable String prefixes) {
    Locale locale = localeService.getLocale(language);

    Stream<ChannelTypeDTO> channelStream = channelTypeRegistry.getChannelTypes(locale).stream()
            .map(c -> convertToChannelTypeDTO(c, locale));

    if (prefixes != null) {
        Predicate<ChannelTypeDTO> filter = ct -> false;
        for (String prefix : prefixes.split(",")) {
            filter = filter.or(ct -> ct.UID.startsWith(prefix + ":"));
        }
        channelStream = channelStream.filter(filter);
    }

    return Response.ok(new Stream2JSONInputStream(channelStream)).build();
}
 
Example #11
Source File: RsEndpoint.java    From timbuctoo with GNU General Public License v3.0 6 votes vote down vote up
@GET
@Path("{ownerId}/{dataSetName}/changelist.xml")
@Produces(MediaType.APPLICATION_XML)
public Response getChangeList(@HeaderParam("authorization") String authHeader,
                              @PathParam("ownerId") String owner,
                              @PathParam("dataSetName") String dataSetName) throws IOException {
  User user = getUser(authHeader);
  Optional<Urlset> maybeChangeList = rsDocumentBuilder.getChangeList(user, owner, dataSetName);
  if (maybeChangeList.isPresent()) {
    return Response.ok(maybeChangeList.get()).build();
  } else if (user != null) {
    return Response.status(Response.Status.FORBIDDEN).build();
  } else {
    return Response.status(Response.Status.UNAUTHORIZED).build();
  }
}
 
Example #12
Source File: EventResource.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Path("action") // $NON-NLS-1$
@PUT
public Response putEventAction(String requestEntity, @HeaderParam("Content-Type") String contentType, // $NON-NLS-1$
                    @Context UriInfo uriInfo, @PathParam(EVENT) String id,
                    @QueryParam(URL_PARAM_ACTION_TYPE) String type) {
    
    CALENDAR_SERVICE_LOGGER.traceEntry(this, "putEventAction"); // $NON-NLS-1$
    CalendarService.beforeRequest(FEATURE_REST_API_CALENDAR_EVENT, STAT_MISC);

    CalendarService.verifyDatabaseContext();

    EventActionResource.putEventActionInternal(requestEntity, contentType, id, null, null, type);

    ResponseBuilder builder = Response.ok();
    Response response = builder.build();

    CALENDAR_SERVICE_LOGGER.traceExit(this, "putEventAction", response); // $NON-NLS-1$
    return response;
}
 
Example #13
Source File: ModuleTypeResource.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@GET
@Path("/{moduleTypeUID}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets a module type corresponding to the given UID.", response = ModuleTypeDTO.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ModuleTypeDTO.class),
        @ApiResponse(code = 404, message = "Module Type corresponding to the given UID does not found.") })
public Response getByUID(@HeaderParam("Accept-Language") @ApiParam(value = "language") String language,
        @PathParam("moduleTypeUID") @ApiParam(value = "moduleTypeUID", required = true) String moduleTypeUID) {
    Locale locale = localeService.getLocale(language);
    final ModuleType moduleType = moduleTypeRegistry.get(moduleTypeUID, locale);
    if (moduleType != null) {
        return Response.ok(getModuleTypeDTO(moduleType)).build();
    } else {
        return Response.status(Status.NOT_FOUND).build();
    }
}
 
Example #14
Source File: ThingResource.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@GET
@Path("/{thingUID}/firmwares")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get all available firmwares for provided thing UID", response = StrippedThingTypeDTO.class, responseContainer = "Set")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"),
        @ApiResponse(code = 204, message = "No firmwares found.") })
public Response getFirmwares(@PathParam("thingUID") @ApiParam(value = "thingUID") String thingUID,
        @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = HttpHeaders.ACCEPT_LANGUAGE) String language) {
    ThingUID aThingUID = new ThingUID(thingUID);
    Thing thing = thingRegistry.get(aThingUID);
    if (null == thing) {
        logger.info(
                "Received HTTP GET request for listing available firmwares at {} for unknown thing with UID '{}'",
                uriInfo.getPath(), thingUID);
        return getThingNotFoundResponse(thingUID);
    }
    Collection<Firmware> firmwares = firmwareRegistry.getFirmwares(thing, localeService.getLocale(language));

    if (firmwares.isEmpty()) {
        return Response.status(Status.NO_CONTENT).build();
    }

    Stream<FirmwareDTO> firmwareStream = firmwares.stream().map(this::convertToFirmwareDTO);
    return Response.ok().entity(new Stream2JSONInputStream(firmwareStream)).build();
}
 
Example #15
Source File: LraResource.java    From microprofile-lra with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/multiLevelNestedActivity")
@LRA(value = LRA.Type.MANDATORY, end = false)
public Response multiLevelNestedActivity(
        @HeaderParam(LRA_HTTP_RECOVERY_HEADER) URI recoveryId,
        @HeaderParam(LRA_HTTP_CONTEXT_HEADER) URI nestedLRAId,
        @QueryParam("nestedCnt") @DefaultValue("1") Integer nestedCnt) {
    assertHeaderPresent(nestedLRAId, LRA_HTTP_CONTEXT_HEADER);
    assertHeaderPresent(recoveryId, LRA_HTTP_RECOVERY_HEADER);

    storeActivity(nestedLRAId, recoveryId);

    // invoke resources that enlist nested LRAs
    String[] lras = new String[nestedCnt + 1];
    lras[0] = nestedLRAId.toASCIIString();
    IntStream.range(1, lras.length).forEach(i -> lras[i] = restPutInvocation(nestedLRAId,"nestedActivity", ""));

    return Response.ok(String.join(",", lras)).build();
}
 
Example #16
Source File: MetaDataResourceImpl.java    From osiris with Apache License 2.0 6 votes vote down vote up
@Override
@GET
@ValidationRequired(processor = RestViolationProcessor.class)
@ApiOperation(value = "Get metadata of map", httpMethod="GET", response=MetaDataDTO.class)
@ApiResponses(value = {
		@ApiResponse(code = 200, message = "Metadata of map was found", response=MetaDataDTO.class),
		@ApiResponse(code = 400, message = "Invalid input parameter (header)"),
		@ApiResponse(code = 400, message = "Metadata of map was not found")})			 
public Response getMetaData(@Auth BasicAuth principal,
		@ApiParam(value = "Application identifier", required = true) @NotBlank @NotNull @HeaderParam("api_key") String appIdentifier) throws AssemblyException, MetaDataNotExistsException {
	// TODO Auto-generated method stub		
	validations.checkIsNotNullAndNotBlank(appIdentifier);
	MetaData metaData = metaDataManagerImpl.getMetaData(appIdentifier);
	MetaDataDTO metaDataDTO=metaDataAssemblerImpl.createDataTransferObject(metaData);
	return Response.ok(metaDataDTO).build();
	
}
 
Example #17
Source File: Services.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/Accounts({entityId})/{containedEntitySetName}({containedEntityId})")
public Response getContainedEntity(
    @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
    @PathParam("entityId") final String entityId,
    @PathParam("containedEntitySetName") final String containedEntitySetName,
    @PathParam("containedEntityId") final String containedEntityId,
    @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {

  try {
    final Accept acceptType;
    if (StringUtils.isNotBlank(format)) {
      acceptType = Accept.valueOf(format.toUpperCase());
    } else {
      acceptType = Accept.parse(accept);
    }
    if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
      throw new UnsupportedMediaTypeException("Unsupported media type");
    }

    final StringBuilder containedPath = containedPath(entityId, containedEntitySetName);
    if (StringUtils.isNotBlank(containedEntityId)) {
      containedPath.append('(').append(containedEntityId).append(')');
    }
    final InputStream entry = FSManager.instance().readFile(containedPath.toString(), Accept.ATOM);

    final ResWrap<Entity> container = atomDeserializer.toEntity(entry);

    return xml.createResponse(
        null,
        xml.writeEntity(acceptType, container),
        null,
        acceptType);
  } catch (Exception e) {
    return xml.createFaultResponse(accept, e);
  }
}
 
Example #18
Source File: CoinbaseAuthenticated.java    From zheshiyigeniubidexiangmu with MIT License 5 votes vote down vote up
@GET
@Path("payment-methods")
CoinbasePaymentMethodsData getPaymentMethods(
    @HeaderParam(CB_VERSION) String apiVersion,
    @HeaderParam(CB_ACCESS_KEY) String apiKey,
    @HeaderParam(CB_ACCESS_SIGN) CoinbaseV2Digest signature,
    @HeaderParam(CB_ACCESS_TIMESTAMP) BigDecimal timestamp)
    throws IOException, CoinbaseException;
 
Example #19
Source File: NonParticipatingTckResource.java    From microprofile-lra with Apache License 2.0 5 votes vote down vote up
@PUT
@Path(NonParticipatingTckResource.START_LRA_VIA_REMOTE_INVOCATION)
@LRA(value = LRA.Type.SUPPORTS, end = false,
        cancelOnFamily = Response.Status.Family.SERVER_ERROR)
public Response notSupportedButCallServiceWhichStartsButDoesntEndAnLRA(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) URI lraId) {
    return Response.ok(invokeRestEndpoint(lraId, TCK_NON_PARTICIPANT_RESOURCE_PATH, START_BUT_DONT_END_PATH,
            200)).build();
}
 
Example #20
Source File: ThingTypeResource.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@GET
@RolesAllowed({ Role.USER })
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets all available thing types without config description, channels and properties.", response = StrippedThingTypeDTO.class, responseContainer = "Set")
@ApiResponses(value = @ApiResponse(code = 200, message = "OK", response = StrippedThingTypeDTO.class, responseContainer = "Set"))
public Response getAll(
        @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = HttpHeaders.ACCEPT_LANGUAGE) String language) {
    Locale locale = localeService.getLocale(language);
    Stream<StrippedThingTypeDTO> typeStream = thingTypeRegistry.getThingTypes(locale).stream()
            .map(t -> convertToStrippedThingTypeDTO(t, locale));
    return Response.ok(new Stream2JSONInputStream(typeStream)).build();
}
 
Example #21
Source File: NonParticipatingTckResource.java    From microprofile-lra with Apache License 2.0 5 votes vote down vote up
@PUT
@Path(NonParticipatingTckResource.START_BUT_DONT_END_NESTED_PATH)
@LRA(value = LRA.Type.NESTED, end = false,
        cancelOnFamily = Response.Status.Family.SERVER_ERROR)
public Response startAndDontEndNestedLRA(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) URI lraId) {
    return Response.ok(lraId).build();
}
 
Example #22
Source File: ContestAnnouncementService.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@PUT
@Path("/{announcementJid}")
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
ContestAnnouncement updateAnnouncement(
        @HeaderParam(AUTHORIZATION) AuthHeader authHeader,
        @PathParam("contestJid") String contestJid,
        @PathParam("announcementJid") String announcementJid,
        ContestAnnouncementData data);
 
Example #23
Source File: UserManagementServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/search/usernames")
@Override
public Response getUserNames(@QueryParam("filter") String filter, @QueryParam("domain") String domain,
                             @HeaderParam("If-Modified-Since") String timestamp,
                             @QueryParam("offset") int offset, @QueryParam("limit") int limit) {
    if (log.isDebugEnabled()) {
        log.debug("Getting the list of users with all user-related information using the filter : " + filter);
    }
    String userStoreDomain = Constants.PRIMARY_USER_STORE;
    if (domain != null && !domain.isEmpty()) {
        userStoreDomain = domain;
    }
    if (limit == 0){
        //If there is no limit is passed, then return all.
        limit = -1;
    }
    List<UserInfo> userList;
    try {
        UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
        String[] users = userStoreManager.listUsers(userStoreDomain + "/" + filter + "*", limit);
        userList = new ArrayList<>();
        UserInfo user;
        for (String username : users) {
            user = new UserInfo();
            user.setUsername(username);
            user.setEmailAddress(getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS));
            user.setFirstname(getClaimValue(username, Constants.USER_CLAIM_FIRST_NAME));
            user.setLastname(getClaimValue(username, Constants.USER_CLAIM_LAST_NAME));
            userList.add(user);
        }
        return Response.status(Response.Status.OK).entity(userList).build();
    } catch (UserStoreException e) {
        String msg = "Error occurred while retrieving the list of users using the filter : " + filter;
        log.error(msg, e);
        return Response.serverError().entity(
                new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
    }
}
 
Example #24
Source File: ItemSubmissionService.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@POST
@Path("/regrade")
void regradeSubmissions(
        @HeaderParam(AUTHORIZATION) AuthHeader authHeader,
        @QueryParam("containerJid") Optional<String> containerJid,
        @QueryParam("userJid") Optional<String> userJid,
        @QueryParam("problemJid") Optional<String> problemJid);
 
Example #25
Source File: BitfinexAuthenticated.java    From zheshiyigeniubidexiangmu with MIT License 5 votes vote down vote up
@POST
@Path("offer/new")
BitfinexOfferStatusResponse newOffer(
    @HeaderParam("X-BFX-APIKEY") String apiKey,
    @HeaderParam("X-BFX-PAYLOAD") ParamsDigest payload,
    @HeaderParam("X-BFX-SIGNATURE") ParamsDigest signature,
    BitfinexNewOfferRequest newOfferRequest)
    throws IOException, BitfinexException;
 
Example #26
Source File: APIEndpointLatest.java    From microprofile-starter with Apache License 2.0 5 votes vote down vote up
@Path("/project")
@GET
@Produces({"application/zip", "application/json"})
public Response getProject(@HeaderParam(HttpHeaders.IF_NONE_MATCH) String ifNoneMatch,
                           @QueryParam("supportedServer") SupportedServer supportedServer,
                           @QueryParam("groupId") String groupId,
                           @QueryParam("artifactId") String artifactId,
                           @QueryParam("mpVersion") MicroProfileVersion mpVersion,
                           @QueryParam("javaSEVersion") JavaSEVersion javaSEVersion,
                           @QueryParam("selectedSpecs") List<MicroprofileSpec> selectedSpecs,
                           @QueryParam("selectAllSpecs") boolean selectAllSpecs) {
    return api.getProject(ifNoneMatch, supportedServer, groupId, artifactId, mpVersion, javaSEVersion, selectedSpecs, selectAllSpecs);
}
 
Example #27
Source File: EdgePublicHeadersJaxrsSchema.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@Path("requestHeaders")
@GET
public String getRequestHeaders(@HeaderParam(value = "x_cse_test") String testHeader,
    HttpServletRequest request) {
  String external1 = request.getHeader("external_1");
  String external2 = request.getHeader("external_2");
  String external3 = request.getHeader("external_3");
  if (StringUtils.isEmpty(external3)) {
    return testHeader + "_" + external1 + "_" + external2;
  }
  return testHeader + "_" + external1 + "_" + external2 + "_" + external3;
}
 
Example #28
Source File: ContextTckResource.java    From microprofile-lra with Apache License 2.0 5 votes vote down vote up
@PUT
@Path(RESET_PATH)
public Response reset(@HeaderParam(LRA_TCK_HTTP_CONTEXT_HEADER) URI lraId) {
    status = ParticipantStatus.Active;
    endPhase = EndPhase.SUCCESS;
    endPhaseStatus = Response.Status.OK;

    lraMetricService.clear();

    return Response.ok().build();
}
 
Example #29
Source File: DedupQueueShadedClientTest.java    From emodb with Apache License 2.0 5 votes vote down vote up
@POST
@Path("_move")
public Map<String, Object> moveAsync(@HeaderParam("X-BV-API-Key") String apiKey,
                                     @QueryParam("from") String from, @QueryParam("to") String to) {
    assertEquals(apiKey, API_KEY);
    assertEquals(from, "test-queue-old");
    assertEquals(to, "test-queue-new");
    return ImmutableMap.<String, Object>of("id", "test-move");
}
 
Example #30
Source File: ContestContestantService.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@POST
@Path("/batch-upsert")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
ContestContestantsUpsertResponse upsertContestants(
        @HeaderParam(AUTHORIZATION) AuthHeader authHeader,
        @PathParam("contestJid") String contestJid,
        Set<String> usernames);