本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
示例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() + "://");
}
示例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();
}
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例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));
}
示例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);