本文整理汇总了Java中javax.ws.rs.HeaderParam类的典型用法代码示例。如果您正苦于以下问题:Java HeaderParam类的具体用法?Java HeaderParam怎么用?Java HeaderParam使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HeaderParam类属于javax.ws.rs包,在下文中一共展示了HeaderParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listAll
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=events;v=1"})
@ApiOperation(
value = "obtain all events emitted by the account-event service", response = EventsRepresentation.class,
notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
"subscribers to the account service should be able to listen for and react to. In other words this is the authoritative" +
"feed for the account service",
authorizations = {
@Authorization(value = "oauth2", scopes = {}),
@Authorization(value = "oauth2-cc", scopes = {}),
@Authorization(value = "oauth2-ac", scopes = {}),
@Authorization(value = "oauth2-rop", scopes = {}),
@Authorization(value = "Bearer")
},
tags = {"interval", "events"},
produces = "application/hal+json, application/hal+json;concept=events;v=1",
nickname = "listAccountAllEvents"
)
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response listAll(@Context UriInfo uriInfo, @Context Request request,
@HeaderParam("Accept") String accept, @QueryParam("interval") String interval) {
return eventsProducers.getOrDefault(accept, this::handleUnsupportedContentType)
.getResponse(uriInfo, request, interval);
}
示例2: getCustomerServiceMetadata
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=metadata;v=1"})
@ApiOperation(
value = "metadata for the events endpoint", response = EventsMetadataRepresentation.class,
authorizations = {
@Authorization(value = "oauth2", scopes = {}),
@Authorization(value = "oauth2-cc", scopes = {}),
@Authorization(value = "oauth2-ac", scopes = {}),
@Authorization(value = "oauth2-rop", scopes = {}),
@Authorization(value = "Bearer")
},
notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
"subscribers to the customer service should be able to listen for and react to. In other words this is the authoritative" +
"feed for the customer service",
tags = {"events"},
produces = "application/hal+json, application/hal+json;concept=metadata;v=1",
nickname = "getCustomerMetadata"
)
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response getCustomerServiceMetadata(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
return eventMetadataProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
示例3: list
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=virtualaccount;v=1"})
@ApiOperation(value = "lists accounts", response = VirtualAccountsRepresentation.class,
authorizations = {
@Authorization(value = "oauth2", scopes = {}),
@Authorization(value = "oauth2-cc", scopes = {}),
@Authorization(value = "oauth2-ac", scopes = {}),
@Authorization(value = "oauth2-rop", scopes = {}),
@Authorization(value = "Bearer")
},
extensions = {@Extension(name = "roles", properties = {
@ExtensionProperty(name = "advisor", value = "advisors are allowed getting every virtualaccount"),
@ExtensionProperty(name = "customer", value = "customer only allowed getting own locations")}
)},
produces = "application/hal+json, application/hal+json;concept=locations;v=1",
notes = "List all locations in a default projection, which is VirtualAccount version 1" +
"Supported projections and versions are: " +
"VirtualAccounts in version 1 " +
"The Accept header for the default version is application/hal+json;concept=virtualaccount;v=1.0.0.... " +
"The format for the default version is {....}", nickname = "listVirtualAccounts")
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
return accountsProducer.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
示例4: listAllCustomerEvents
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=events;v=1"})
@ApiOperation(
value = "obtain all events emitted by the customer-event service", response = EventsRepresentation.class,
notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " +
"subscribers to the customers service should be able to listen for and react to. In other words this is the authoritative" +
"feed for the customers service",
authorizations = {
@Authorization(value = "oauth2", scopes = {}),
@Authorization(value = "oauth2-cc", scopes = {}),
@Authorization(value = "oauth2-ac", scopes = {}),
@Authorization(value = "oauth2-rop", scopes = {}),
@Authorization(value = "Bearer")
},
tags = {"interval", "events"},
produces = "application/hal+json, application/hal+json;concept=events;v=1",
nickname = "listAllCustomerEvents"
)
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response listAllCustomerEvents(@Context UriInfo uriInfo, @Context Request request,
@HeaderParam("Accept") String accept, @QueryParam("interval") String interval) {
return eventsProducers.getOrDefault(accept, this::handleUnsupportedContentType)
.getResponse(uriInfo, request, interval);
}
示例5: list
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@GET
@Produces({"application/hal+json", "application/hal+json;concept=customers;v=1"})
@ApiOperation(value = "lists customers", response = CustomersRepresentation.class,
authorizations = {
@Authorization(value = "oauth2", scopes = {}),
@Authorization(value = "oauth2-cc", scopes = {}),
@Authorization(value = "oauth2-ac", scopes = {}),
@Authorization(value = "oauth2-rop", scopes = {}),
@Authorization(value = "Bearer")
},
extensions = {@Extension(name = "roles", properties = {
@ExtensionProperty(name = "advisor", value = "advisors are allowed getting every customer"),
@ExtensionProperty(name = "customer", value = "customer only allowed getting own information")}
)},
produces = "application/hal+json, application/hal+json;concept=customers;v=1",
notes = "List all customers in a default projection, which is Customers version 1" +
"Supported projections and versions are: " +
"Customers in version 1 " +
"The Accept header for the default version is application/hal+json;concept=customers;v=1.0.0.... " +
"The format for the default version is {....}", nickname = "listCustomers")
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) {
return customersProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request);
}
示例6: graphIndirectPost
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
/**
* Indirect HTTP POST
*
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-post">
* Section 5.5 "HTTP POST"
* </a>
* @param uriInfo JAX-RS {@link UriInfo} object
* @param type Content-Type HTTP header field
* @param graphString the "graph" query parameter
* @param def the "default" query parameter
* @param chunked the "chunked" query parameter
* @param in HTTP body as {@link InputStream}
* @return "204 No Content", if operation was successful
*/
@POST
@Consumes({
RDFMediaType.RDF_TURTLE,
RDFMediaType.RDF_YARS,
RDFMediaType.RDF_XML,
RDFMediaType.RDF_NTRIPLES,
RDFMediaType.RDF_XML
})
public Response graphIndirectPost(
@Context UriInfo uriInfo,
@HeaderParam("Content-Type") MediaType type,
@QueryParam("graph") String graphString,
@QueryParam("default") String def,
@QueryParam("chunked") String chunked,
InputStream in) {
return handleAdd(uriInfo, type, graphString, def, in, chunked, false);
}
示例7: createObject
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
/**
* Creates a new object.
*
* This originally used application/octet-stream;qs=1001 as a workaround
* for JERSEY-2636, to ensure requests without a Content-Type get routed here.
* This qs value does not parse with newer versions of Jersey, as qs values
* must be between 0 and 1. We use qs=1.000 to mark where this historical
* anomaly had been.
*
* @param contentDisposition the content Disposition value
* @param requestContentType the request content type
* @param slug the slug value
* @param requestBodyStream the request body stream
* @param link the link value
* @param digest the digest header
* @return 201
* @throws InvalidChecksumException if invalid checksum exception occurred
* @throws IOException if IO exception occurred
* @throws MalformedRdfException if malformed rdf exception occurred
*/
@POST
@Consumes({MediaType.APPLICATION_OCTET_STREAM + ";qs=1.000", WILDCARD})
@Produces({TURTLE_WITH_CHARSET + ";qs=1.0", JSON_LD + ";qs=0.8",
N3_WITH_CHARSET, N3_ALT2_WITH_CHARSET, RDF_XML, NTRIPLES, TEXT_PLAIN_WITH_CHARSET,
TURTLE_X, TEXT_HTML_WITH_CHARSET, "*/*"})
public Response createObject(@HeaderParam(CONTENT_DISPOSITION) final ContentDisposition contentDisposition,
@HeaderParam(CONTENT_TYPE) final MediaType requestContentType,
@HeaderParam("Slug") final String slug,
@ContentLocation final InputStream requestBodyStream,
@HeaderParam(LINK) final String link,
@HeaderParam("Digest") final String digest)
throws InvalidChecksumException, IOException, MalformedRdfException {
LOGGER.info("POST: {}", externalPath);
final ContainerService containerService = getContainerService();
final URI resourceUri = createFromPath(externalPath);
//check that resource exists
if (!containerService.exists(resourceUri)) {
if (!isRoot(resourceUri)) {
return status(NOT_FOUND).build();
} else {
createRoot();
}
}
final String newResourceName = slug == null ? UUID.randomUUID().toString() : slug;
final String resourcePath = (isRoot(resourceUri) ? "" : resourceUri.getPath());
final URI newResourceUri = createFromPath(resourcePath + "/" + newResourceName);
final Container container = containerService.findOrCreate(newResourceUri);
final Model model = ModelFactory.createDefaultModel();
model.read(requestBodyStream, container.getIdentifier().toString(), "TTL");
final Stream<Triple> triples = model.listStatements().toList().stream().map(Statement::asTriple);
container.updateTriples(triples);
return created(toExternalURI(container.getIdentifier(), headers)).build();
}
示例8: updatePassword
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/updatepassword")
public Response updatePassword(@HeaderParam("token") String token, String body)
throws SQLException, Exception{
Gson gson = new Gson();
Usuario u = gson.fromJson(body, Usuario.class);
try {
if(!Verify(token, "admin") && !Verify(token, "user"))
return Response.status(Response.Status.UNAUTHORIZED)
.entity("Usuário ou senha incorretos").build();
} catch (Exception ex) {
return Resposta.retornar(400, ex.toString(), token);
}
int id = getSubject(token);
u.setId(id);
UsuarioDAO.updatePassword(u);
return Response.ok().build();
}
示例9: list
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
/**
* Roleリソースのルート.
* Boxの一覧を返す。
* @param authzHeader Authorization ヘッダ
* @return JAX-RS Response Object
*/
// @Path("")
@GET
public final Response list(
@HeaderParam(HttpHeaders.AUTHORIZATION) final String authzHeader) {
// アクセス制御
this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), CellPrivilege.AUTH_READ);
EntitiesResponse er = op.getEntities(Box.EDM_TYPE_NAME, null);
List<OEntity> loe = er.getEntities();
List<String> sl = new ArrayList<String>();
sl.add(BOX_PATH_CELL_LEVEL);
for (OEntity oe : loe) {
OProperty<String> nameP = oe.getProperty("Name", String.class);
sl.add(nameP.getValue());
}
StringBuilder sb = new StringBuilder();
for (String s : sl) {
sb.append(s + "<br/>");
}
return Response.ok().entity(sb.toString()).build();
}
示例10: get
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
/**
* returns a Tableau export for the dataset
* @return
* @throws DatasetNotFoundException
* @throws NamespaceException
*/
@GET
@Produces({APPLICATION_TDS, APPLICATION_TDS_DRILL})
public Response get(@HeaderParam(HttpHeaders.HOST) String host) throws DatasetNotFoundException, NamespaceException {
// make sure path exists
DatasetConfig datasetConfig = namespace.getDataset(datasetPath.toNamespaceKey());
ResponseBuilder builder = Response.ok().entity(datasetConfig);
if (host == null) {
return builder.build();
}
final String hostOnly;
int portIndex = host.indexOf(":");
if (portIndex == -1) {
hostOnly = host;
} else {
hostOnly = host.substring(0, portIndex);
}
builder.header(WebServer.X_DREMIO_HOSTNAME, hostOnly);
return builder.build();
}
示例11: launchEvent
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@GET
@Secured
@Path("/launchevent/{eventId}")
@Produces(MediaType.APPLICATION_XML)
public SessionInfo launchEvent(@HeaderParam("securityToken") String securityToken, @PathParam("eventId") int eventId) {
SessionInfo sessionInfo = new SessionInfo();
SecurityChallenge securityChallenge = new SecurityChallenge();
securityChallenge.setChallengeId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
securityChallenge.setLeftSize(14);
securityChallenge.setPattern("FFFFFFFFFFFFFFFF");
securityChallenge.setRightSize(50);
sessionInfo.setChallenge(securityChallenge);
sessionInfo.setEventId(eventId);
EventSessionEntity createEventSession = eventBO.createEventSession(eventId);
sessionInfo.setSessionId(createEventSession.getId());
tokenSessionBO.setActiveLobbyId(securityToken, 0L);
return sessionInfo;
}
示例12: logEvent
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@PUT
@Path("logEvent/{fn_event}")
public void logEvent(@HeaderParam("uid") String uid,
String message,
@PathParam("fn_event") String event)
throws Exception {
File dir = new File(Storage_Controller.getBaseFolder());
File log = new File(dir, "log.txt");
if(!log.exists()){
log.createNewFile();
}
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
String time = dateFormat.format(new Date());
BufferedWriter output = new BufferedWriter(new FileWriter(log, true));
// System.out.println("["+time+"]\t["+uid+"]\t["+event+"]\t"+message+"\n");
output.write("["+time+"]\t["+uid+"]\t["+event+"]\t"+message+"\n");
output.flush();
}
示例13: requestShipment
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@POST
@Path(LRAOperationAPI.REQUEST)
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_JSON)
@LRA(value = LRA.Type.REQUIRED)
public Response requestShipment(@HeaderParam(LRAClient.LRA_HTTP_HEADER) String lraUri, OrderInfo orderInfo) {
String lraId = LRAClient.getLRAId(lraUri);
log.info("processing request for LRA " + lraId);
shipmentService.computeShipment(lraId, orderInfo);
//stub for compensation scenario
if ("failShipment".equals(orderInfo.getProduct().getProductId())) {
return Response
.status(Response.Status.BAD_REQUEST)
.entity("Shipment for order " + orderInfo.getOrderId() + " failure")
.build();
}
return Response
.ok()
.entity(String.format("Shipment for order %s processed", orderInfo.getOrderId()))
.build();
}
示例14: graphDirectPut
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
/**
* Direct HTTP PUT
*
* @see <a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-put">
* Section 5.3 "HTTP PUT"
* </a>
* @param uriInfo JAX-RS {@link UriInfo} object
* @param type Content-Type HTTP header field
* @param chunked the "chunked" query parameter
* @param in HTTP body as {@link InputStream}
* @return "204 No Content", if operation was successful
*/
@PUT
@Consumes({
RDFMediaType.RDF_TURTLE,
RDFMediaType.RDF_YARS,
RDFMediaType.RDF_XML,
RDFMediaType.RDF_NTRIPLES,
RDFMediaType.RDF_XML
})
@Path("/{graph}")
public Response graphDirectPut(
@Context UriInfo uriInfo,
@HeaderParam("Content-Type") MediaType type,
@QueryParam("chunked") String chunked,
InputStream in) {
String graphuri = uriInfo.getAbsolutePath().toASCIIString();
return handleAdd(uriInfo, type, graphuri, null, in, chunked, true);
}
示例15: provideValue
import javax.ws.rs.HeaderParam; //导入依赖的package包/类
@Override
public Object provideValue(Parameter parameter, ContainerRequestContext requestContext, ObjectMapper objectMapper) {
Object returnValue;
String value = requestContext.getHeaderString(parameter.getAnnotation(HeaderParam.class).value());
if (value == null) {
return null;
}
else {
if (String.class.isAssignableFrom(parameter.getType())) {
returnValue = value;
}
else {
try {
returnValue = objectMapper.readValue(value, parameter.getType());
}
catch (IOException e) {
throw new IllegalStateException(e);
}
}
}
return returnValue;
}