當前位置: 首頁>>代碼示例>>Java>>正文


Java GET類代碼示例

本文整理匯總了Java中javax.ws.rs.GET的典型用法代碼示例。如果您正苦於以下問題:Java GET類的具體用法?Java GET怎麽用?Java GET使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GET類屬於javax.ws.rs包,在下文中一共展示了GET類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getKeysMetadata

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:25,代碼來源:KMS.java

示例2: find

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
}
 
開發者ID:Fatlonder,項目名稱:E-Clinic,代碼行數:19,代碼來源:AdminClinicRestEndPoint.java

示例3: find

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
}
 
開發者ID:Fatlonder,項目名稱:E-Clinic,代碼行數:18,代碼來源:CountryRestEndPoint.java

示例4: getPlanAsHtml

import javax.ws.rs.GET; //導入依賴的package包/類
@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);
}
 
開發者ID:EricssonResearch,項目名稱:scott-eu,代碼行數:24,代碼來源:ServiceProviderService1.java

示例5: verifyExpiration

import javax.ws.rs.GET; //導入依賴的package包/類
@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;
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:25,代碼來源:RequiredClaimsEndpoint.java

示例6: findRecentRegionProductTypeFrom

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:LiveSalesListFacadeREST.java

示例7: getApp

import javax.ws.rs.GET; //導入依賴的package包/類
@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() + "://");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:21,代碼來源:RMWebServices.java

示例8: findTweets

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
  }
}
 
開發者ID:jeqo,項目名稱:talk-observing-distributed-systems,代碼行數:19,代碼來源:TweetsResource.java

示例9: find

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
}
 
開發者ID:Fatlonder,項目名稱:E-Clinic,代碼行數:18,代碼來源:CityRestEndPoint.java

示例10: getInspectionHook

import javax.ws.rs.GET; //導入依賴的package包/類
@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;
}
 
開發者ID:opensecuritycontroller,項目名稱:sdn-controller-nsc-plugin,代碼行數:19,代碼來源:InspectionHookApis.java

示例11: getNodeContainers

import javax.ws.rs.GET; //導入依賴的package包/類
@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;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:19,代碼來源:NMWebServices.java

示例12: getDistributedApplianceInstance

import javax.ws.rs.GET; //導入依賴的package包/類
@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();
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:22,代碼來源:DistributedApplianceInstanceApis.java

示例13: getUsuariosGuias

import javax.ws.rs.GET; //導入依賴的package包/類
@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; 
   }
}
 
開發者ID:Uniandes-ISIS2603-backup,項目名稱:201710-paseos_01,代碼行數:26,代碼來源:UsuarioResource.java

示例14: index

import javax.ws.rs.GET; //導入依賴的package包/類
@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));
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:8,代碼來源:JournalResource.java

示例15: getOfficeSite

import javax.ws.rs.GET; //導入依賴的package包/類
@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);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:8,代碼來源:OfficeSiteManagement.java


注:本文中的javax.ws.rs.GET類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。