org.restlet.Request.toString()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(116)

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

Request.toString介绍

[英]Displays a synthesis of the request like an HTTP request line.
[中]显示请求的合成,如HTTP请求行。

代码示例

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

@Override
public String toString() {
  return wrappedRequest.toString();
}

代码示例来源:origin: stackoverflow.com

InputStream input = connectionSocket.getInputStream();
   OutputStream output = connectionSocket.getOutputStream();
   Request request = null;
   while ((request = Request.parseDelimitedFrom(input)) != null) {
     System.out.println(request.toString());
   }

代码示例来源:origin: stackoverflow.com

// Create an interceptor which catches requests and logs the info you want
RequestInterceptor logRequests= new RequestInterceptor() {
 public Request execute(Request request) {
  Log.i("REQUEST INFO", request.toString());
  return request; // return the request unaltered
 }
};

OkHttpClient client = new OkHttpClient();
List<RequestInterceptor> requestInterceptors = client.requestInterceptors();
requestInterceptros.add(logRequests);

代码示例来源:origin: stackoverflow.com

public static void post(){
   try {
     StringBuilder http = new StringBuilder();
     http.append("https://maps.googleapis.com/maps/api/geocode/json");
     http.append("?");
     http.append("key=myAppKey");
     http.append("&");
     http.append("address=Sidney");
     Request maps = Request.Post(http.toString());
     System.out.println(maps.toString());
     Response mapsResponse = maps.execute();
     Content resp = mapsResponse.returnContent();
     String response = resp.toString();
     System.out.println(response);
   } catch (ClientProtocolException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }

代码示例来源:origin: stackoverflow.com

public void handle(Request request, Response response) {
  response.setEntity("Request will be handled", MediaType.TEXT_PLAIN);
 if(!request.toString().contains("favicon")){
   System.out.println("do stuff");

代码示例来源:origin: stackoverflow.com

.addHeader(AUTH_TOKEN_HEADER, authToken);
} catch (ClassCastException e) {
  throw new ClassCastException(mRequest.toString()
      + " must implement " + AuthorizableRequest.class.getSimpleName());

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

@Override
  public String toString() {
    return (getRequest() == null ? "" : getRequest().toString())
        + (getResponse() == null ? "" : " => "
            + getResponse().toString());
  }
}

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

@Override
protected void afterHandle(Request request, Response response) {
  if (response.getStatus() != Status.REDIRECTION_NOT_MODIFIED) {
    if (UMLG.get().isTransactionActive()) {
      logger.log(Level.SEVERE, "Transaction is still active! Request = " + request.toString());
    }
    UMLG.get().rollback();
    UMLG.get().afterThreadContext();
  }
}

相关文章