Java 类javax.ws.rs.HeaderParam 实例源码
项目:neo4j-sparql-extension-yars
文件:GraphStore.java
/**
* 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);
}
项目:mid-tier
文件:AccountEventServiceExposure.java
@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);
}
项目:lambdora
文件:LambdoraLdp.java
/**
* Retrieve the repository resource profile
*
* @param rangeValue the range value
* @return a binary or the triples for the specified node
* @throws IOException if IO exception occurred
*/
@GET
@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 getResource(@HeaderParam("Range") final String rangeValue) throws IOException {
LOGGER.info("GET: {}", externalPath);
final URI internalURI = createFromPath(externalPath);
final Container container = getContainerService().find(internalURI);
if (container == null) {
if (!isRoot(internalURI)) {
return Response.status(Response.Status.NOT_FOUND).build();
} else {
return getResource(createRoot());
}
}
return getResource(container);
}
项目:lambdora
文件:LambdoraLdp.java
/**
* 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();
}
项目:SistemaAlmoxarifado
文件:UsuarioResource.java
@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();
}
项目:personium-core
文件:RoleResource.java
/**
* 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();
}
项目:dremio-oss
文件:TableauResource.java
/**
* 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();
}
项目:soapbox-race-core
文件:MatchMaking.java
@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;
}
项目:emr-nlp-server
文件:WSInterface.java
@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();
}
项目:lra-service
文件:ShipmentEndpoint.java
@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();
}
项目:neo4j-sparql-extension-yars
文件:GraphStore.java
/**
* 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);
}
项目:crnk-framework
文件:HeaderParamProvider.java
@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;
}
项目:lemon
文件:AndroidDeviceResource.java
@POST
@Path("checkLogin")
@Produces(MediaType.APPLICATION_JSON)
public BaseDTO checkLogin(@HeaderParam("sessionId") String sessionId) {
logger.info("sessionId : {}", sessionId);
PimDevice pimDevice = pimDeviceManager.findUniqueBy("sessionId",
sessionId);
logger.info("pimDevice : {}", pimDevice);
if (pimDevice == null) {
return null;
}
BaseDTO result = new BaseDTO();
result.setCode(200);
return result;
}
项目:mid-tier
文件:CustomerEventFeedMetadataServiceExposure.java
@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);
}
项目:mid-tier
文件:VirtualAccountServiceExposure.java
@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);
}
项目:mid-tier
文件:CustomerEventServiceExposure.java
@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);
}
项目:Equella
文件:FileResource.java
@PUT
@Path("/{uuid}/content/{filepath:(.*)}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Upload or replace a file")
public Response uploadOrReplaceFile(
//@formatter:off
@PathParam("uuid")
String stagingUuid,
@PathParam("filepath")
String filepath,
@QueryParam("append")
boolean append,
@ApiParam(value = APIDOC_UNZIPTO)
@QueryParam("unzipto")
String unzipTo,
@HeaderParam("content-length") @DefaultValue("-1")
long size,
@HeaderParam("content-type")
String contentType,
InputStream binaryData
//@formatter:on
) throws IOException;
项目:http-progressive-download-examples
文件:VideoResource.java
@GET
public Response get(@PathParam("id") String id, @Context Request request,
@HeaderParam("Range") Optional<String> range,
@HeaderParam("If-Range") Optional<String> ifRange) {
Optional<File> video = videosRepository.findById(id);
if (!video.isPresent()) return Response.status(NOT_FOUND).build();
Optional<Response> notModifiedResponse = evaluateRequestPreconditions(video.get(), request);
if (notModifiedResponse.isPresent()) return notModifiedResponse.get();
if (range.isPresent() && (!ifRange.isPresent() || ifRangePreconditionMatches(video.get(), ifRange.get())))
return videoPartResponse(video.get(), range.get());
return fullVideoResponse(video.get());
}
项目:mid-tier
文件:CustomerServiceExposure.java
@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);
}
项目:incubator-servicecomb-java-chassis
文件:JaxrsSwaggerGeneratorContext.java
@Override
protected void initParameterAnnotationMgr() {
super.initParameterAnnotationMgr();
parameterAnnotationMgr.register(PathParam.class, new PathParamAnnotationProcessor());
parameterAnnotationMgr.register(FormParam.class, new FormParamAnnotationProcessor());
parameterAnnotationMgr.register(CookieParam.class, new CookieParamAnnotationProcessor());
parameterAnnotationMgr.register(HeaderParam.class, new HeaderParamAnnotationProcessor());
parameterAnnotationMgr.register(QueryParam.class, new QueryParamAnnotationProcessor());
}
项目:launcher-backend
文件:OpenShiftResource.java
@GET
@Path("/clusters")
@Produces(MediaType.APPLICATION_JSON)
public JsonArray getSupportedOpenShiftClusters(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
@Context HttpServletRequest request) {
JsonArrayBuilder arrayBuilder = Json.createArrayBuilder();
Set<OpenShiftCluster> clusters = clusterRegistry.getClusters();
if (request.getParameterMap().containsKey("all") || openShiftServiceFactory.getDefaultIdentity().isPresent()) {
// Return all clusters
clusters
.stream()
.map(OpenShiftCluster::getId)
.forEach(arrayBuilder::add);
} else {
final KeycloakService keycloakService = this.keycloakServiceInstance.get();
clusters.parallelStream().map(OpenShiftCluster::getId)
.forEach(clusterId ->
keycloakService.getIdentity(clusterId, authorization)
.ifPresent(token -> arrayBuilder.add(clusterId)));
}
return arrayBuilder.build();
}
项目:launcher-backend
文件:ValidationResource.java
@HEAD
@Path("/repository/{repo}")
public Response repositoryExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization,
@NotNull @PathParam("repo") String repository) {
Identity identity = identities.getGitHubIdentity(authorization);
GitHubService gitHubService = gitHubServiceFactory.create(identity);
if (gitHubService.repositoryExists(gitHubService.getLoggedUser().getLogin() + "/" + repository)) {
return Response.ok().build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
}
项目:launcher-backend
文件:ValidationResource.java
@HEAD
@Path("/token/github")
public Response gitHubTokenExists(@HeaderParam(HttpHeaders.AUTHORIZATION) final String authorization) {
Identity identity = identities.getGitHubIdentity(authorization);
boolean tokenExists = (identity != null);
if (tokenExists) {
return Response.ok().build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
}
项目:personium-core
文件:ODataSvcCollectionResource.java
/**
* PROPFINDの処理.
* @param requestBodyXml リクエストボディ
* @param depth Depthヘッダ
* @param contentLength Content-Length ヘッダ
* @param transferEncoding Transfer-Encoding ヘッダ
* @return JAX-RS Response
*/
@WebDAVMethod.PROPFIND
public Response propfind(final Reader requestBodyXml,
@HeaderParam(PersoniumCoreUtils.HttpHeaders.DEPTH) final String depth,
@HeaderParam(HttpHeaders.CONTENT_LENGTH) final Long contentLength,
@HeaderParam("Transfer-Encoding") final String transferEncoding) {
// Access Control
this.davRsCmp.checkAccessContext(this.davRsCmp.getAccessContext(), BoxPrivilege.READ_PROPERTIES);
return this.davRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
BoxPrivilege.READ_ACL);
}
项目:SistemaAlmoxarifado
文件:UsuarioResource.java
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Path("/verify")
public Response verify(@HeaderParam("token") String token){
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);
}
return Response.status(Response.Status.OK).build();
}
项目:mid-tier
文件:AccountServiceExposure.java
@GET
@Path("{regNo}-{accountNo}")
@Produces({"application/hal+json", "application/hal+json;concept=account;v=1", "application/hal+json;concept=account;v=2"})
@ApiOperation(value = "gets the information from a single account", response = AccountRepresentation.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 = "customer", value = "customer allows getting own account"),
@ExtensionProperty(name = "advisor", value = "advisor allows getting every account")}
)},
produces = "application/hal+json, application/hal+json;concept=account;v=1, application/hal+json;concept=account;v=2",
notes = "obtain a single account back in a default projection, which is Account version 2" +
" Supported projections and versions are:" +
" AccountSparse in version1 and Account in version 2" +
" The format of the default version is .... - The Accept Header is not marked as required in the " +
"swagger - but it is needed - we are working on a solution to that", nickname = "getAccount")
@ApiResponses(value = {
@ApiResponse(code = 404, message = "No account found.")
})
public Response get(@Context UriInfo uriInfo, @Context Request request,
@PathParam("regNo") @Pattern(regexp = "^[0-9]{4}$") String regNo,
@PathParam("accountNo") @Pattern(regexp = "^[0-9]+$") String accountNo,
@HeaderParam("Accept") String accept) {
LOGGER.info("Default version of account collected");
return accountProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request, regNo, accountNo);
}
项目:SistemaAlmoxarifado
文件:UsuarioResource.java
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Path("/getid")
public Response getId(@HeaderParam("token") String token,
@QueryParam("id") int id) throws SQLException, Exception {
if(!Verify(token, "admin"))
return Response.status(Response.Status.UNAUTHORIZED).build();
Gson gson = new Gson();
Usuario u = UsuarioDAO.retreave(id);
return Response.status(Response.Status.OK)
.entity(gson.toJson(u)).build();
}
项目:mid-tier
文件:AccountEventServiceExposure.java
@GET
@Path("{category}")
@Produces({ "application/hal+json", "application/hal+json;concept=eventcategory;v=1"})
@ApiOperation(value = "obtain all events scoped to a certain category", 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, allowing for subscribers to have these grouped into categories",
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=eventcategory;v=1",
nickname = "getAccountEventsByCategory"
)
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response getByCategory(@Context UriInfo uriInfo, @Context Request request,
@HeaderParam("Accept") String accept, @PathParam("category") String category,
@QueryParam("interval") String interval) {
return eventCategoryProducers.getOrDefault(accept, this::handleUnsupportedContentType)
.getResponse(uriInfo, request, category, interval);
}
项目:mid-tier
文件:ReconciledTransactionServiceExposure.java
@GET
@Produces({ "application/hal+json", "application/hal+json;concept=reconciledtransactions;v=1"})
@ApiOperation(value = "obtain reconciled transactions (added API capabilities not though not implemented)",
response = ReconciledTransactionsRepresentation.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 = "customer", value = "customer allows getting from own account"),
@ExtensionProperty(name = "advisor", value = "advisor allows getting from every account")}
)},
tags = {"select", "sort", "elements", "interval", "filter", "embed", "decorator", "reconciled"},
notes = "obtain a list of all reconciled transactions from an account" +
"the reconciled transactions are user controlled checks and notes for transactions " +
"such as - Yes I have verified that this transaction was correct and thus it is reconciled",
produces = "application/hal+json, application/hal+json;concept=reconciledtransactions;v=1",
nickname = "listReconciledTransactions")
@ApiResponses(value = {
@ApiResponse(code = 415, message = "Content type not supported.")
})
public Response list(@Context UriInfo uriInfo, @Context Request request,
@HeaderParam("Accept") String accept, @PathParam("regNo") String regNo, @PathParam("accountNo") String accountNo
) {
return reconciledTxsProducers.getOrDefault(accept, this::handleUnsupportedContentType)
.getResponse(uriInfo, request, regNo, accountNo);
}
项目:personium-core
文件:FacadeResource.java
/**
* @param cookieAuthValue クッキー内の p_cookieキーに指定された値
* @param cookiePeer p_cookie_peerクエリに指定された値
* @param authzHeaderValue Authorization ヘッダ
* @param host Host ヘッダ
* @param xPersoniumUnitUser ヘッダ
* @param uriInfo UriInfo
* @return UnitCtlResourceオブジェクト
*/
@Path("__ctl")
public final UnitCtlResource ctl(
@CookieParam(P_COOKIE_KEY) final String cookieAuthValue,
@QueryParam(COOKIE_PEER_QUERY_KEY) final String cookiePeer,
@HeaderParam(HttpHeaders.AUTHORIZATION) final String authzHeaderValue,
@HeaderParam(HttpHeaders.HOST) final String host,
@HeaderParam(PersoniumCoreUtils.HttpHeaders.X_PERSONIUM_UNIT_USER) final String xPersoniumUnitUser,
@Context final UriInfo uriInfo) {
AccessContext ac = AccessContext.create(authzHeaderValue,
uriInfo, cookiePeer, cookieAuthValue, null, uriInfo.getBaseUri().toString(),
host, xPersoniumUnitUser);
return new UnitCtlResource(ac, uriInfo);
}
项目:personium-core
文件:CellSnapshotResource.java
/**
* process PROPFIND Method.
* @param requestBodyXml request body
* @param depth Depth Header
* @param contentLength Content-Length Header
* @param transferEncoding Transfer-Encoding Header
* @return JAX-RS response object
*/
@WebDAVMethod.PROPFIND
public Response propfind(Reader requestBodyXml,
@HeaderParam(PersoniumCoreUtils.HttpHeaders.DEPTH) String depth,
@HeaderParam(HttpHeaders.CONTENT_LENGTH) Long contentLength,
@HeaderParam("Transfer-Encoding") String transferEncoding) {
// Access Control
cellSnapshotCellRsCmp.checkAccessContext(cellSnapshotCellRsCmp.getAccessContext(), CellPrivilege.ROOT);
return cellSnapshotCellRsCmp.doPropfind(requestBodyXml, depth, contentLength, transferEncoding,
CellPrivilege.ROOT);
}
项目:mid-tier
文件:LocationServiceExposure.java
@GET
@Path("{latitude}-{longitude}")
@Produces({"application/hal+json", "application/hal+json;concept=location;v=1", "application/hal+json;concept=location;v=2"})
@ApiOperation(value = "gets the information from a single position", response = LocationRepresentation.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 = "customer", value = "customer allows getting own information"),
@ExtensionProperty(name = "advisor", value = "advisor allows getting all information")}
)},
produces = "application/hal+json, application/hal+json;concept=location;v=1, application/hal+json;concept=location;v=2",
notes = "obtain a single customer back in a default projection, which is Location version 2" +
" Supported projections and versions are:" +
" Location in version1 and Location in version 2" +
" The format of the default version is .... - The Accept Header is not marked as required in the " +
"swagger - but it is needed - we are working on a solution to that", nickname = "getLocation")
@ApiResponses(value = {
@ApiResponse(code = 404, message = "location not found.")
})
public Response get(@Context UriInfo uriInfo, @Context Request request,
@PathParam("latitude") @Pattern(regexp = "^[0-9]+.[0-9]+,[0-9]*$") String latitude,
@PathParam("longitude") @Pattern(regexp = "^[0-9]+.[0-9]+,[0-9]*$") String longitude,
@HeaderParam("Accept") String accept) {
LOGGER.info("Default version of location collected");
return locationProducers.getOrDefault(accept, this::handleUnsupportedContentType)
.getResponse(uriInfo, request, latitude, longitude);
}
项目:soapbox-race-core
文件:Catalog.java
@GET
@Secured
@Path("/categories")
@Produces(MediaType.APPLICATION_XML)
public ArrayOfCategoryTrans categories(@HeaderParam("securityToken") String securityToken) {
Long activePersonaId = tokenBO.getActivePersonaId(securityToken);
ArrayOfCategoryTrans arrayOfCategoryTrans = new ArrayOfCategoryTrans();
List<CategoryEntity> listCategoryEntity = productBO.categories();
for (CategoryEntity entity : listCategoryEntity) {
CategoryTrans categoryTrans = new CategoryTrans();
categoryTrans.setCatalogVersion(Integer.parseInt(entity.getCatalogVersion()));
categoryTrans.setDisplayName(entity.getDisplayName());
categoryTrans.setFilterType(entity.getFilterType());
categoryTrans.setIcon(entity.getIcon());
categoryTrans.setId(entity.getIdentifiant().toString());
categoryTrans.setLongDescription(entity.getLongDescription());
categoryTrans.setName(entity.getName());
categoryTrans.setPriority(entity.getPriority());
categoryTrans.setProducts(productBO.getVinylByCategory(entity, activePersonaId));
categoryTrans.setShortDescription(entity.getShortDescription());
categoryTrans.setShowInNavigationPane(entity.getShowInNavigationPane());
categoryTrans.setShowPromoPage(entity.getShowPromoPage());
categoryTrans.setWebIcon(entity.getWebIcon());
arrayOfCategoryTrans.getCategoryTrans().add(categoryTrans);
}
return arrayOfCategoryTrans;
}
项目:soapbox-race-core
文件:Events.java
@GET
@Secured
@Path("/notifycoincollected")
@Produces(MediaType.APPLICATION_XML)
public String notifyCoinCollected(@HeaderParam("securityToken") String securityToken, @QueryParam("coins") Integer coins) {
Long activePersonaId = tokenSessionBO.getActivePersonaId(securityToken);
return eventsBO.notifyCoinCollected(activePersonaId, coins);
}
项目:sig-seguimiento-vehiculos
文件:SGFRegisteredPointService.java
@GET
@Consumes("application/json")
@Produces("application/json")
@Path("vehicles/{vehicleId}/registered-points")
String getLastRegisteredPoints(@HeaderParam("Authorization") String authorization,
@PathParam("vehicleId") int id,
@QueryParam("size")int size,
@QueryParam("sort")String sort);
项目:abhot
文件:MetricsResource.java
@OPTIONS
@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
@Path("/tagnames")
public Response corsPreflightTagNames(@HeaderParam("Access-Control-Request-Headers") final String requestHeaders,
@HeaderParam("Access-Control-Request-Method") final String requestMethod)
{
ResponseBuilder responseBuilder = getCorsPreflightResponseBuilder(requestHeaders, requestMethod);
return (responseBuilder.build());
}
项目:soapbox-race-core
文件:Events.java
@GET
@Secured
@Path("/gettreasurehunteventsession")
@Produces(MediaType.APPLICATION_XML)
public TreasureHuntEventSession getTreasureHuntEventSession(@HeaderParam("securityToken") String securityToken) {
Long activePersonaId = tokenSessionBO.getActivePersonaId(securityToken);
return eventsBO.getTreasureHuntEventSession(activePersonaId);
}
项目:sig-seguimiento-vehiculos
文件:GitHubFileService.java
@PUT
@Path("/contents/{path}/{fileName}")
@Produces("application/json; charset=utf-8")
@Consumes("application/json; charset=utf-8")
@GZIP
public GitHubResponse createFile(@PathParam("user") String user,
@PathParam("repository") String repository,
@PathParam("path") String path,
@PathParam("fileName") String fileName,
@HeaderParam("Authorization") String authorization,
GitHubCreateFileRequest content);
项目:sig-seguimiento-vehiculos
文件:SGFCompanyService.java
@GET
@Consumes("application/json")
@Path("/{id}/registered-points")
String getLastRegisteredPoints(@HeaderParam("Authorization") String authorization,
@PathParam("id") int id,
@QueryParam("imei")String imei,
@QueryParam("size")int size,
@QueryParam("sort")String sort);
项目:soapbox-race-core
文件:User.java
@POST
@Secured
@Path("GetPermanentSession")
@Produces(MediaType.APPLICATION_XML)
public UserInfo getPermanentSession(@HeaderParam("userId") Long userId) {
tokenBO.deleteByUserId(userId);
String randomUUID = tokenBO.createToken(userId);
UserInfo userInfo = userBO.getUserById(userId);
userInfo.getUser().setSecurityToken(randomUUID);
userBO.createXmppUser(userInfo);
return userInfo;
}