javax.ws.rs.core.UriInfo Java Examples

The following examples show how to use javax.ws.rs.core.UriInfo. 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: ApplicationResource.java    From usergrid with Apache License 2.0 6 votes vote down vote up
@RequireOrganizationAccess
@GET
@JSONP
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public ApiResponse getApplication(
        @Context UriInfo ui, @QueryParam("callback") @DefaultValue("callback") String callback )
    throws Exception {

    ApiResponse response = createApiResponse();
    ServiceManager sm = smf.getServiceManager( applicationId );
    response.setAction( "get" );
    response.setApplication( sm.getApplication() );
    response.setParams( ui.getQueryParameters() );
    response.setResults( management.getApplicationMetadata( applicationId ) );
    return response;
}
 
Example #2
Source File: UserOperationLogRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public List<UserOperationLogEntryDto> queryUserOperationEntries(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  UserOperationLogQueryDto queryDto = new UserOperationLogQueryDto(objectMapper, uriInfo.getQueryParameters());
  UserOperationLogQuery query = queryDto.toQuery(processEngine);

  if (firstResult == null && maxResults == null) {
    return UserOperationLogEntryDto.map(query.list());
  } else {
    if (firstResult == null) {
      firstResult = 0;
    }
    if (maxResults == null) {
      maxResults = Integer.MAX_VALUE;
    }
    return UserOperationLogEntryDto.map(query.listPage(firstResult, maxResults));
  }
}
 
Example #3
Source File: AbstractODataResource.java    From io with Apache License 2.0 6 votes vote down vote up
/**
 * レスポンスボディを作成する.
 * @param uriInfo UriInfo
 * @param resp レスポンス
 * @param format レスポンスボディのフォーマット
 * @param acceptableMediaTypes 許可するMediaTypeのリスト
 * @return レスポンスボディ
 */
protected String renderEntityResponse(
        final UriInfo uriInfo,
        final EntityResponse resp,
        final String format,
        final List<MediaType> acceptableMediaTypes) {
    StringWriter w = new StringWriter();
    try {
        FormatWriter<EntityResponse> fw = DcFormatWriterFactory.getFormatWriter(EntityResponse.class,
                acceptableMediaTypes, format, null);
        // UriInfo uriInfo2 = DcCoreUtils.createUriInfo(uriInfo, 1);
        fw.write(uriInfo, w, resp);
    } catch (UnsupportedOperationException e) {
        throw DcCoreException.OData.FORMAT_INVALID_ERROR.params(format);
    }

    String responseStr = w.toString();

    return responseStr;

}
 
Example #4
Source File: SchemaRegistryResource.java    From registry with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/search/schemas")
@ApiOperation(value = "Search for schemas containing the given name and description",
        notes = "Search the schemas for given name and description, return a list of schemas that contain the field.",
        response = SchemaMetadataInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SCHEMA)
@Timed
@UnitOfWork
public Response findSchemas(@Context UriInfo uriInfo,
                            @Context SecurityContext securityContext) {
    MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
    try {
        Collection<SchemaMetadataInfo> schemaMetadataInfos = authorizationAgent
                .authorizeFindSchemas(AuthorizationUtils.getUserAndGroups(securityContext), findSchemaMetadataInfos(queryParameters));
        return WSUtils.respondEntities(schemaMetadataInfos, Response.Status.OK);
    } catch (Exception ex) {
        LOG.error("Encountered error while finding schemas for given fields [{}]", queryParameters, ex);
        return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage());
    }
}
 
Example #5
Source File: DigitalObjectResource.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public DigitalObjectResource(
        @Context Request request,
        @Context SecurityContext securityCtx,
        @Context HttpHeaders httpHeaders,
        @Context UriInfo uriInfo,
        @Context HttpServletRequest httpRequest
        ) throws AppConfigurationException {
    
    this.httpRequest = request;
    this.httpHeaders = httpHeaders;
    this.appConfig = AppConfigurationFactory.getInstance().defaultInstance();
    this.importManager = ImportBatchManager.getInstance(appConfig);
    session = SessionContext.from(httpRequest);
    user = session.getUser();
    LOG.fine(user.toString());
}
 
Example #6
Source File: ODataLinksResource.java    From io with Apache License 2.0 6 votes vote down vote up
QueryInfo queryInfo(UriInfo uriInfo) {
    MultivaluedMap<String, String> mm = uriInfo.getQueryParameters(true);
    Integer top = QueryParser.parseTopQuery(mm.getFirst("$top"));
    Integer skip = QueryParser.parseSkipQuery(mm.getFirst("$skip"));

    return new QueryInfo(
            null,
            top,
            skip,
            null,
            null,
            null,
            null,
            null,
            null);
}
 
Example #7
Source File: TrellisHttpResource.java    From trellis with Apache License 2.0 6 votes vote down vote up
/**
 * Perform a POST operation on a LDP Resource.
 *
 * @param uriInfo the URI info
 * @param secContext the security context
 * @param headers the HTTP headers
 * @param request the request
 * @param body the body
 * @return the async response
 */
@POST
@Timed
@Operation(summary = "Create a linked data resource")
public CompletionStage<Response> createResource(@Context final Request request, @Context final UriInfo uriInfo,
        @Context final HttpHeaders headers, @Context final SecurityContext secContext,
        @RequestBody(description = "The new resource") final InputStream body) {
    final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, secContext);
    final String urlBase = getBaseUrl(req);
    final String path = req.getPath();
    final String identifier = getIdentifier(req);
    final String separator = path.isEmpty() ? "" : "/";

    final IRI parent = buildTrellisIdentifier(path);
    final IRI child = buildTrellisIdentifier(path + separator + identifier);
    final PostHandler postHandler = new PostHandler(req, parent, identifier, body, trellis, extensions, urlBase);

    return trellis.getResourceService().get(parent)
        .thenCombine(trellis.getResourceService().get(child), postHandler::initialize)
        .thenCompose(postHandler::createResource).thenCompose(postHandler::updateMemento)
        .thenApply(ResponseBuilder::build).exceptionally(this::handleException);
}
 
Example #8
Source File: ProfiloController.java    From govpay with GNU General Public License v3.0 6 votes vote down vote up
public Response profiloGET(Authentication user, UriInfo uriInfo, HttpHeaders httpHeaders) {
  	String methodName = "profiloGET";  
String transactionId = ContextThreadLocal.get().getTransactionId();
this.log.debug(MessageFormat.format(BaseController.LOG_MSG_ESECUZIONE_METODO_IN_CORSO, methodName)); 
try{
	UtentiDAO utentiDAO = new UtentiDAO();
	
	LeggiProfiloDTOResponse leggiProfilo = utentiDAO.getProfilo(user);

	Profilo profilo = ProfiloConverter.getProfilo(leggiProfilo);

	this.log.debug(MessageFormat.format(BaseController.LOG_MSG_ESECUZIONE_METODO_COMPLETATA, methodName)); 
	return this.handleResponseOk(Response.status(Status.OK).entity(profilo.toJSON(null)),transactionId).build();
	
}catch (Exception e) {
	return this.handleException(uriInfo, httpHeaders, methodName, e, transactionId);
} finally {
	this.log(ContextThreadLocal.get());
}
  }
 
Example #9
Source File: AbstractOAuth2IdentityProvider.java    From keycloak with Apache License 2.0 6 votes vote down vote up
protected Response exchangeSessionToken(UriInfo uriInfo, EventBuilder event, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) {
    String accessToken = tokenUserSession.getNote(FEDERATED_ACCESS_TOKEN);
    if (accessToken == null) {
        event.detail(Details.REASON, "requested_issuer is not linked");
        event.error(Errors.INVALID_TOKEN);
        return exchangeTokenExpired(uriInfo, authorizedClient, tokenUserSession, tokenSubject);
    }
    AccessTokenResponse tokenResponse = new AccessTokenResponse();
    tokenResponse.setToken(accessToken);
    tokenResponse.setIdToken(null);
    tokenResponse.setRefreshToken(null);
    tokenResponse.setRefreshExpiresIn(0);
    tokenResponse.getOtherClaims().clear();
    tokenResponse.getOtherClaims().put(OAuth2Constants.ISSUED_TOKEN_TYPE, OAuth2Constants.ACCESS_TOKEN_TYPE);
    tokenResponse.getOtherClaims().put(ACCOUNT_LINK_URL, getLinkingUrl(uriInfo, authorizedClient, tokenUserSession));
    event.success();
    return Response.ok(tokenResponse).type(MediaType.APPLICATION_JSON_TYPE).build();
}
 
Example #10
Source File: CrnkFilterTest.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
@Test
public void checkWebPathPrefixWrongNoFilter() throws IOException {
	CrnkFeature feature = Mockito.mock(CrnkFeature.class);
	Mockito.when(feature.getWebPathPrefix()).thenReturn("api");
	Mockito.when(feature.getBoot()).thenThrow(new WebApplicationException("test"));

	CrnkFilter filter = new CrnkFilter(feature);
	UriInfo uriInfo = Mockito.mock(UriInfo.class);
	Mockito.when(uriInfo.getPath()).thenReturn("/api2/tasks");
	Mockito.when(uriInfo.getQueryParameters()).thenReturn(Mockito.mock(MultivaluedMap.class));

	ContainerRequestContext requestContext = Mockito.mock(ContainerRequestContext.class);
	Mockito.when(requestContext.getUriInfo()).thenReturn(uriInfo);
	try {
		filter.filter(requestContext);
	} catch (WebApplicationException e) {
		Assert.fail();
	}
}
 
Example #11
Source File: StaffResource.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("{id}/links")
public Page<HyperlinkOutVO> getHyperlinks(@PathParam("id") Long id, @Context UriInfo uriInfo)
		throws AuthenticationException, AuthorisationException, ServiceException {
	PSFUriPart psf;
	return new Page<HyperlinkOutVO>(WebUtil.getServiceLocator().getHyperlinkService().getHyperlinks(auth, hyperlinkModule, id, null, psf = new PSFUriPart(uriInfo)), psf);
}
 
Example #12
Source File: HyperlinkResource.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("staff")
public Page<HyperlinkOutVO> getStaffLinks(@Context UriInfo uriInfo)
		throws AuthenticationException, AuthorisationException, ServiceException {
	PSFUriPart psf;
	return new Page<HyperlinkOutVO>(WebUtil.getServiceLocator().getHyperlinkService()
			.getHyperlinks(auth, HyperlinkModule.STAFF_HYPERLINK, null, null, psf = new PSFUriPart(uriInfo)), psf);
}
 
Example #13
Source File: ApplicationResource.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@POST
@Path("sia-provider")
@Consumes(APPLICATION_JSON)
@RequireOrganizationAccess
@JSONP
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public ApiResponse configureProvider(
        @Context UriInfo ui,
        @QueryParam("provider_key") String siaProvider,
        Map<String, Object> json,
        @QueryParam("callback")
        @DefaultValue("") String callback )
    throws Exception {

    ApiResponse response = createApiResponse();
    response.setAction( "post signin provider configuration" );

    Preconditions.checkArgument( siaProvider != null, "Sign in provider required" );

    SignInAsProvider signInAsProvider = null;
    if ( StringUtils.equalsIgnoreCase( siaProvider, "facebook" ) ) {
        signInAsProvider = signInProviderFactory.facebook(
                smf.getServiceManager( applicationId ).getApplication() );
    }
    else if ( StringUtils.equalsIgnoreCase( siaProvider, "pingident" ) ) {
        signInAsProvider = signInProviderFactory.pingident(
                smf.getServiceManager( applicationId ).getApplication() );
    }
    else if ( StringUtils.equalsIgnoreCase( siaProvider, "foursquare" ) ) {
        signInAsProvider = signInProviderFactory.foursquare(
                smf.getServiceManager( applicationId ).getApplication() );
    }

    Preconditions.checkArgument( signInAsProvider != null,
            "No signin provider found by that name: " + siaProvider );

    signInAsProvider.saveToConfiguration( json );

    return response;
}
 
Example #14
Source File: FileErrorsResource.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@GET
@Path( RootResource.ENTITY_ID_PATH )
@JSONP
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public ApiResponse getFileIncludeById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
    throws Exception {

    final UUID failedEntity = UUID.fromString( entityId.getPath() );
    final FailedImportEntity
        importEntity = importService.getFailedImportEntity( application.getId(), importId, importFileId,
        failedEntity );

    if(importEntity == null){
        throw new EntityNotFoundException( "could not find import with uuid " + importId );
    }

    ApiResponse response = createApiResponse();


    response.setAction( "get" );
    response.setApplication( emf.getEntityManager( application.getId() ).getApplication()  );
    response.setParams( ui.getQueryParameters() );


    response.setEntities( Collections.<Entity>singletonList( importEntity ) );

    return response;

}
 
Example #15
Source File: MachineResource.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@GET
@ApiOperation("Get all machines")
@Path("/machines")
public MachineQueryResult getMachines(@Context UriInfo info) {
    MultivaluedMap<String, String> queryParameters = info.getQueryParameters(true);

    QueryRequest.Builder queryBuilder = QueryRequest.newBuilder();
    Page page = RestUtil.createPage(queryParameters);

    queryBuilder.setPage(page);
    queryBuilder.putAllFilteringCriteria(RestUtil.getFilteringCriteria(queryParameters));
    queryBuilder.addAllFields(RestUtil.getFieldsParameter(queryParameters));

    return machineServiceStub.getMachines(queryBuilder.build()).block(TIMEOUT);
}
 
Example #16
Source File: RestService.java    From dexter with Apache License 2.0 5 votes vote down vote up
private DexterLocalParams getLocalParams(UriInfo ui) {
	MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
	DexterLocalParams params = new DexterLocalParams();
	for (String key : queryParams.keySet()) {
		params.addParam(key, queryParams.getFirst(key));
	}
	return params;
}
 
Example #17
Source File: EntityBuilder.java    From jaxrs-hypermedia with Apache License 2.0 5 votes vote down vote up
public Entity buildBooks(List<Book> books, UriInfo uriInfo) {
    final List<Entity> bookEntities = books.stream().map(b -> buildBookTeaser(b, uriInfo)).collect(Collectors.toList());

    return createEntityBuilder().setComponentClass("books")
            .addLink(linkBuilder.forBooks(uriInfo))
            .addSubEntities(bookEntities).build();
}
 
Example #18
Source File: PluginApiInfoResource.java    From devicehive-java-server with Apache License 2.0 5 votes vote down vote up
@GET
@PreAuthorize("permitAll")
@ApiOperation(value = "Get API info", notes = "Returns version of API, server timestamp and WebSocket base uri"
)
@ApiResponses(value = {
        @ApiResponse(code = 200,
                message = "Returns version of API, server timestamp and WebSocket base uri",
                response = ApiInfoVO.class),
})
Response getApiInfo(@Context UriInfo uriInfo,
                    @HeaderParam("X-Forwarded-Proto")
                    @DefaultValue("http")
                            String protocol);
 
Example #19
Source File: ODataPropertyResource.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * POST メソッドへの処理.
 * @param uriInfo UriInfo
 * @param accept アクセプトヘッダ
 * @param format $formatクエリ
 * @param reader リクエストボディ
 * @return JAX-RS Response
 */
@POST
public final Response postEntity(
        @Context final UriInfo uriInfo,
        @HeaderParam(HttpHeaders.ACCEPT) final String accept,
        @DefaultValue(FORMAT_JSON) @QueryParam("$format") final String format,
        final Reader reader) {
    // アクセス制御
    this.checkWriteAccessContext();

    OEntityWrapper oew = createEntityFromInputStream(reader);
    EntityResponse res = getOdataProducer().createNp(this.sourceEntityId, this.targetNavProp,
            oew, getEntitySetName());
    if (res == null || res.getEntity() == null) {
        return Response.status(HttpStatus.SC_PRECONDITION_FAILED).entity("conflict").build();
    }

    OEntity ent = res.getEntity();
    String etag = oew.getEtag();

    // バージョンが更新された場合、etagを更新する
    if (etag != null && ent instanceof OEntityWrapper) {
        ((OEntityWrapper) ent).setEtag(etag);
    }

    // 現状は、ContentTypeはJSON固定
    MediaType outputFormat = this.decideOutputFormat(accept, format);
    // Entity Responseをレンダー
    List<MediaType> contentTypes = new ArrayList<MediaType>();
    contentTypes.add(outputFormat);
    UriInfo resUriInfo = DcCoreUtils.createUriInfo(uriInfo, 2);
    String key = AbstractODataResource.replaceDummyKeyToNull(ent.getEntityKey().toKeyString());

    String responseStr = renderEntityResponse(resUriInfo, res, format, contentTypes);

    // 制御コードのエスケープ処理
    responseStr = escapeResponsebody(responseStr);
    ResponseBuilder rb = getPostResponseBuilder(ent, outputFormat, responseStr, resUriInfo, key);
    return rb.build();
}
 
Example #20
Source File: ProjectApi.java    From ezScrum with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Response delete(long resourceId, UriInfo uriInfo)
		throws Exception {
	ProjectObject project = ProjectObject.get(resourceId);
	if (project.delete()) {
		return responseOK();
	}
	return responseFail("Delete Project #" + resourceId + " Faid");
}
 
Example #21
Source File: QueueConsumer.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected void setMessageResponseLinks(UriInfo info,
                                       String basePath,
                                       Response.ResponseBuilder responseBuilder,
                                       String index) {
   setConsumeNextLink(serviceManager.getLinkStrategy(), responseBuilder, info, basePath, index);
   setSessionLink(responseBuilder, info, basePath);
}
 
Example #22
Source File: SynchronousResources.java    From servicetalk with Apache License 2.0 5 votes vote down vote up
@Produces(TEXT_PLAIN)
@Path("/uris/{type:(relative|absolute)}")
@GET
public String getUri(@PathParam("type") final String uriType, @Context final UriInfo uriInfo) {
    if (uriType.charAt(0) == 'a') {
        return uriInfo.getAbsolutePathBuilder().build().toString();
    } else {
        return UriBuilder.fromResource(AsynchronousResources.class).path("/text").build().toString();
    }
}
 
Example #23
Source File: Mname.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
@PUT
@Path("/{role}/{env}/{job}/{instance}/{forward:.+}")
public Response putWithForwardRequest(
    @PathParam("role") String role,
    @PathParam("env") String env,
    @PathParam("job") String job,
    @PathParam("instance") int instanceId,
    @PathParam("forward") String forward,
    @Context UriInfo uriInfo) {

  return get(role, env, job, instanceId, uriInfo, Optional.of(forward));
}
 
Example #24
Source File: BaseController.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
private Response handleGovpayException(UriInfo uriInfo, HttpHeaders httpHeaders, String methodName, GovPayException e, String transactionId) {
	this.log.error("Errore ("+e.getClass().getSimpleName()+") durante "+methodName+": "+ e.getMessage(), e);
	FaultBean respKo = new FaultBean();
	int statusCode = e.getStatusCode();
	if(e.getFaultBean()!=null) {
		respKo.setCategoria(CategoriaEnum.PAGOPA);
		respKo.setCodice(e.getFaultBean().getFaultCode());
		respKo.setDescrizione(e.getFaultBean().getFaultString());
		respKo.setDettaglio(e.getFaultBean().getDescription());
		statusCode = 502; // spostato dalla govpayException perche' ci sono dei casi di errore che non devono restituire 500;
	} else {
		respKo.setCategoria(CategoriaEnum.fromValue(e.getCategoria().name()));
		respKo.setCodice(e.getCodEsitoV3());
		respKo.setDescrizione(e.getDescrizioneEsito());
		respKo.setDettaglio(e.getMessageV3());
	}
	
	String respJson = this.getRespJson(respKo);
	
	ResponseBuilder responseBuilder = Response.status(statusCode).type(MediaType.APPLICATION_JSON).entity(respJson);
	if(statusCode > 499)
		this.handleEventoFail(responseBuilder, transactionId, respKo.getCodice(), respKo.getDettaglio());
	else 
		this.handleEventoKo(responseBuilder, transactionId, respKo.getCodice(), respKo.getDettaglio());
	
	return handleResponseKo(responseBuilder, transactionId).build();
}
 
Example #25
Source File: QueueResource.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@CheckPermissionsForPath
@Path("subscriptions")
public QueueSubscriptionResource getSubscriptions( @Context UriInfo ui ) throws Exception {

    if (logger.isTraceEnabled()) {
        logger.trace("QueueResource.getSubscriptions");
    }

    return getSubResource( QueueSubscriptionResource.class ).init( mq, queuePath );
}
 
Example #26
Source File: CourseResourceFolderWebService.java    From olat with Apache License 2.0 5 votes vote down vote up
@GET
@Path("sharedfolder/{path:.*}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML, MediaType.APPLICATION_OCTET_STREAM })
public Response getSharedFiles(@PathParam("courseId") final Long courseId, @PathParam("path") final List<PathSegment> path, @Context final UriInfo uriInfo,
        @Context final HttpServletRequest httpRequest, @Context final Request request) {
    return getFiles(courseId, path, FolderType.COURSE_FOLDER, uriInfo, httpRequest, request);
}
 
Example #27
Source File: ConsumersResource.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Path("attributes-{attributes}/{consumer-id}")
@GET
public Response getConsumer(@PathParam("attributes") int attributes,
                            @PathParam("consumer-id") String consumerId,
                            @Context UriInfo uriInfo) throws Exception {
   ActiveMQRestLogger.LOGGER.debug("Handling GET request for \"" + uriInfo.getPath() + "\"");

   return headConsumer(attributes, consumerId, uriInfo);
}
 
Example #28
Source File: SearchResource.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("inputfield/{id}/search")
public Page<InputFieldOutVO> searchInputFieldByCriteria(@PathParam("id") Long id, @Context UriInfo uriInfo)
		throws AuthenticationException, AuthorisationException, ServiceException {
	PSFUriPart psf;
	return new Page<InputFieldOutVO>(WebUtil.getServiceLocator().getSearchService().searchInputFieldByCriteria(auth, id, psf = new PSFUriPart(uriInfo)), psf);
}
 
Example #29
Source File: Intermediari.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path("/{idIntermediario}")

@Produces({ "application/json" })
public Response getIntermediario(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders, @PathParam("idIntermediario") String idIntermediario){
    this.buildContext();
    return this.controller.getIntermediario(this.getUser(), uriInfo, httpHeaders,  idIntermediario);
}
 
Example #30
Source File: UsersResource.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Path( "{username}" )
public UserResource getUserByUsername( @Context UriInfo ui, @PathParam( "username" ) String username )
        throws Exception {

    if ( "me".equals( username ) ) {
        UserInfo user = SubjectUtils.getAdminUser();
        if ( ( user != null ) && ( user.getUuid() != null ) ) {
            return getSubResource( UserResource.class ).init( management.getAdminUserByUuid( user.getUuid() ) );
        }
        throw mappableSecurityException( "unauthorized", "No admin identity for access credentials provided" );
    }

    return getUserResource(management.getAdminUserByUsername(username), "username", username);
}