Java 类javax.ws.rs.MatrixParam 实例源码
项目:ozark
文件:MvcConverterProvider.java
private static String getParamName(Annotation[] annotations) {
for (Annotation annotation : annotations) {
if (annotation instanceof QueryParam) {
return ((QueryParam) annotation).value();
}
if (annotation instanceof PathParam) {
return ((PathParam) annotation).value();
}
if (annotation instanceof FormParam) {
return ((FormParam) annotation).value();
}
if (annotation instanceof MatrixParam) {
return ((MatrixParam) annotation).value();
}
if (annotation instanceof CookieParam) {
return ((CookieParam) annotation).value();
}
}
return null;
}
项目:ozark
文件:ConstraintViolationMetadata.java
public Optional<String> getParamName() {
for (Annotation annotation : annotations) {
if (annotation instanceof QueryParam) {
return Optional.of(((QueryParam) annotation).value());
}
if (annotation instanceof PathParam) {
return Optional.of(((PathParam) annotation).value());
}
if (annotation instanceof FormParam) {
return Optional.of(((FormParam) annotation).value());
}
if (annotation instanceof MatrixParam) {
return Optional.of(((MatrixParam) annotation).value());
}
if (annotation instanceof CookieParam) {
return Optional.of(((CookieParam) annotation).value());
}
}
return Optional.empty();
}
项目:resteasy-examples
文件:MyResource.java
@Path("foo/{param}-{other}")
@GET
public String getFooParam(@PathParam("param") String param,
@PathParam("other") String other,
@QueryParam("q") String q,
@CookieParam("c") String c,
@HeaderParam("h") String h,
@MatrixParam("m") String m,
@Context UriInfo ignore)
{
StringBuffer buf = new StringBuffer();
buf.append("param").append("=").append(param).append(";");
buf.append("other").append("=").append(other).append(";");
buf.append("q").append("=").append(q).append(";");
buf.append("c").append("=").append(c).append(";");
buf.append("h").append("=").append(h).append(";");
buf.append("m").append("=").append(m).append(";");
return buf.toString();
}
项目:resteasy-examples
文件:MyResource.java
@Path("foo/{param}-{other}")
@PUT
public String putFooParam(@PathParam("param") String param,
@PathParam("other") String other,
@QueryParam("q") String q,
@CookieParam("c") String c,
@HeaderParam("h") String h,
@MatrixParam("m") String m,
String entity,
@Context UriInfo ignore)
{
StringBuffer buf = new StringBuffer();
buf.append("param").append("=").append(param).append(";");
buf.append("other").append("=").append(other).append(";");
buf.append("q").append("=").append(q).append(";");
buf.append("c").append("=").append(c).append(";");
buf.append("h").append("=").append(h).append(";");
buf.append("m").append("=").append(m).append(";");
buf.append("entity").append("=").append(entity).append(";");
return buf.toString();
}
项目:typescript-generator
文件:JaxrsApplicationParser.java
private static MethodParameterModel getEntityParameter(Method method) {
for (Parameter parameter : method.getParameters()) {
if (!hasAnyAnnotation(parameter, Arrays.asList(
MatrixParam.class,
QueryParam.class,
PathParam.class,
CookieParam.class,
HeaderParam.class,
Context.class,
FormParam.class
))) {
return new MethodParameterModel(parameter.getName(), parameter.getParameterizedType());
}
}
return null;
}
项目:java-ee
文件:UserResource.java
@Path("{id}")
@GET
@Produces(APPLICATION_JSON)
public Response getUser(@PathParam("id") String id,
@MatrixParam("type") String type) {
List<? extends User> u = userService.getUsersByType(type);
if (u != null) {
Optional<? extends User> o = u.stream()
.filter(user -> user.getUserId().equals(id)).findAny();
if (o.isPresent()) {
return ok().entity(o.get()).build();
}
}
return noContent().status(NOT_FOUND).build();
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_origin_realm_blacklist_add")
public String diameter_origin_realm_blacklist_add(@MatrixParam("realm") String realm) {
DiameterFirewallConfig.diameter_origin_realm_blacklist.put(realm, "");
return "Successful";
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_origin_realm_blacklist_remove")
public String diameter_origin_realm_blacklist_remove(@MatrixParam("realm") String realm) {
DiameterFirewallConfig.diameter_origin_realm_blacklist.remove(realm);
return "Successful";
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_application_id_whitelist_add")
public String diameter_application_id_whitelist_add(@MatrixParam("ai") int ai) {
DiameterFirewallConfig.diameter_application_id_whitelist.put((new Integer(ai)).toString(), "");
return "Successful";
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_application_id_whitelist_remove")
public String diameter_application_id_whitelist_remove(@MatrixParam("ai") int ai) {
DiameterFirewallConfig.diameter_application_id_whitelist.remove((new Integer(ai)).toString());
return "Successful";
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_command_code_blacklist_add")
public String diameter_command_code_blacklist_add(@MatrixParam("cc") int cc) {
DiameterFirewallConfig.diameter_command_code_blacklist.put((new Integer(cc)).toString(), "");
return "Successful";
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("diameter_command_code_blacklist_remove")
public String diameter_command_code_blacklist_remove(@MatrixParam("cc") int cc) {
DiameterFirewallConfig.diameter_command_code_blacklist.remove((new Integer(cc)).toString());
return "Successful";
}
项目:SigFW
文件:DiameterFirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("eval_diameter_message_in_ids")
public String eval_diameter_message_in_ids(@MatrixParam("diameter_raw") String diameter_raw) {
return "1";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("sccp_calling_gt_blacklist_add")
public String sccp_calling_gt_blacklist_add(@MatrixParam("gt") String gt) {
SS7FirewallConfig.sccp_calling_gt_blacklist.put(gt, "");
return "Successful";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("sccp_calling_gt_blacklist_remove")
public String sccp_calling_gt_blacklist_remove(@MatrixParam("gt") String gt) {
SS7FirewallConfig.sccp_calling_gt_blacklist.remove(gt);
return "Successful";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("tcap_oc_blacklist_add")
public String tcap_oc_blacklist_add(@MatrixParam("oc") int oc) {
SS7FirewallConfig.tcap_oc_blacklist.put((new Integer(oc)).toString(), "");
return "Successful";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("tcap_oc_blacklist_remove")
public String tcap_oc_blacklist_remove(@MatrixParam("oc") int oc) {
SS7FirewallConfig.tcap_oc_blacklist.remove((new Integer(oc)).toString());
return "Successful";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("map_cat2_oc_blacklist_add")
public String map_cat2_oc_blacklist_add(@MatrixParam("oc") int oc) {
SS7FirewallConfig.map_cat2_oc_blacklist.put((new Integer(oc)).toString(), "");
return "Successful";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("map_cat2_oc_blacklist_remove")
public String map_cat2_oc_blacklist_remove(@MatrixParam("oc") int oc) {
SS7FirewallConfig.map_cat2_oc_blacklist.remove((new Integer(oc)).toString());
return "Successful";
}
项目:SigFW
文件:SS7FirewallAPI_V1_0.java
@GET
@Consumes("text/plain")
@Produces("text/plain")
@Path("eval_sccp_message_in_ids")
public String eval_sccp_message_in_ids(@MatrixParam("sccp_raw") String sccp_raw) {
return "1";
}
项目:rest.vertx
文件:TestMatrixParamRest.java
@GET
@Path("extract/{param}")
public String add(@PathParam("param") String param, @MatrixParam("one") int one, @MatrixParam("two") int two) {
int result = one + two;
return param + "=" + result;
}
项目:JAX-RS
文件:AnnotationDemo.java
@GET
@Path("/annotation")
public String annotations(@MatrixParam("matrix") String matrixValue,
@HeaderParam("customHeader") String headerValue,
@CookieParam("name") String value) {
return "matrixValue is : " + matrixValue + " header value :"
+ headerValue + " Cookie param : " + value;
}
项目:ozark
文件:UriTemplateParser.java
/**
* <p>Parses given method and constructs a {@link UriTemplate} containing
* all the information found in the annotations {@link javax.ws.rs.Path},
* {@link javax.ws.rs.QueryParam} and {@link javax.ws.rs.MatrixParam}.</p>
*/
UriTemplate parseMethod(Method method, String basePath) {
UriBuilder uriBuilder = UriBuilder.fromPath(basePath);
Path controllerPath = AnnotationUtils.getAnnotation(method.getDeclaringClass(), Path.class);
if (controllerPath != null) {
uriBuilder.path(controllerPath.value());
}
Path methodPath = AnnotationUtils.getAnnotation(method, Path.class);
if (methodPath != null) {
uriBuilder.path(methodPath.value());
}
UriTemplate.Builder uriTemplateBuilder = UriTemplate.fromTemplate(uriBuilder.toTemplate());
// Populate a List with all properties of given target and all parameters of given method
// except for BeanParams where we need all properties of annotated type.
List<AnnotatedElement> annotatedElements = BeanUtils.getFieldsAndAccessors(method.getDeclaringClass());
Arrays.asList(method.getParameters()).forEach(param -> {
if (param.isAnnotationPresent(BeanParam.class)) {
annotatedElements.addAll(BeanUtils.getFieldsAndAccessors(param.getType()));
} else {
annotatedElements.add(param);
}
});
annotatedElements.forEach(accessibleObject -> {
if (accessibleObject.isAnnotationPresent(QueryParam.class)) {
uriTemplateBuilder.queryParam(accessibleObject.getAnnotation(QueryParam.class).value());
}
if (accessibleObject.isAnnotationPresent(MatrixParam.class)) {
uriTemplateBuilder.matrixParam(accessibleObject.getAnnotation(MatrixParam.class).value());
}
});
return uriTemplateBuilder.build();
}
项目:resteasy-examples
文件:CarResource.java
@GET
@Path("/matrix/{make}/{model}/{year}")
@Produces("text/plain")
public String getFromMatrixParam(@PathParam("make") String make,
@PathParam("model") PathSegment car,
@MatrixParam("color") Color color,
@PathParam("year") String year)
{
return "A " + color + " " + year + " " + make + " " + car.getPath();
}
项目:resteasy-examples
文件:CarResource.java
@GET
@Path("/matrix/{make}/{model}/{year}")
@Produces("text/plain")
public String getFromMatrixParam(@PathParam("make") String make,
@PathParam("model") PathSegment car,
@MatrixParam("color") Color color,
@PathParam("year") String year)
{
return "A " + color + " " + year + " " + make + " " + car.getPath();
}
项目:autorest
文件:AutoRestGwtProcessor.java
public boolean isParam(VariableElement a) {
return a.getAnnotation(CookieParam.class) == null
&& a.getAnnotation(FormParam.class) == null
&& a.getAnnotation(HeaderParam.class) == null
&& a.getAnnotation(MatrixParam.class) == null
&& a.getAnnotation(PathParam.class) == null
&& a.getAnnotation(QueryParam.class) == null;
}
项目:jersey-jax-rs-examples
文件:MatrixUriResource.java
@SuppressWarnings({ "unchecked", "rawtypes" })
@GET
public Map getRequestCookie(@MatrixParam("scale") Integer scale, @MatrixParam("type") String type) {
Map matrixParams = new HashMap();
matrixParams.put("latitude", latitude);
matrixParams.put("longitude", longitude);
matrixParams.put("scale", scale);
matrixParams.put("type", type);
return matrixParams;
}
项目:JavaIncrementalParser
文件:MyResource.java
@GET
@Path("matrix")
@Produces("text/plain")
public String getList(@MatrixParam("start") int start, @MatrixParam("end") int end) {
StringBuilder builder = new StringBuilder();
builder
.append("start: ")
.append(start)
.append("<br>end: ")
.append(end);
return builder.toString();
}
项目:jersey2-restfull-examples
文件:MatrixParamRestService.java
/**
* http://localhost:8080/v1/api/matrix/2014
* http://localhost:8080/v1/api/matrix/2014;author=scott
* http://localhost:8080/v1/api/matrix/2014;author=scott;country=china
* @param year
* @param author
* @param country
* @return
*/
@GET
@Path("{year}")
public Response getBooks(@PathParam("year") String year,
@MatrixParam("author") String author,
@MatrixParam("country") String country) {
return Response
.status(200)
.entity("getBooks is called, year : " + year
+ ", author : " + author + ", country : " + country)
.build();
}
项目:link-rest
文件:GET_Related_IT.java
@GET
@Path("e17/e18s")
public DataResponse<E18> getChildren(
@Context UriInfo uriInfo,
@MatrixParam("parentId1") Integer parentId1,
@MatrixParam("parentId2") Integer parentId2) {
Map<String, Object> parentIds = new HashMap<>();
parentIds.put(E17.ID1_PK_COLUMN, parentId1);
parentIds.put(E17.ID2_PK_COLUMN, parentId2);
return LinkRest.select(E18.class, config).parent(E17.class, parentIds, E17.E18S.getName()).uri(uriInfo).get();
}
项目:link-rest
文件:POST_Related_IT.java
@POST
@Path("e17/e18s")
public DataResponse<E18> createOrUpdateE18s(
@Context UriInfo uriInfo,
@MatrixParam("parentId1") Integer parentId1,
@MatrixParam("parentId2") Integer parentId2,
String targetData) {
Map<String, Object> parentIds = new HashMap<>();
parentIds.put(E17.ID1_PK_COLUMN, parentId1);
parentIds.put(E17.ID2_PK_COLUMN, parentId2);
return LinkRest.createOrUpdate(E18.class, config).toManyParent(E17.class, parentIds, E17.E18S).uri(uriInfo)
.syncAndSelect(targetData);
}
项目:java-ee
文件:UserResource.java
@GET
@Produces(APPLICATION_JSON)
public Response getUsers(@MatrixParam("type") String type) {
List<? extends User> u = userService.getUsersByType(type);
if (u != null) {
return ok().entity(u).build();
}
return noContent().status(NOT_FOUND).build();
}
项目:rest.vertx
文件:TestMatrixParamRest.java
@GET
@Path("direct/{placeholder:.*}")
public int add(@MatrixParam("one") int one, @MatrixParam("two") int two) {
return one + two;
}
项目:ozark
文件:ParameterController.java
@GET
@Path("matrix")
@UriRef("matrix-params")
public String matrixParams(@MatrixParam("m1") String m1, @MatrixParam("m2") long m2) {
return "uri-builder.jsp";
}
项目:ozark
文件:UriBuilderTestControllers.java
@GET
@Path("matrix")
public String matrixParams(@MatrixParam("m1") String m1, @MatrixParam("m2") long m2) {
return null;
}
项目:ozark
文件:UriBuilderTestControllers.java
@MatrixParam("m2")
public String getM2() {
return m2;
}
项目:ozark
文件:UriBuilderTestControllers.java
@MatrixParam("m3")
public void setM3(String m3) {
this.m3 = m3;
}
项目:alchemy-rest-client-generator
文件:AlchemyRestClientFactory.java
/**
* Create the path for the rest method.
*
* @param methodMetaData
* the method meta data.
* @param arguments
* the method arguments, used to add matrix and path
* parameters to the generated path.
* @return the absolute remote rest path for this method invocation.
*/
private String getPath(final RestMethodMetadata methodMetaData, final Object[] arguments) {
final UriBuilder uriBuilder = UriBuilder.fromPath(baseUri);
if (!StringUtils.isBlank(restInterfaceMetadata.getPath())) {
uriBuilder.path(restInterfaceMetadata.getPath());
}
if (!StringUtils.isBlank(methodMetaData.getPath())) {
uriBuilder.path(methodMetaData.getPath());
}
// add matrix parameters to the path
final Annotation[][] parameterAnnotations = methodMetaData.getParameterAnnotations();
final Map<String, Object> pathParamsMap = new LinkedHashMap<String, Object>();
for (int i = 0; i < parameterAnnotations.length && i < arguments.length; i++) {
final Annotation[] annotations = parameterAnnotations[i];
final Object argument = arguments[i];
for (final Annotation annotation : annotations) {
if (annotation instanceof MatrixParam) {
final String name = ((MatrixParam) annotation).value();
Object[] values = new Object[] {};
if (argument != null && argument.getClass().isArray()) {
values = (Object[]) argument;
} else if (argument instanceof Collection) {
@SuppressWarnings("unchecked")
final Collection<Object> collection = (Collection<Object>) argument;
values = collection.toArray();
} else {
values = new Object[] { argument };
}
uriBuilder.matrixParam(name, values);
} else if (annotation instanceof PathParam) {
pathParamsMap.put(((PathParam) annotation).value(), argument);
}
}
}
// add path params to the path
return uriBuilder.buildFromMap(pathParamsMap).toString();
}
项目:alchemy-rest-client-generator
文件:TestWebserviceWithPathStub.java
@Path("/echoMatrixParams")
@Produces({ "application/json" })
@Consumes({ "application/json" })
@GET
public int[] echoMatrixParams(@MatrixParam("param1") final int arg0,
@MatrixParam("param2") final int arg1, @MatrixParam("param3") final int arg2);