org.restlet.data.Request.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.restlet.data.Request.<init>方法的一些代码示例,展示了Request.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.<init>方法的具体详情如下:
包路径:org.restlet.data.Request
类名称:Request
方法名:<init>

Request.<init>介绍

[英]Constructor.
[中]建造师。

代码示例

代码示例来源:origin: org.restlet/org.restlet

/**
 * Gets the identified resource without its representation's content.
 * 
 * @param resourceRef
 *            The reference of the resource to get.
 * @return The response.
 */
public final Response head(Reference resourceRef) {
  return handle(new Request(Method.HEAD, resourceRef));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Puts a representation in the identified resource.
 * 
 * @param resourceUri
 *            The URI of the resource to modify.
 * @param entity
 *            The entity to put.
 * @return The response.
 */
public final Response put(String resourceUri, Representation entity) {
  return handle(new Request(Method.PUT, resourceUri, entity));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Gets the identified resource.
 * 
 * @param resourceRef
 *            The reference of the resource to get.
 * @return The response.
 */
public final Response get(Reference resourceRef) {
  return handle(new Request(Method.GET, resourceRef));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Deletes the identified resource.
 * 
 * @param resourceRef
 *            The reference of the resource to delete.
 * @return The response.
 */
public final Response delete(Reference resourceRef) {
  return handle(new Request(Method.DELETE, resourceRef));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Deletes the identified resource.
 * 
 * @param resourceUri
 *            The URI of the resource to delete.
 * @return The response.
 */
public final Response delete(String resourceUri) {
  return handle(new Request(Method.DELETE, resourceUri));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Gets the identified resource.
 * 
 * @param resourceUri
 *            The URI of the resource to get.
 * @return The response.
 */
public final Response get(String resourceUri) {
  return handle(new Request(Method.GET, resourceUri));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Gets the options for the identified resource.
 * 
 * @param resourceUri
 *            The URI of the resource to get.
 * @return The response.
 */
public final Response options(String resourceUri) {
  return handle(new Request(Method.OPTIONS, resourceUri));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Gets the identified resource without its representation's content.
 * 
 * @param resourceUri
 *            The URI of the resource to get.
 * @return The response.
 */
public final Response head(String resourceUri) {
  return handle(new Request(Method.HEAD, resourceUri));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Gets the options for the identified resource.
 * 
 * @param resourceRef
 *            The reference of the resource to get.
 * @return The response.
 */
public final Response options(Reference resourceRef) {
  return handle(new Request(Method.OPTIONS, resourceRef));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Posts a representation to the identified resource.
 * 
 * @param resourceRef
 *            The reference of the resource to post to.
 * @param entity
 *            The entity to post.
 * @return The response.
 */
public final Response post(Reference resourceRef, Representation entity) {
  return handle(new Request(Method.POST, resourceRef, entity));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Posts a representation to the identified resource.
 * 
 * @param resourceUri
 *            The URI of the resource to post to.
 * @param entity
 *            The entity to post.
 * @return The response.
 */
public final Response post(String resourceUri, Representation entity) {
  return handle(new Request(Method.POST, resourceUri, entity));
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Puts a representation in the identified resource.
 * 
 * @param resourceRef
 *            The reference of the resource to modify.
 * @param entity
 *            The entity to put.
 * @return The response.
 */
public final Response put(Reference resourceRef, Representation entity) {
  return handle(new Request(Method.PUT, resourceRef, entity));
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testGetByIdHTML() throws Exception {
  Request req = new Request();
  Response res = new Response(req);
  
  RequestResource.HTMLFormat format = 
    new RequestResource.HTMLFormat(req, res, resource, monitor);
  
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  format.toRepresentation(monitor.getDAO().getRequest(2)).write(out);
  
  assertTrue(new String(out.toByteArray()).startsWith("<html>"));
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testGetAll() throws Exception {
  Request req = new Request();
  Response res = new Response(req);
  
  resource.init(null, req, res);
  Query q = (Query) resource.handleObjectGet();
  
  assertEquals(monitor.getDAO().getRequests().size(), 
    monitor.getDAO().getRequests(q).size());
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testGetById() throws Exception {
  Request req = new Request();
  req.getAttributes().put("request", 2);
  
  Response res = new Response(req);
  
  resource.init(null, req, res);
  RequestData data = (RequestData) resource.handleObjectGet();
  assertEquals("/two", data.getPath());
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testFilterIn() throws Exception {
  Request req = new Request();
  setKVP(req, "filter", "path:IN:/seven,/six,/five");
  
  Response res = new Response(req);
  resource.init(null, req, res);
  
  Query q = (Query) resource.handleObjectGet();
  List<RequestData> datas = (List<RequestData>) monitor.getDAO().getRequests(q);
  
  assertCovered(datas, 5, 6, 7);
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testGetDateRange() throws Exception {
  Request req = new Request();
  setKVP(req, "from", "2010-07-23T15:56:44", "to", "2010-07-23T16:16:44");
  
  Response res = new Response(req);
  resource.init(null, req, res);
  
  Query q = (Query) resource.handleObjectGet();
  List<RequestData> datas = (List<RequestData>) monitor.getDAO().getRequests(q);
  
  assertCoveredInOrder(datas, 6, 5, 4);
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testFilter() throws Exception {
  Request req = new Request();
  setKVP(req, "filter", "path:EQ:/seven");
  
  Response res = new Response(req);
  resource.init(null, req, res);
  
  Query q = (Query) resource.handleObjectGet();
  List<RequestData> datas = (List<RequestData>) monitor.getDAO().getRequests(q);
  
  assertCoveredInOrder(datas, 7);
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testFilterStatus() throws Exception {
  Request req = new Request();
  setKVP(req, "filter", "status:EQ:WAITING");
  
  Response res = new Response(req);
  resource.init(null, req, res);
  
  Query q = (Query) resource.handleObjectGet();
  List<RequestData> datas = (List<RequestData>) monitor.getDAO().getRequests(q);
  
  assertCovered(datas, 2,6);
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testLive() throws Exception {
  Request req = new Request();
  setKVP(req, "live", "yes");
  
  Response res = new Response(req);
  resource.init(null, req, res);
  
  Query q = (Query) resource.handleObjectGet();;
  List<RequestData> datas = monitor.getDAO().getRequests(q); 
  
  assertCovered(datas, 1, 2, 5, 6, 9, 10);
}

相关文章