本文整理汇总了Java中javax.ws.rs.Produces类的典型用法代码示例。如果您正苦于以下问题:Java Produces类的具体用法?Java Produces怎么用?Java Produces使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Produces类属于javax.ws.rs包,在下文中一共展示了Produces类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRecentRegionProductTypeFrom
import javax.ws.rs.Produces; //导入依赖的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();
}
示例2: getFolder
import javax.ws.rs.Produces; //导入依赖的package包/类
@GET
@Path("/folder/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
public Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents) throws NamespaceException, FolderNotFoundException, DatasetNotFoundException {
FolderPath folderPath = FolderPath.fromURLPath(spaceName, path);
try {
final FolderConfig folderConfig = namespaceService.getFolder(folderPath.toNamespaceKey());
final List<NamespaceKey> datasetPaths = namespaceService.getAllDatasets(folderPath.toNamespaceKey());
final ExtendedConfig extendedConfig = new ExtendedConfig().setDatasetCount((long)datasetPaths.size())
.setJobCount(datasetService.getJobsCount(datasetPaths));
folderConfig.setExtendedConfig(extendedConfig);
NamespaceTree contents = includeContents
? newNamespaceTree(namespaceService.list(folderPath.toNamespaceKey()))
: null;
return newFolder(folderPath, folderConfig, contents);
} catch (NamespaceNotFoundException nfe) {
throw new FolderNotFoundException(folderPath, nfe);
}
}
示例3: getAllAgentConfigurations
import javax.ws.rs.Produces; //导入依赖的package包/类
@GET
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "Returns all existing agent configurations", notes = "Returns all agent configurations with all details", response = AgentConfigurationDatabase.class, responseContainer = "List", tags={ "AgentConfiguration", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Successful operation", response = AgentConfigurationDatabase.class, responseContainer = "List"),
@io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = AgentConfigurationDatabase.class, responseContainer = "List"),
@io.swagger.annotations.ApiResponse(code = 403, message = "Forbidden", response = AgentConfigurationDatabase.class, responseContainer = "List"),
@io.swagger.annotations.ApiResponse(code = 404, message = "Not Found", response = AgentConfigurationDatabase.class, responseContainer = "List") })
public Response getAllAgentConfigurations(@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.getAllAgentConfigurations(securityContext);
}
示例4: get
import javax.ws.rs.Produces; //导入依赖的package包/类
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context UriInfo uriInfo) {
if (LOG.isDebugEnabled()) {
LOG.debug("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
try {
ResponseBuilder response =
Response.ok(new TableSchemaModel(getTableSchema()));
response.cacheControl(cacheControl);
servlet.getMetrics().incrementSucessfulGetRequests(1);
return response.build();
} catch (Exception e) {
servlet.getMetrics().incrementFailedGetRequests(1);
return processException(e);
}
}
示例5: updateUser
import javax.ws.rs.Produces; //导入依赖的package包/类
@RolesAllowed({"admin", "user"})
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public UserUI updateUser(UserForm userForm, @PathParam("userName") UserName userName)
throws IOException, IllegalArgumentException, NamespaceException, UserNotFoundException, DACUnauthorizedException {
checkUser(userName, "update");
User userConfig = userForm.getUserConfig();
if (userConfig != null && userConfig.getUserName() != null && !userConfig.getUserName().equals(userName.getName())) {
final UserName newUserName = new UserName(userForm.getUserConfig().getUserName());
userConfig = userService.updateUserName(userName.getName(),
newUserName.getName(),
userConfig, userForm.getPassword());
// TODO: rename home space and all uploaded files along with it
// new username
return new UserUI(new UserResourcePath(newUserName), newUserName, userConfig);
} else {
User newUser = SimpleUser.newBuilder(userForm.getUserConfig()).setUserName(userName.getName()).build();
newUser = userService.updateUser(newUser, userForm.getPassword());
return new UserUI(new UserResourcePath(userName), userName, newUser);
}
}
示例6: noitifyStrategyQuery
import javax.ws.rs.Produces; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
@POST
@Path("notify/q/stgy/hm")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void noitifyStrategyQuery(String data, @Suspended AsyncResponse response) throws Exception {
Map<String, Object> params = JSONHelper.toObject(data, Map.class);
int pagesize = (int) params.get("pagesize");
int pageindex = (int) params.get("pageindex");
Map<String, String> strategyMap = new HashMap<String, String>();
strategyMap.put("keys", String.valueOf(params.get("inputValue")));
// 封装http请求数据
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("body", JSONHelper.toString(strategyMap));
message.setIntent("strategy.query");
NoitifyStrategyQuery callback = new NoitifyStrategyQuery();
callback.setResponse(response);
callback.setPageindex(pageindex);
callback.setPagesize(pagesize);
doHttpPost("uav.app.godeye.notify.strategy.http.addr", "/rtntf/oper", message, callback);
}
示例7: chat
import javax.ws.rs.Produces; //导入依赖的package包/类
@POST
@RolesAllowed({ Role.USER, Role.ADMIN })
@Path("/chat")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Send a query to HABot to interpret.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ChatReply.class),
@ApiResponse(code = 500, message = "An interpretation error occured") })
public Response chat(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language,
@ApiParam(value = "human language query", required = true) String query) throws Exception {
final Locale locale = LocaleUtil.getLocale(language);
// interpret
OpenNLPInterpreter hli = (OpenNLPInterpreter) voiceManager.getHLI(OPENNLP_HLI);
ChatReply reply = hli.reply(locale, query);
return Response.ok(reply).build();
}
示例8: async
import javax.ws.rs.Produces; //导入依赖的package包/类
@ApiOperation(value = "displays openid config of google async",
hidden = true)
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/async")
public void async(@Suspended final AsyncResponse asyncResponse) throws InterruptedException,
ExecutionException {
final Future<Response> futureResponseFromClient = jaxrsClient.target("https://accounts.google.com/.well-known/openid-configuration").request().header(javax.ws.rs.core.HttpHeaders.USER_AGENT, "curl/7.55.1").async().get();
final Response responseFromClient = futureResponseFromClient.get();
try {
final String object = responseFromClient.readEntity(String.class);
asyncResponse.resume(object);
} finally {
responseFromClient.close();
}
}
示例9: find
import javax.ws.rs.Produces; //导入依赖的package包/类
@GET
@Path("find/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response find(@PathParam("id") @Valid String id) {
JsonObject build = null;
try {
Clinicmanager get = clinicManagerService.get(Integer.valueOf(id));
build = Json.createObjectBuilder()
.add("firstname", get.getPersonId().getFirstName())
.add("lastname", get.getPersonId().getLastName())
.add("id", get.getManagerId())
.add("genderId", get.getPersonId().getGenderId().getGenderId())
.build();
} catch (Exception ex) {
return Response.ok().header("Exception", ex.getMessage()).build();
}
return Response.ok().entity(build == null ? "No data found" : build).build();
}
示例10: bubbleDetails
import javax.ws.rs.Produces; //导入依赖的package包/类
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("bubble")
@Consumes("*/*")
public Response bubbleDetails(
@Context HttpServletRequest request,
InputStream is
)
throws IOException,
URISyntaxException
{
APIImpl impl = getAPIImpl( request );
if( impl == null )
{
return Response.status( Response.Status.UNAUTHORIZED ).build();
}
String urn = stream2string( is );
Result result = impl.viewableQuery( urn );
return formatReturn( result );
}
示例11: get
import javax.ws.rs.Produces; //导入依赖的package包/类
/**
* Build a response for a list of all namespaces request.
* @param context servlet context
* @param uriInfo (JAX-RS context variable) request URL
* @return a response for a version request
*/
@GET
@Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
MIMETYPE_PROTOBUF_IETF})
public Response get(final @Context ServletContext context, final @Context UriInfo uriInfo) {
if (LOG.isDebugEnabled()) {
LOG.debug("GET " + uriInfo.getAbsolutePath());
}
servlet.getMetrics().incrementRequests(1);
try {
NamespacesModel rowModel = null;
rowModel = new NamespacesModel(servlet.getAdmin());
servlet.getMetrics().incrementSucessfulGetRequests(1);
return Response.ok(rowModel).build();
} catch (IOException e) {
servlet.getMetrics().incrementFailedGetRequests(1);
throw new RuntimeException("Cannot retrieve list of namespaces.");
}
}
示例12: info
import javax.ws.rs.Produces; //导入依赖的package包/类
@POST
@Path("/info")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
@ApiOperation("Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector-template-id` and the data given in `connectorSettings`")
public ConnectorSummary info(@MultipartForm final CustomConnectorFormData connectorFormData) {
try {
final String specification;
try (BufferedSource source = Okio.buffer(Okio.source(connectorFormData.getSpecification()))) {
specification = source.readUtf8();
}
final ConnectorSettings connectorSettings = new ConnectorSettings.Builder()
.createFrom(connectorFormData.getConnectorSettings())
.putConfiguredProperty("specification", specification)
.build();
return withGeneratorAndTemplate(connectorSettings.getConnectorTemplateId(),
(generator, template) -> generator.info(template, connectorSettings));
} catch (IOException e) {
throw SyndesisServerException.launderThrowable("Failed to read specification", e);
}
}
示例13: bucketDelete
import javax.ws.rs.Produces; //导入依赖的package包/类
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("bucket/{bucketKey}")
public Response bucketDelete(
@Context HttpServletRequest request,
@PathParam("bucketKey") String bucketKey
)
throws IOException,
URISyntaxException
{
APIImpl impl = getAPIImpl( request );
if( impl == null )
{
return Response.status( Response.Status.UNAUTHORIZED ).build();
}
Result result = impl.bucketDelete( bucketKey );
return formatReturn( result );
}
示例14: health
import javax.ws.rs.Produces; //导入依赖的package包/类
@GET
@Path("health")
@Produces(MediaType.TEXT_PLAIN)
public Response health() throws IOException {
ShutdownState shut = getShutdownState();
if (shut == ShutdownState.UP) {
LOG.info("Healthcheck: UP");
return Response.ok("ok", MediaType.TEXT_PLAIN_TYPE).build();
} else if (shut == ShutdownState.DOWN) {
LOG.info("Healthcheck: DOWN");
return Response.status(Response.Status.FORBIDDEN).type(MediaType.TEXT_PLAIN_TYPE).entity("Build Server is shutdown").build();
} else if (shut == ShutdownState.DRAINING) {
LOG.info("Healthcheck: DRAINING");
return Response.status(Response.Status.FORBIDDEN).type(MediaType.TEXT_PLAIN_TYPE).entity("Build Server is draining").build();
} else {
LOG.info("Healthcheck: SHUTTING");
return Response.status(Response.Status.FORBIDDEN).type(MediaType.TEXT_PLAIN_TYPE).entity("Build Server is shutting down").build();
}
}
示例15: verifyAudience
import javax.ws.rs.Produces; //导入依赖的package包/类
@GET
@Path("/verifyAudience")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject verifyAudience(@QueryParam("aud") String audience) {
boolean pass = false;
String msg;
// aud
final Set<String> audValue = rawTokenJson.getAudience();
if (audValue != null) {
msg = Claims.aud.name() + "value is NOT null, FAIL";
}
else {
msg = Claims.aud.name() + " PASS";
pass = true;
}
JsonObject result = Json.createObjectBuilder()
.add("pass", pass)
.add("msg", msg)
.build();
return result;
}