本文整理了Java中spark.Request.url
方法的一些代码示例,展示了Request.url
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.url
方法的具体详情如下:
包路径:spark.Request
类名称:Request
方法名:url
[英]Returns the URL string
[中]返回URL字符串
代码示例来源:origin: perwendel/spark
@Override
public String url() {
return delegate.url();
}
代码示例来源:origin: com.sparkjava/spark-core
@Override
public String url() {
return delegate.url();
}
代码示例来源:origin: cinchapi/concourse
@Override
public String url() {
return delegate.url();
}
代码示例来源:origin: iNPUTmice/caas
/**
* Gets root url for a request
* e.g. if request url is "https://compliance.conversations.im/badge/conversations.im",
* it will return "https://compliance.conversations.im"
*
* @param request
* @return
*/
public static String getRootUrlFrom(Request request) {
String rootUrl = Configuration.getInstance().getRootURL();
if (rootUrl == null) {
final String url = request.url();
final String path = request.uri();
rootUrl = url.substring(0, url.length() - path.length());
}
return rootUrl;
}
代码示例来源:origin: cdelmas/microservices-comparison
public List<CarRepresentation> all(Request request, Response response) {
List<Car> cars = carRepository.all();
response.header("count", String.valueOf(cars.size()));
response.type("application/json");
return cars.stream().map(c -> {
CarRepresentation carRepresentation = new CarRepresentation(c);
carRepresentation.addLink(self(request.url() + "/" + c.getId()));
return carRepresentation;
}
).collect(toList());
}
代码示例来源:origin: dessalines/torrenttunes-client
public static void logRequestInfo(Request req) {
String origin = req.headers("Origin");
String origin2 = req.headers("origin");
String host = req.headers("Host");
log.debug("request host: " + host);
log.debug("request origin: " + origin);
log.debug("request origin2: " + origin2);
// System.out.println("origin = " + origin);
// if (DataSources.ALLOW_ACCESS_ADDRESSES.contains(req.headers("Origin"))) {
// res.header("Access-Control-Allow-Origin", origin);
// }
for (String header : req.headers()) {
log.debug("request header | " + header + " : " + req.headers(header));
}
log.debug("request ip = " + req.ip());
log.debug("request pathInfo = " + req.pathInfo());
log.debug("request host = " + req.host());
log.debug("request url = " + req.url());
}
代码示例来源:origin: cdelmas/microservices-comparison
public CarRepresentation byId(Request request, Response response) {
Optional<Car> car = carRepository.byId(Integer.parseInt(request.params(":id")));
return car.map(c -> {
response.type("application/json");
CarRepresentation carRepresentation = new CarRepresentation(c);
carRepresentation.addLink(self(request.url()));
return carRepresentation;
}
).orElseGet(() -> {
response.status(404);
return null;
});
}
代码示例来源:origin: cdelmas/microservices-comparison
public String createCar(Request request, Response response) {
Car car;
try {
car = objectMapper.readValue(request.body(), Car.class);
carRepository.save(car);
response.header("Location", request.url() + "/" + car.getId());
response.status(201);
} catch (IOException e) {
response.status(400);
}
return "";
}
}
代码示例来源:origin: yeriomin/token-dispenser
notFound("Not found");
before((req, res) -> {
LOG.info(req.requestMethod() + " " + req.url());
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Request-Method", "GET");
代码示例来源:origin: lamarios/Homedash2
res.header("Pragma", "no-cache"); // HTTP 1.0.
res.header("Expires", "0"); // Proxies.
logger.info("{} -> {}", req.requestMethod(), req.url());
代码示例来源:origin: langurmonkey/gaiasky
logger.debug(" servletPath = {}", request.servletPath());
logger.debug(" contextPath = {}", request.contextPath());
logger.debug(" url = {}", request.url());
logger.debug(" uri = {}", request.uri());
logger.debug(" protocol = {}", request.protocol());
内容来源于网络,如有侵权,请联系作者删除!