Java 类javax.ws.rs.GET 实例源码
项目:E-Clinic
文件:AdminClinicRestEndPoint.java
@GET
@Path("find")
@Produces(MediaType.APPLICATION_JSON)
public Response find() {
JsonArray build = null;
try {
build = adminClinicService.get().stream().map(h -> Json.createObjectBuilder()
.add("firstname", h.getPersonId().getFirstName())
.add("lastname", h.getPersonId().getLastName())
.add("id", h.getAdminClinicId())
.build())
.collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add)
.build();
} catch (Exception ex) {
return Response.ok().header("Exception", ex.getMessage()).build();
}
return Response.ok().entity(build == null ? "No data found" : build).build();
}
项目:E-Clinic
文件:CountryRestEndPoint.java
@GET
@Path("find")
@Produces(MediaType.APPLICATION_JSON)
public Response find() {
JsonArray build = null;
try {
build = countryService.get().stream().map(h -> Json.createObjectBuilder()
.add("id", h.getCountryId())
.add("name", h.getCountryName())
.build())
.collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add)
.build();
} catch (Exception ex) {
return Response.ok().header("Exception", ex.getMessage()).build();
}
return Response.ok().entity(build == null ? "No data found" : build).build();
}
项目:scott-eu
文件:ServiceProviderService1.java
@GET
@Path("{planId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlanAsHtml(
@PathParam("serviceProviderId") final String serviceProviderId, @PathParam("planId") final String planId
) throws ServletException, IOException, URISyntaxException
{
// Start of user code getPlanAsHtml_init
// End of user code
final Plan aPlan = PlannerReasonerManager.getPlan(httpServletRequest, serviceProviderId, planId);
if (aPlan != null) {
httpServletRequest.setAttribute("aPlan", aPlan);
// Start of user code getPlanAsHtml_setAttributes
// End of user code
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/plan.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
项目:microprofile-jwt-auth
文件:RequiredClaimsEndpoint.java
@GET
@Path("/verifyExpiration")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyExpiration(@QueryParam("exp") Long exp) {
boolean pass = false;
String msg;
// exp
Long expValue = rawTokenJson.getExpirationTime();
if (expValue == null || expValue.intValue() == 0) {
msg = Claims.exp.name() + "value is null or empty, FAIL";
}
else if (expValue.equals(exp)) {
msg = Claims.exp.name() + " PASS";
pass = true;
}
else {
msg = String.format("%s: %s != %s", Claims.exp.name(), expValue, exp);
}
JsonObject result = Json.createObjectBuilder()
.add("pass", pass)
.add("msg", msg)
.build();
return result;
}
项目:marathonv5
文件:LiveSalesListFacadeREST.java
@GET
@Produces({"application/xml", "application/json"})
@Path("/recent/region/producttype/{regionName}/{productTypeId}/{orderLineId}")
public List<LiveSalesList> findRecentRegionProductTypeFrom(@PathParam("regionName") String regionName, @PathParam("productTypeId") Integer productTypeId, @PathParam("orderLineId") Integer orderLineId) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
javax.persistence.criteria.CriteriaQuery cq = cb.createQuery();
Root<LiveSalesList> liveSalesList = cq.from(LiveSalesList.class);
cq.select(liveSalesList);
cq.where(cb.and(
cb.equal(liveSalesList.get(LiveSalesList_.productTypeId), productTypeId),
cb.equal(liveSalesList.get(LiveSalesList_.region), regionName),
cb.gt(liveSalesList.get(LiveSalesList_.orderLineId), orderLineId)
));
Query q = getEntityManager().createQuery(cq);
q.setMaxResults(500);
return q.getResultList();
}
项目:hadoop
文件:RMWebServices.java
@GET
@Path("/apps/{appid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppInfo getApp(@Context HttpServletRequest hsr,
@PathParam("appid") String appId) {
init();
if (appId == null || appId.isEmpty()) {
throw new NotFoundException("appId, " + appId + ", is empty or null");
}
ApplicationId id;
id = ConverterUtils.toApplicationId(recordFactory, appId);
if (id == null) {
throw new NotFoundException("appId is null");
}
RMApp app = rm.getRMContext().getRMApps().get(id);
if (app == null) {
throw new NotFoundException("app with id: " + appId + " not found");
}
return new AppInfo(rm, app, hasAccess(app, hsr), hsr.getScheme() + "://");
}
项目:hadoop-oss
文件:KMS.java
@GET
@Path(KMSRESTConstants.KEYS_METADATA_RESOURCE)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeysMetadata(@QueryParam(KMSRESTConstants.KEY)
List<String> keyNamesList) throws Exception {
KMSWebApp.getAdminCallsMeter().mark();
UserGroupInformation user = HttpUserGroupInformation.get();
final String[] keyNames = keyNamesList.toArray(
new String[keyNamesList.size()]);
assertAccess(KMSACLs.Type.GET_METADATA, user, KMSOp.GET_KEYS_METADATA);
KeyProvider.Metadata[] keysMeta = user.doAs(
new PrivilegedExceptionAction<KeyProvider.Metadata[]>() {
@Override
public KeyProvider.Metadata[] run() throws Exception {
return provider.getKeysMetadata(keyNames);
}
}
);
Object json = KMSServerJSONUtils.toJSON(keyNames, keysMeta);
kmsAudit.ok(user, KMSOp.GET_KEYS_METADATA, "");
return Response.ok().type(MediaType.APPLICATION_JSON).entity(json).build();
}
项目:talk-observing-distributed-systems
文件:TweetsResource.java
@GET
@Traced(operationName = "find_tweets") //Tracing instrumentation
@Timed //Metrics instrumentation
public Response findTweets() {
try {
final List<TweetRepresentation> tweetRepresentations =
tweetsService.findTweets(new TweetsQuery())
.stream()
.map(Tweet::printRepresentation)
.collect(toList());
final TweetsRepresentation tweetsRepresentation = new TweetsRepresentation();
tweetsRepresentation.setTweets(tweetRepresentations);
return Response.ok(tweetsRepresentation).build();
} catch (Exception e) {
e.printStackTrace();
return Response.serverError().entity(e.getMessage()).build();
}
}
项目:E-Clinic
文件:CityRestEndPoint.java
@GET
@Path("find")
@Produces(MediaType.APPLICATION_JSON)
public Response find() {
JsonArray build = null;
try {
build = cityService.get().stream().map(h -> Json.createObjectBuilder()
.add("id", h.getCityId())
.add("name", h.getCityName())
.build())
.collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add)
.build();
} catch (Exception ex) {
return Response.ok().header("Exception", ex.getMessage()).build();
}
return Response.ok().entity(build == null ? "No data found" : build).build();
}
项目:sdn-controller-nsc-plugin
文件:InspectionHookApis.java
@Path("/{inspectionHookId}")
@GET
public InspectionHookEntity getInspectionHook(@PathParam("controllerId") String controllerId,
@PathParam("inspectionHookId") String inspectionHookId)
throws Exception {
LOG.info("Getting the inspection hook element for id {} ", inspectionHookId);
SampleSdnRedirectionApi sdnApi = ((SampleSdnRedirectionApi) this.api
.createRedirectionApi(new VirtualizationConnectorElementImpl("Sample", controllerId), "TEST"));
InspectionHookEntity inspectionHook = (InspectionHookEntity) sdnApi.getInspectionHook(inspectionHookId);
inspectionHook.setInspectedPort(null);
inspectionHook.setInspectionPort(null);
return inspectionHook;
}
项目:hadoop
文件:NMWebServices.java
@GET
@Path("/containers")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainersInfo getNodeContainers() {
init();
ContainersInfo allContainers = new ContainersInfo();
for (Entry<ContainerId, Container> entry : this.nmContext.getContainers()
.entrySet()) {
if (entry.getValue() == null) {
// just skip it
continue;
}
ContainerInfo info = new ContainerInfo(this.nmContext, entry.getValue(),
uriInfo.getBaseUri().toString(), webapp.name());
allContainers.add(info);
}
return allContainers;
}
项目:osc-core
文件:DistributedApplianceInstanceApis.java
@ApiOperation(value = "Retrieves the Distributed Appliance Instance",
notes = "Retrieves a Distributed Appliance Instance specified by the Id",
response = DistributedApplianceDto.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
@ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{distributedApplianceInstanceId}")
@GET
public DistributedApplianceInstanceDto getDistributedApplianceInstance(@Context HttpHeaders headers,
@ApiParam(value = "The Id of the Distributed Appliance Instance",
required = true) @PathParam("distributedApplianceInstanceId") Long distributedApplianceInstanceId) {
logger.info("Getting Distributed Appliance Instance " + distributedApplianceInstanceId);
this.userContext.setUser(OscAuthFilter.getUsername(headers));
GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest();
getDtoRequest.setEntityId(distributedApplianceInstanceId);
getDtoRequest.setEntityName("DistributedApplianceInstance");
GetDtoFromEntityServiceApi<DistributedApplianceInstanceDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(DistributedApplianceInstanceDto.class);
return this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto();
}
项目:201710-paseos_01
文件:UsuarioResource.java
@GET
@Path("usuarios")
public List<UsuarioDetailDTO> getUsuariosGuias(@QueryParam("guias")int g ){
List<UsuarioDetailDTO> lista = new ArrayList<UsuarioDetailDTO>();
List<UsuarioDetailDTO> lista1 = listEntity2DTO(usuarioLogic.getUsuarios());
for (UsuarioDetailDTO usuario : lista1 )
{
if (usuario.getGuia()!=null)
{
if (usuario.getGuia().booleanValue())
{
lista.add(usuario);
}
}
}
if (g == 1 )
{
return lista;
}
else
{
return lista1;
}
}
项目:osc-core
文件:VirtualSystemApis.java
@ApiOperation(value = "Retrieves the Deployment Specification",
notes = "Retrieves a Deployment Specification specified by its owning Virtual System and Deployment Spec Id",
response = ApplianceManagerConnectorDto.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
@ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{vsId}/deploymentSpecs/{dsId}")
@GET
public DeploymentSpecDto getDeploymentSpec(@Context HttpHeaders headers,
@ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId,
@ApiParam(value = "The Deployment Specification Id") @PathParam("dsId") Long dsId) {
logger.info("getting Deployment Spec " + dsId);
this.userContext.setUser(OscAuthFilter.getUsername(headers));
GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest();
getDtoRequest.setEntityId(dsId);
getDtoRequest.setEntityName("DeploymentSpec");
GetDtoFromEntityServiceApi<DeploymentSpecDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(DeploymentSpecDto.class);
DeploymentSpecDto dto = this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto();
this.apiUtil.validateParentIdMatches(dto, vsId, "SecurityGroup");
return dto;
}
项目:ctsms
文件:JournalResource.java
@GET
@Produces(MediaType.APPLICATION_JSON)
public ResourceIndex index(@Context Application application,
@Context HttpServletRequest request) throws Exception {
// String basePath = request.getRequestURL().toString();
return new ResourceIndex(IndexResource.getResourceIndexNode(JournalResource.class, request)); // basePath));
}
项目:opencps-v2
文件:OfficeSiteManagement.java
@GET
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getOfficeSite(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user,
@Context ServiceContext serviceContext, @PathParam("id") long id);
项目:soapbox-race-core
文件:DriverPersona.java
@GET
@Secured
@Path("/GetPersonaPresenceByName")
@Produces(MediaType.APPLICATION_XML)
public String getPersonaPresenceByName(@QueryParam("displayName") String displayName) {
PersonaPresence personaPresenceByName = bo.getPersonaPresenceByName(displayName);
if (personaPresenceByName.getPersonaId() == 0) {
return "";
}
return MarshalXML.marshal(personaPresenceByName);
}
项目:bootstrap
文件:ConfigurationResource.java
/**
* Return a specific configuration. System properties overrides the value from the database. Configuration values
* are
* always encrypted.
*
* @param name
* The requested parameter name.
* @return a specific configuration. May be <code>null</code>.
*/
@GET
@CacheResult(cacheName = "configuration")
public String get(@CacheKey final String name) {
String value = System.getProperty(name);
if (value == null) {
value = Optional.ofNullable(repository.findByName(name)).map(SystemConfiguration::getValue).orElse(null);
}
return Optional.ofNullable(value).map(cryptoHelper::decryptAsNeeded).orElse(null);
}
项目:soundwave
文件:Query.java
@GET
@Path("/aggregations/terms/{queryString}")
public Response getAggregationsUrl(@PathParam("queryString") @NotNull String query) {
EsAggregation aggregation = new EsAggregation();
aggregation.setQuery(query);
return getAggregations(aggregation);
}
项目:ctsms
文件:ProbandResource.java
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("{id}/files")
public Page<FileOutVO> getFiles(@PathParam("id") Long id, @Context UriInfo uriInfo)
throws AuthenticationException, AuthorisationException, ServiceException {
PSFUriPart psf;
return new Page<FileOutVO>(WebUtil.getServiceLocator().getFileService().getFiles(auth, fileModule, id, null, null, psf = new PSFUriPart(uriInfo)), psf);
}
项目:javaee8-applications
文件:SSEResource.java
@GET
@Path("subscribe")
@Produces(MediaType.SERVER_SENT_EVENTS)
public void subscribe(@Context SseEventSink eventSink,
@Context Sse sse){
eventSink.send(sse.newEvent("Welcome to the List!"));
eventSink.send(sse.newEvent("Message One!"));
eventSink.send(sse.newEvent("SERVER-NOTIFICATION", "Message Two!"));
eventSink.send(sse.newEventBuilder()
.comment("Nice Test")
.name("SERVER-TEST")
.data("Some data...could be an object")
.build());
eventSink.close();
}
项目:outland
文件:FeatureResource.java
@GET
@Path("/{group}")
@PermitAll
@Timed(name = "getFeatures")
public Response getFeatures(
@Auth AuthPrincipal principal,
@PathParam("group") String group
) throws AuthenticationException {
final long start = System.currentTimeMillis();
grantedGuard(principal, group);
return this.headers.enrich(Response.ok(featureService.loadFeatures(group)), start).build();
}
项目:InComb
文件:VoteService.java
/**
* Returns all in votes of a given contentId Element
* @param contentId to get the in votes of
* @param con Connection to use - is injected automatically
* @return a list of Users that voted in for the given contentid
*/
@GET
@Path("/ins")
public Response getInsOfContentId(@PathParam("contentId") final long contentId, @Context final Connection con){
final ContentVoteDao dao = new ContentVoteDao(con);
final List<User> insOfUsers= dao.getUsersThatVotedInOfContentId(contentId);
return ok(UserUtil.toModels(insOfUsers, true));
}
项目:dremio-oss
文件:ProvisioningResource.java
@GET
@Path("/cluster/{id}")
@Produces(MediaType.APPLICATION_JSON)
public ClusterResponse getClusterInfo(@PathParam("id") final String id) throws Exception {
ClusterEnriched cluster = service.getClusterInfo(new ClusterId(id));
return toClusterResponse(cluster);
}
项目:nuls
文件:NodesResourceImpl.java
@Override
@GET
@Path("/count/consensus")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult getConsensusCount() {
return RpcResult.getSuccess();
}
项目:acmeair-modular
文件:AcmeAirConfiguration.java
@GET
@Path("/runtime")
@Produces("application/json")
public ArrayList<ServiceData> getRuntimeInfo() {
try {
logger.fine("Getting Runtime info");
ArrayList<ServiceData> list = new ArrayList<ServiceData>();
ServiceData data = new ServiceData();
data.name = "Runtime";
data.description = "Java";
list.add(data);
data = new ServiceData();
data.name = "Version";
data.description = System.getProperty("java.version");
list.add(data);
data = new ServiceData();
data.name = "Vendor";
data.description = System.getProperty("java.vendor");
list.add(data);
return list;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_application_id_whitelist_remove")
public String diameter_application_id_whitelist_remove(@MatrixParam("ai") int ai) {
DiameterFirewallConfig.diameter_application_id_whitelist.remove((new Integer(ai)).toString());
return "Successful";
}
项目:app-ms
文件:JwksResource.java
/**
* Only return the public keys.
*
* @return public key set.
*/
@ApiOperation(value = "Get public keys",
response = Response.class,
notes = "Provides the JWKS of public keys used for JWS and JWE for clients.")
@GET
@Produces(MediaType.APPLICATION_JSON)
public String getPublicKeySet() {
return cachedDataProvider.getKeySet().toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY);
}
项目:hadoop
文件:AHSWebServices.java
@GET
@Path("/apps/{appid}/appattempts/{appattemptid}/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Override
public ContainerInfo getContainer(@Context HttpServletRequest req,
@Context HttpServletResponse res, @PathParam("appid") String appId,
@PathParam("appattemptid") String appAttemptId,
@PathParam("containerid") String containerId) {
init(res);
return super.getContainer(req, res, appId, appAttemptId, containerId);
}
项目:kafka-0.11.0.0-src-with-comment
文件:ConnectorsResource.java
@GET
@Path("/{connector}/config")
public Map<String, String> getConnectorConfig(final @PathParam("connector") String connector,
final @QueryParam("forward") Boolean forward) throws Throwable {
FutureCallback<Map<String, String>> cb = new FutureCallback<>();
herder.connectorConfig(connector, cb);
return completeOrForwardRequest(cb, "/connectors/" + connector + "/config", "GET", null, forward);
}
项目:personium-core
文件:CellSnapshotDavFileResource.java
/**
* process OPTIONS Method.
* @return JAX-RS response object
*/
@OPTIONS
public Response options() {
// Check exist
checkFileExists();
// Access Control
davRsCmp.getParent().checkAccessContext(davRsCmp.getAccessContext(), CellPrivilege.ROOT);
return PersoniumCoreUtils.responseBuilderForOptions(
HttpMethod.GET,
HttpMethod.PUT,
HttpMethod.DELETE,
io.personium.common.utils.PersoniumCoreUtils.HttpMethod.PROPFIND
).build();
}
项目:verify-hub
文件:IdentityProviderResource.java
@GET
@Path(Urls.ConfigUrls.IDP_CONFIG_DATA)
@Timed
public IdpConfigDto getIdpConfig(@PathParam(Urls.SharedUrls.ENTITY_ID_PARAM) String entityId) {
IdentityProviderConfigEntityData idpData = getIdentityProviderConfigData(entityId);
return new IdpConfigDto(
idpData.getSimpleId(),
idpData.isEnabled(),
idpData.getSupportedLevelsOfAssurance(),
idpData.getUseExactComparisonType()
);
}
项目:Info-Portal
文件:UserResource.java
@GET
@Path("/{id}")
public Response getUser(@PathParam("id") long id) {
User user = users.findUser(id);
if (user != null) {
return Response.status(Response.Status.ACCEPTED).entity(user).build();
}
return Response.status(Response.Status.NOT_FOUND).build();
}
项目:athena
文件:MetersWebResource.java
/**
* Returns all meters of all devices.
*
* @return 200 OK with array of all the meters in the system
* @onos.rsModel Meters
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getMeters() {
final Iterable<Meter> meters = meterService.getAllMeters();
if (meters != null) {
meters.forEach(meter -> metersNode.add(codec(Meter.class).encode(meter, this)));
}
return ok(root).build();
}
项目:Equella
文件:ItemResource.java
@GET
@Path("/{uuid}/{version}")
@ApiOperation(value = "Get information about an item", response = ItemBean.class)
public ItemBean getItem(
// @formatter:off
@Context UriInfo uriInfo,
@ApiParam(APIDOC_ITEMUUID) @PathParam("uuid") String uuid,
@ApiParam(APIDOC_ITEMVERSION) @PathParam("version") int version,
@ApiParam(value = "How much information to return for the item", required = false, allowableValues = ALL_ALLOWABLE_INFOS, allowMultiple = true) @QueryParam("info") CsvList info);
项目:opencps-v2
文件:WorkTimeManagement.java
@GET
@Path("/{n}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response read(@Context HttpServletRequest request, @Context HttpHeaders header,
@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
@DefaultValue("0") @PathParam("n") int n);
项目:athena
文件:ControlMetricsWebResource.java
/**
* Returns control message metrics of a given device.
*
* @param deviceId device identification
* @return control message metrics of a given device
* @onos.rsModel ControlMessageMetric
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("messages/{deviceId}")
public Response controlMessageMetrics(@PathParam("deviceId") String deviceId) {
metricsStats(monitorService, localNodeId, CONTROL_MESSAGE_METRICS,
DeviceId.deviceId(deviceId), root);
return ok(root).build();
}
项目:sdn-controller-nsc-plugin
文件:PortApis.java
@GET
public List<String> getPortIds(@PathParam("controllerId") String controllerId) throws Exception {
LOG.info("Listing port elements ids'");
SampleSdnRedirectionApi sdnApi = ((SampleSdnRedirectionApi) this.api
.createRedirectionApi(new VirtualizationConnectorElementImpl("Sample", controllerId), "TEST"));
return sdnApi.getPortIds();
}
项目:dust-api
文件:DeviceResource.java
@GET
@Path("/{nickname}/details-qr")
@Produces("image/png")
public Response deviceDetailsLinkQrCode(
@PathParam("nickname") final String nickname,
@QueryParam("baseUrl") @DefaultValue(DEFAULT_BASE_URL) final String baseUrl
) throws IOException {
final byte[] detailsQr = qrCodeAsPng(baseUrl, nickname, "");
return Response.ok(new ByteArrayInputStream(detailsQr)).build();
}
项目:holon-examples
文件:ProtectedEndpoint.java
@PermitAll
@GET
@Path("/anyrole")
@Produces(MediaType.TEXT_PLAIN)
public String getAnyRole() {
return "anyrole";
}