Java 类javax.ws.rs.core.UriInfo 实例源码

项目:gitplex-mit    文件:CommitStatusResource.java   
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{projectName}/statuses/{commit}")
   @POST
   public Response save(@PathParam("projectName") String projectName, @PathParam("commit") String commit, 
        Map<String, String> commitStatus, @Context UriInfo uriInfo) {

    Project project = getProject(projectName);
    if (!SecurityUtils.canWrite(project))
        throw new UnauthorizedException();

    String state = commitStatus.get("state").toUpperCase();
    if (state.equals("PENDING"))
        state = "RUNNING";
    Verification verification = new Verification(Verification.Status.valueOf(state), 
            new Date(), commitStatus.get("description"), commitStatus.get("target_url"));
    String context = commitStatus.get("context");
    if (context == null)
        context = "default";
    verificationManager.saveVerification(project, commit, context, verification);
    UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
    uriBuilder.path(context);
    commitStatus.put("id", "1");

    return Response.created(uriBuilder.build()).entity(commitStatus).type(RestConstants.JSON_UTF8).build();
   }
项目:mid-tier    文件:CustomerEventServiceExposure.java   
@GET
@Produces({"application/hal+json", "application/hal+json;concept=events;v=1"})
@ApiOperation(
        value = "obtain all events emitted by the customer-event service", response = EventsRepresentation.class,
        notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
                "subscribers to the customers service should be able to listen for and react to. In other words this is the authoritative" +
                "feed for the customers service",
        authorizations = {
                @Authorization(value = "oauth2", scopes = {}),
                @Authorization(value = "oauth2-cc", scopes = {}),
                @Authorization(value = "oauth2-ac", scopes = {}),
                @Authorization(value = "oauth2-rop", scopes = {}),
                @Authorization(value = "Bearer")
        },
        tags = {"interval", "events"},
        produces = "application/hal+json,  application/hal+json;concept=events;v=1",
        nickname = "listAllCustomerEvents"
    )
@ApiResponses(value = {
        @ApiResponse(code = 415, message = "Content type not supported.")
    })
public Response listAllCustomerEvents(@Context UriInfo uriInfo, @Context Request request,
                        @HeaderParam("Accept") String accept, @QueryParam("interval") String interval) {
    return eventsProducers.getOrDefault(accept, this::handleUnsupportedContentType)
            .getResponse(uriInfo, request, interval);
}
项目:personium-core    文件:UnitCtlResourceTest.java   
/**
 * Test beforeCreate().
 * normal.
 * Type is UnitMaster.
 * @throws Exception Unintended exception in test
 */
@Test
public void beforeCreate_Normal_type_unitmaster() throws Exception {
    // Test method args
    OEntityWrapper oEntityWrapper = PowerMockito.mock(OEntityWrapper.class);

    // Mock settings
    UriInfo uriInfo = mock(UriInfo.class);
    URI uri = new URI("");
    doReturn(uri).when(uriInfo).getBaseUri();
    AccessContext accessContext = PowerMockito.mock(AccessContext.class);
    unitCtlResource = spy(new UnitCtlResource(accessContext, uriInfo));

    doReturn(accessContext).when(unitCtlResource).getAccessContext();
    doReturn(AccessContext.TYPE_UNIT_MASTER).when(accessContext).getType();

    // Expected result
    // None.

    // Run method
    unitCtlResource.beforeCreate(oEntityWrapper);

    // Confirm result
    // None.
}
项目:personium-core    文件:MessageResource.java   
/**
 * メッセージ送信API.
 * @param version PCSバージョン
 * @param uriInfo UriInfo
 * @param reader リクエストボディ
 * @return レスポンス
 */
@WriteAPI
@POST
@Path("send")
public Response messages(
        @HeaderParam(PersoniumCoreUtils.HttpHeaders.X_PERSONIUM_VERSION) final String version,
        @Context final UriInfo uriInfo,
        final Reader reader) {
    // アクセス制御
    this.davRsCmp.checkAccessContext(this.accessContext, CellPrivilege.MESSAGE);

    // データ登録
    PersoniumODataProducer 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;
}
项目:ditb    文件:NamespacesInstanceResource.java   
/**
 * Build a response for POST create namespace with no properties specified.
 * @param message value not used.
 * @param headers value not used.
 * @return response code.
 */
@POST
public Response postNoBody(final byte[] message,
    final @Context UriInfo uriInfo, final @Context HttpHeaders headers) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("POST " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  try{
    NamespacesInstanceModel model = new NamespacesInstanceModel(namespace);
    return processUpdate(model, false, uriInfo);
  }catch(IOException ioe){
    servlet.getMetrics().incrementFailedPutRequests(1);
    throw new RuntimeException("Cannot retrieve info for '" + namespace + "'.");
  }
}
项目:mid-tier    文件:AccountServiceExposureTest.java   
@Test
public void testCreate() throws Exception {
    Request request = mock(Request.class);
    UriInfo ui = mock(UriInfo.class);
    when(ui.getBaseUriBuilder()).then(new UriBuilderFactory(URI.create("http://mock")));
    when(ui.getPath()).thenReturn("http://mock");

    AccountUpdateRepresentation accountUpdate = mock(AccountUpdateRepresentation.class);
    when(accountUpdate.getName()).thenReturn("new Account");
    when(accountUpdate.getRegNo()).thenReturn("5479");
    when(accountUpdate.getAccountNo()).thenReturn("12345678");
    when(accountUpdate.getCustomer()).thenReturn("cust-1");

    when(archivist.findAccount("5479", "12345678")).thenReturn(Optional.empty());

    AccountRepresentation resp = (AccountRepresentation) service.createOrUpdate(ui, request, "5479", "12345678", accountUpdate).getEntity();

    assertEquals("new Account", resp.getName());
    assertEquals("5479", resp.getRegNo());
    assertEquals("12345678", resp.getAccountNo());
    assertEquals("http://mock/accounts/5479-12345678", resp.getSelf().getHref());
}
项目:https-github.com-apache-zookeeper    文件:ZNodeResource.java   
@DELETE
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML, MediaType.APPLICATION_OCTET_STREAM })
public void deleteZNode(@PathParam("path") String path,
        @DefaultValue("-1") @QueryParam("version") String versionParam,
        @Context UriInfo ui) throws InterruptedException, KeeperException {
    ensurePathNotNull(path);

    int version;
    try {
        version = Integer.parseInt(versionParam);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.status(
                Response.Status.BAD_REQUEST).entity(
                new ZError(ui.getRequestUri().toString(), path
                        + " bad version " + versionParam)).build());
    }

    zk.delete(path, version);
}
项目:fuck_zookeeper    文件:ZNodeResource.java   
@DELETE
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
        MediaType.APPLICATION_XML, MediaType.APPLICATION_OCTET_STREAM })
public void deleteZNode(@PathParam("path") String path,
        @DefaultValue("-1") @QueryParam("version") String versionParam,
        @Context UriInfo ui) throws InterruptedException, KeeperException {
    ensurePathNotNull(path);

    int version;
    try {
        version = Integer.parseInt(versionParam);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.status(
                Response.Status.BAD_REQUEST).entity(
                new ZError(ui.getRequestUri().toString(), path
                        + " bad version " + versionParam)).build());
    }

    zk.delete(path, version);
}
项目:bootstrap    文件:PaginationJsonTest.java   
/**
 * Simple page request with default values but sorted column.
 */
@Test
public void getUiPageRequestSimpleSort() {
    // create a mock URI info with pagination informations
    final UriInfo uriInfo = newUriInfo();
    uriInfo.getQueryParameters().add("sidx", "colX");
    final UiPageRequest pageRequest = paginationJson.getUiPageRequest(uriInfo);
    Assert.assertNotNull(pageRequest);
    Assert.assertEquals(1, pageRequest.getPage());
    Assert.assertEquals(10, pageRequest.getPageSize());
    Assert.assertNotNull(pageRequest.getUiFilter());
    Assert.assertNull(pageRequest.getUiFilter().getGroupOp());
    Assert.assertNull(pageRequest.getUiFilter().getRules());
    Assert.assertNotNull(pageRequest.getUiSort());
    Assert.assertEquals("colX", pageRequest.getUiSort().getColumn());
    Assert.assertEquals(Direction.ASC, pageRequest.getUiSort().getDirection());
}
项目:syndesis    文件:Lister.java   
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiImplicitParams({
    @ApiImplicitParam(
        name = "sort", value = "Sort the result list according to the given field value",
        paramType = "query", dataType = "string"),
    @ApiImplicitParam(
        name = "direction", value = "Sorting direction when a 'sort' field is provided. Can be 'asc' " +
        "(ascending) or 'desc' (descending)", paramType = "query", dataType = "string"),
    @ApiImplicitParam(
        name = "page", value = "Page number to return", paramType = "query", dataType = "integer", defaultValue = "1"),
    @ApiImplicitParam(
        name = "per_page", value = "Number of records per page", paramType = "query", dataType = "integer", defaultValue = "20"),
    @ApiImplicitParam(
        name = "query", value = "The search query to filter results on", paramType = "query", dataType = "string"),

})
default ListResult<T> list(@Context UriInfo uriInfo) {
    Class<T> clazz = resourceKind().getModelClass();
    return getDataManager().fetchAll(
        clazz,
        new ReflectiveFilterer<>(clazz, new FilterOptionsFromQueryParams(uriInfo).getFilters()),
        new ReflectiveSorter<>(clazz, new SortOptionsFromQueryParams(uriInfo)),
        new PaginationFilter<>(new PaginationOptionsFromQueryParams(uriInfo))
    );
}
项目:app-ms    文件:ErrorResponseTest.java   
@Test
public void thrownErrorWithMDC() {

    MDC.put(MDCKeys.REQUEST_ID, "abc");
    MDC.put(MDCKeys.HOST, "localhost");
    MDC.put(MDCKeys.REQUEST_URI, "http://hello");
    MDC.put(MDCKeys.JWT_ID, "def");
    final ErrorResponse response = new ErrorResponse(new IOException("ahem"), mock(UriInfo.class), true);
    assertNotNull(response.getStackTrace());
    assertNull(response.getCause());
    assertEquals(URI.create("http://hello"), response.getRequestUri());
    assertEquals("abc", response.getRequestId());
    assertEquals("def", response.getJwtId());
    assertEquals("localhost", response.getHost());

}
项目:bootstrap    文件:PaginationJsonTest.java   
/**
 * Sorted direction with ordering but no mapping provided.
 */
@Test
public void getPageRequestNoMappingOrder() {
    // create a mock URI info with pagination informations
    final UriInfo uriInfo = newUriInfo();
    uriInfo.getQueryParameters().add(DataTableAttributes.PAGE_LENGTH, "100");
    uriInfo.getQueryParameters().add(DataTableAttributes.SORTED_COLUMN, "2");
    uriInfo.getQueryParameters().add("columns[2][data]", "col1");
    uriInfo.getQueryParameters().add(DataTableAttributes.SORT_DIRECTION, "asc");
    final PageRequest pageRequest = paginationJson.getPageRequest(uriInfo, null);
    Assert.assertNotNull(pageRequest);
    Assert.assertFalse(pageRequest.getSort().isSorted());
    Assert.assertEquals(0, pageRequest.getOffset());
    Assert.assertEquals(0, pageRequest.getPageNumber());
    Assert.assertEquals(100, pageRequest.getPageSize());
}
项目:Equella    文件:EquellaItemResource.java   
@GET
@Path("/{uuid}/{version}/comment/{commentuuid}")
@ApiOperation(value = "Retrieve a single comment for an item by ID.")
CommentBean getOneComment(
    @Context 
        UriInfo info,
    @ApiParam(APIDOC_ITEMUUID) 
    @PathParam("uuid") 
        String uuid,
    @ApiParam(APIDOC_ITEMVERSION) 
    @PathParam("version") 
        int version,
    @ApiParam(required = true) 
    @PathParam("commentuuid") 
        String commentUuid
    );
项目:mid-tier    文件:AccountServiceExposureTest.java   
@Test
public void testUpdate() throws Exception {
    Request request = mock(Request.class);
    UriInfo ui = mock(UriInfo.class);
    when(ui.getBaseUriBuilder()).then(new UriBuilderFactory(URI.create("http://mock")));
    when(ui.getPath()).thenReturn("http://mock");

    Account existingAcc = new Account("5479", "12345678", "Savings account", "cust-1");
    when(archivist.findAccount("5479", "12345678")).thenReturn(Optional.of(existingAcc));

    AccountUpdateRepresentation accountUpdate = mock(AccountUpdateRepresentation.class);
    when(accountUpdate.getName()).thenReturn("new name");
    when(accountUpdate.getRegNo()).thenReturn("5479");
    when(accountUpdate.getAccountNo()).thenReturn("12345678");

    AccountRepresentation resp = (AccountRepresentation) service.createOrUpdate(ui, request, "5479", "12345678", accountUpdate).getEntity();

    //name of the existing account should be updated
    assertEquals("new name", existingAcc.getName());
    assertEquals("new name", resp.getName());
    assertEquals("5479", resp.getRegNo());
    assertEquals("12345678", resp.getAccountNo());
    assertEquals("0", existingAcc.getBalance().toString());
    assertEquals("0", resp.getBalance().toString());
    assertEquals("http://mock/accounts/5479-12345678", resp.getSelf().getHref());
}
项目:SpanEE    文件:SpanEEContainerRequestFilter.java   
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
    System.out.println("Response = " + requestContext + " " + responseContext);
    Long start = concurrentRequests.get(requestContext);
    concurrentRequests.remove(requestContext);
    long duration = (System.nanoTime() - start);
    System.out.println("Duration: " + duration);
    UriInfo uriInfo = requestContext.getUriInfo();

    String ipv4 = extractIpAddress(uriInfo);
    System.out.println("ipv4 = " + ipv4);
    String serviceName = extractServiceName(uriInfo);
    System.out.println("serviceName = " + serviceName);
    String spanName = extractSpanName(uriInfo);
    System.out.println("spanName = " + spanName);
    Optional<String> traceId = extractTraceId(requestContext);
    String spanId = traceId.map(id -> this.tracee.saveChildSpan(id, spanName, serviceName, ipv4, 0)).
            orElseGet(() -> this.tracee.saveParentSpan(spanName, serviceName, ipv4, duration));
    System.out.println("Storing span id: " + spanId);
    storeSpandId(responseContext, spanId);
}
项目:mid-tier    文件:CustomerEventFeedMetadataServiceExposure.java   
@GET
@Produces({"application/hal+json", "application/hal+json;concept=metadata;v=1"})
@ApiOperation(
        value = "metadata for the events endpoint", response = EventsMetadataRepresentation.class,
        authorizations = {
                @Authorization(value = "oauth2", scopes = {}),
                @Authorization(value = "oauth2-cc", scopes = {}),
                @Authorization(value = "oauth2-ac", scopes = {}),
                @Authorization(value = "oauth2-rop", scopes = {}),
                @Authorization(value = "Bearer")
        },
        notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
                "subscribers to the customer service should be able to listen for and react to. In other words this is the authoritative" +
                "feed for the customer service",
        tags = {"events"},
        produces = "application/hal+json,  application/hal+json;concept=metadata;v=1",
        nickname = "getCustomerMetadata"
    )
@ApiResponses(value = {
        @ApiResponse(code = 415, message = "Content type not supported.")
    })
public Response getCustomerServiceMetadata(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
    return eventMetadataProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
项目:mid-tier    文件:VirtualAccountServiceExposure.java   
@LogDuration(limit = 50)
Response getServiceGeneration1Version1(UriInfo uriInfo, Request request, String accountNo) {
    Long no;
    try {
        no = Long.parseLong(accountNo);
    } catch (NumberFormatException e) {
        throw new WebApplicationException(Response.Status.BAD_REQUEST);
    }
    VirtualAccount virtualaccount = archivist.getAccount(no);
    LOGGER.info("Usage - application/hal+json;concept=virtualaccount;v=1");
    return new EntityResponseBuilder<>(virtualaccount, ac -> new VirtualAccountRepresentation(ac, uriInfo))
            .name("virtualaccount")
            .version("1")
            .maxAge(120)
            .build(request);
}
项目:oscm    文件:RestResource.java   
/**
 * Wrapper for backend PUT commands. Prepares, validates and revises data
 * for commands and assembles responses. Also overrides the id of the
 * representation with the id of the parameters.
 *
 * @param uriInfo
 *            the request context
 * @param backend
 *            the backend command
 * @param content
 *            the representation to update
 * @param params
 *            the request parameters
 * @return the response without content
 */
protected <R extends Representation, P extends RequestParameters> Response put(
        UriInfo uriInfo, RestBackend.Put<R, P> backend, R content, P params)
        throws Exception {

    int version = getVersion(uriInfo);

    prepareData(version, params, true, content, true);

    if (content != null) {
        content.setId(params.getId());
        content.setETag(params.getETag());
    }

    backend.put(content, params);

    return Response.noContent().build();
}
项目:Equella    文件:CollectionResource.java   
@PUT
@Path("/{uuid}")
@ApiOperation("Edit a collection")
@ApiResponses({@ApiResponse(code = 200, message = "Location: {collection uri}")})
public Response edit(@Context UriInfo uriInfo, @ApiParam(value = "Collection UUID") @PathParam("uuid") String uuid,
    @ApiParam CollectionBean bean,
    @ApiParam(required = false, value = "Staging area UUID") @QueryParam("file") String stagingUuid,
    @ApiParam(required = false, value = "The lock UUID if locked") @QueryParam("lock") String lockId,
    @ApiParam(value = "Unlock collection after edit") @QueryParam("keeplocked") boolean keepLocked);
项目:app-ms    文件:ExceptionMapperTest.java   
@Test
public void testCheckedHtml() {

    final HttpHeaders headers = Mockito.mock(HttpHeaders.class);
    Mockito.when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.TEXT_HTML_TYPE));
    mapper.setContextData(headers, Mockito.mock(UriInfo.class), true);

    final Response response = mapper.toResponse(new IOException("ahem"));
    Assert.assertEquals(500, response.getStatus());
    Assert.assertEquals(MediaType.TEXT_HTML_TYPE, response.getMediaType());
    Assert.assertEquals("ahem", response.getEntity());
}
项目:ditb    文件:ScannerResource.java   
@PUT
@Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response put(final ScannerModel model, 
    final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("PUT " + uriInfo.getAbsolutePath());
  }
  return update(model, true, uriInfo);
}
项目:Equella    文件:ItemResourceImpl.java   
@Override
public Response postComments(UriInfo uriInfo, String uuid, int version, CommentBean commentBean)
{
    UserBean postedBy = commentBean.getPostedBy();
    itemCommentService.addComment(new ItemId(uuid, version), commentBean.getComment(), commentBean.getRating(),
        commentBean.isAnonymous(),
        postedBy != null && RestImportExportHelper.isImport(uriInfo) ? postedBy.getId() : "");

    return Response.status(Status.CREATED).build();
}
项目:Equella    文件:ItemResourceImpl.java   
@Override
public ItemBean getLatest(UriInfo uriInfo, String uuid, CsvList info)
{
    List<String> infos = CsvList.asList(info, ItemSerializerService.CATEGORY_ALL);
    ItemSerializerItemBean serializer = itemSerializerService.createItemBeanSerializer(
        new LatestVersionWhereClause(uuid, false), infos, RestImportExportHelper.isExport(uriInfo), VIEW_ITEM,
        DISCOVER_ITEM);
    return singleItem(uuid, 0, serializer, uriInfo);
}
项目:ctsms    文件:SearchResource.java   
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("user/{id}/search")
public Page<NoShortcutSerializationWrapper<UserOutVO>> searchUserByCriteria(@PathParam("id") Long id, @Context UriInfo uriInfo)
        throws AuthenticationException, AuthorisationException, ServiceException {
    PSFUriPart psf = new PSFUriPart(uriInfo);
    Collection result = WebUtil.getServiceLocator().getSearchService().searchUserByCriteria(auth, id, ResourceUtils.LIST_GRAPH_MAX_USER_INSTANCES, psf);
    NoShortcutSerializationWrapper.transformVoCollection(result);
    return new Page<NoShortcutSerializationWrapper<UserOutVO>>(result, psf);
}
项目:ctsms    文件:ProbandResource.java   
@GET
@Path("{id}/files/pdf")
public Response aggregatePDFFiles(@PathParam("id") Long id, @Context UriInfo uriInfo) throws AuthenticationException, AuthorisationException, ServiceException {
    FilePDFVO vo = WebUtil.getServiceLocator().getFileService().aggregatePDFFiles(auth, fileModule, id, null, null, new PSFUriPart(uriInfo));
    // http://stackoverflow.com/questions/9204287/how-to-return-a-png-image-from-jersey-rest-service-method-to-the-browser
    // non-streamed
    ResponseBuilder response = Response.ok(vo.getDocumentDatas(), vo.getContentType().getMimeType());
    response.header(HttpHeaders.CONTENT_LENGTH, vo.getSize());
    return response.build();
}
项目:app-ms    文件:ExceptionMapperTest.java   
@Before
public void setupMapper() {

    mapper = new JsonExceptionMapper();
    mapper.setDebugFlags();
    final HttpHeaders headers = Mockito.mock(HttpHeaders.class);
    Mockito.when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.WILDCARD_TYPE));
    mapper.setContextData(headers, Mockito.mock(UriInfo.class), true);
}
项目:plugin-id-ldap    文件:DelegateLdapResourceTest.java   
@Test
public void findAllReceiverGroup() {
    // create a mock URI info with pagination informations
    final UriInfo uriInfo = newFindAllParameters();
    initSpringSecurityContext("alongchu");
    final TableItem<DelegateOrgLightVo> result = resource.findAll(uriInfo, null);
    Assert.assertEquals(1, result.getData().size());
    Assert.assertEquals(1, result.getRecordsTotal());

    final DelegateOrgLightVo entity = result.getData().get(0);
    Assert.assertEquals("ing", entity.getName());
    Assert.assertEquals(DelegateType.COMPANY, entity.getType());
    Assert.assertEquals("gfi-gstack", entity.getReceiver().getId());
    Assert.assertEquals(ReceiverType.GROUP, entity.getReceiverType());
}
项目:mid-tier    文件:CustomerServiceExposure.java   
@LogDuration(limit = 50)
Response getServiceGeneration1Version1(UriInfo uriInfo, Request request, String customerNo) {
    Customer customer = archivist.getCustomer(customerNo);
    LOGGER.info("Usage - application/hal+json;concept=customer;v=1");
    return new EntityResponseBuilder<>(customer, cust -> new CustomerRepresentation(cust, uriInfo))
            .name("customer")
            .version("1")
            .maxAge(120)
            .build(request);
}
项目:ctsms    文件:FileDavResourceBase.java   
protected javax.ws.rs.core.Response davPropPatch(InputStream body, UriInfo uriInfo, Providers providers, HttpHeaders httpHeaders) throws IOException {
    final PropertyUpdate propertyUpdate = providers.getMessageBodyReader(PropertyUpdate.class, PropertyUpdate.class, new Annotation[0],
            APPLICATION_XML_TYPE).readFrom(PropertyUpdate.class, PropertyUpdate.class, new Annotation[0], APPLICATION_XML_TYPE,
                    httpHeaders.getRequestHeaders(), body);
    // System.out.println("PATCH PROPERTIES: " + propertyUpdate.list());
    /* TODO Patch properties in database. */
    final Collection<PropStat> propstats = new LinkedList<PropStat>();
    for (final RemoveOrSet removeOrSet : propertyUpdate.list()) {
        propstats.add(new PropStat(removeOrSet.getProp(), new Status((StatusType) FORBIDDEN)));
    }
    return javax.ws.rs.core.Response.status(MULTI_STATUS)
            .entity(new MultiStatus(new Response(new HRef(uriInfo.getRequestUri()), null, null, null, propstats))).build();
}
项目:plugin-id-ldap    文件:DelegateLdapResourceTest.java   
@Test
public void findAllGlobalSearchCompany() {
    // create a mock URI info with pagination informations
    final UriInfo uriInfo = newFindAllParameters();
    uriInfo.getQueryParameters().add(DataTableAttributes.SEARCH, "dig");

    final TableItem<DelegateOrgLightVo> result = resource.findAll(uriInfo, DelegateType.COMPANY);
    Assert.assertEquals(0, result.getData().size());
}
项目:Equella    文件:ItemResourceImpl.java   
/**
 * NB: import|export=true is also an option in the query parameters.
 */
@Override
public EquellaItemBean getItem(UriInfo uriInfo, String uuid, int version, CsvList info)
{
    List<String> infos = CsvList.asList(info, ItemSerializerService.CATEGORY_ALL);
    ItemId itemId = new ItemId(uuid, version);
    ItemSerializerItemBean serializer = itemSerializerService.createItemBeanSerializer(
        new SingleItemWhereClause(itemId), infos, RestImportExportHelper.isExport(uriInfo), VIEW_ITEM,
        DISCOVER_ITEM);
    return singleItem(uuid, version, serializer, uriInfo);
}
项目:launcher-backend    文件:LaunchResource.java   
@GET
@javax.ws.rs.Path("/commands/{commandName}/query")
@Consumes(MediaType.MEDIA_TYPE_WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
public Response executeQuery(@Context UriInfo uriInfo,
                             @PathParam("commandName") String commandName,
                             @Context HttpHeaders headers)
        throws Exception {
    validateCommand(commandName);
    String stepIndex = null;
    MultivaluedMap<String, String> parameters = uriInfo.getQueryParameters();
    List<String> stepValues = parameters.get("stepIndex");
    if (stepValues != null && !stepValues.isEmpty()) {
        stepIndex = stepValues.get(0);
    }
    if (stepIndex == null) {
        stepIndex = "0";
    }
    final JsonBuilder jsonBuilder = new JsonBuilder().createJson(Integer.valueOf(stepIndex));
    for (Map.Entry<String, List<String>> entry : parameters.entrySet()) {
        String key = entry.getKey();
        if (!"stepIndex".equals(key)) {
            jsonBuilder.addInput(key, entry.getValue());
        }
    }

    final Response response = executeCommandJson(jsonBuilder.build(), commandName, headers);
    if (response.getEntity() instanceof JsonObject) {
        JsonObject responseEntity = (JsonObject) response.getEntity();
        String error = ((JsonObject) responseEntity.getJsonArray("messages").get(0)).getString("description");
        return Response.status(Status.PRECONDITION_FAILED).entity(unwrapJsonObjects(error)).build();
    }
    return response;
}
项目:launcher-backend    文件:OpenShiftResource.java   
@POST
@javax.ws.rs.Path("/services/jenkins/{namespace}/{path: .*}")
public Response jenkinsPost(
        @PathParam("namespace") String namespace,
        @PathParam("path") String path,
        @Context HttpHeaders headers,
        @Context UriInfo uriInfo,
        String body)
        throws Exception {
    String serviceName = "jenkins";
    return proxyRequest(namespace, path, headers, uriInfo, serviceName, "POST", body);
}
项目:Equella    文件:CourseResource.java   
@PUT
@Path("/{uuid}")
@ApiOperation("Edit a course")
public Response edit(@Context UriInfo uriInfo, @ApiParam @PathParam("uuid") String uuid, @ApiParam CourseBean bean,
    @ApiParam(required = false) @QueryParam("file") String stagingUuid,
    @ApiParam(required = false) @QueryParam("lock") String lockId,
    @ApiParam(required = false) @QueryParam("keeplocked") boolean keepLocked);
项目:ditb    文件:SchemaResource.java   
@PUT
@Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
  MIMETYPE_PROTOBUF_IETF})
public Response put(final TableSchemaModel model, 
    final @Context UriInfo uriInfo) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("PUT " + uriInfo.getAbsolutePath());
  }
  servlet.getMetrics().incrementRequests(1);
  return update(model, true, uriInfo);
}
项目:beadledom    文件:HealthChecker.java   
@Inject
HealthChecker(
    UriInfo uriInfo,
    ServiceMetadata serviceMetadata,
    Map<String, HealthDependency> healthDependencies) {
  this.uriInfo = uriInfo;
  this.serviceMetadata = serviceMetadata;
  this.healthDependencies = ImmutableSortedMap.copyOf(healthDependencies);
}
项目:redirector    文件:DeciderRulesController.java   
@GET
@Path("export/{ruleId}/")
@Produces({MediaType.APPLICATION_JSON})
public Response exportRule(@PathParam("ruleId") final String ruleId, @Context UriInfo ui) {
    return Response.ok(deciderRulesService.getRule(ruleId))
            .header(exportFileNameHelper.getHeader(), exportFileNameHelper.getFileNameForOneEntityWithoutService(EntityType.DECIDER_RULE, ruleId))
            .build();
}
项目:ctsms    文件:StaffResource.java   
@GET
@Produces({ MediaType.APPLICATION_JSON })
public Page<StaffOutVO> getStaffList(@Context UriInfo uriInfo)
        throws AuthenticationException, AuthorisationException, ServiceException {
    PSFUriPart psf;
    return new Page<StaffOutVO>(WebUtil.getServiceLocator().getStaffService()
            .getStaffList(auth, null, null, ResourceUtils.LIST_GRAPH_MAX_STAFF_INSTANCES, psf = new PSFUriPart(uriInfo)), psf);
}
项目:app-ms    文件:JwtSecurityContext.java   
public JwtSecurityContext(final JwtClaims claims,
    final UriInfo uriInfo) {

    try {
        principal = new JwtClaimsSetPrincipal(claims);
        secure = "https".equals(uriInfo.getRequestUri().getScheme());

        roles = Collections.unmodifiableSet(claims.getStringListClaimValue(Qualifiers.ROLES).parallelStream().collect(Collectors.toSet()));
    } catch (final MalformedClaimException e) {
        throw new ExceptionInInitializerError(e);
    }
}
项目:ctsms    文件:ProbandResource.java   
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("{id}/files/pdf/head")
public FilePDFVO aggregatePDFFilesHead(@PathParam("id") Long id, @Context UriInfo uriInfo)
        throws AuthenticationException, AuthorisationException, ServiceException {
    FilePDFVO result = WebUtil.getServiceLocator().getFileService().aggregatePDFFiles(auth, fileModule, id, null, null, new PSFUriPart(uriInfo));
    result.setDocumentDatas(null);
    return result;
}