<ul class="entries">
{% for post in paginator.posts %}
<li>
<a href="{{ post.url }}">
<h3>{{ post.title }}</h3>
<p class="blogdate">{{ post.date | date: "%d %B %Y" }}</p>
<div>{{ post.content |truncatehtml | truncatewords: 60 }}</div>
</a>
</li>
{% endfor %}
</ul>
Run Code Online (Sandbox Code Playgroud)
这显示了我的所有帖子,我只想展示最新的帖子.
<div>
<iframe id="cq-cf-frame ">
<iframe id="gen367">
<body spellcheck="false" id="CQrte" style="height: 255px; font-size: 12px; font-family:tahoma,arial,helvetica,sans-serif; background-image: url("/libs/cq/ui/widgets/themes/default/ext/form/text-bg.gif"); background-repeat: repeat-x; background-attachment: fixed;">
<p>4t43t4<br></p>
</body >
</iframe>
</iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
在这种情况下有一个iframe
下iframe
.而且我必须选择外部iframe
去内部iframe
并写入内部的身体iframe
.
接下来,我必须从内iframe
到外出来iframe
并单击OK按钮(位于外部iframe
).
以下是我的代码
/*Line 1 */ driver.switchTo().frame("cq-cf-frame");
/* 2 */ driver.findElement(By.css("#extdd-9 > div.tblRow > input.edititem").click();
/* 3 */ driver.switchTo().Frame("cq-gen379");
/* 4 */ driver.findElement(By.id("CQrte").sendKeys("Tnx");
/* 5 */ selenium.selectFrame("relative=up");
/* 6 */ driver.findElement(By.xpath("//button[text()='OK']")).click();
Run Code Online (Sandbox Code Playgroud)
以下是我的问题:
我的测试代码工作正常,直到第4行,即写入正文,但我想从内到外出来,iframe
它说//button[text()='OK']
找不到元素.
我尝试使用索引,父,亲,但没有运气. …
这里给出的ThreadLocal的目的表明该变量是访问包含ThreadLocal变量的对象的任何Thread的本地变量.将ThreadLocal变量作为类的成员然后将其作为Thread的本地变量而不是将本地变量赋予Thread本身,它会有什么不同?
我在这里有一些非常特殊的东西,当我输入"mvn clean install"时,我的构建在maven中成功,但是一旦导入到Eclipse中它就会显示错误.
你自己看:
我想从`pom.xml中排除石英解决了问题,但我想知道原因.
PS:以下是pom.xml
你想要看到它的情况:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.thongvan.mpclient</groupId>
<artifactId>MyClient</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyClient</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.thongvan.mp</groupId>
<artifactId>MyEjb</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>5.1.0.GA</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
如你所见,石英在这里:
我有一个RESTEasy Web服务器,有很多方法.我希望实现logback来跟踪所有请求和响应,但我不想添加log.info()
到每个方法.
也许有办法在一个地方捕获请求和响应并记录它.也许类似于RESTEasy上的HTTP请求流程链上的过滤器.
@Path("/rest")
@Produces("application/json")
public class CounterRestService {
//Don't want use log in controler every method to track requests and responces
static final Logger log = LoggerFactory.getLogger(CounterRestService.class);
@POST
@Path("/create")
public CounterResponce create(@QueryParam("name") String name) {
log.info("create "+name)
try {
CounterService.getInstance().put(name);
log.info("responce data"); // <- :((
return new CounterResponce();
} catch (Exception e){
log.info("responce error data"); // <- :((
return new CounterResponce("error", e.getMessage());
}
}
@POST
@Path("/insert")
public CounterResponce create(Counter counter) {
try {
CounterService.getInstance().put(counter);
return new CounterResponce(); …
Run Code Online (Sandbox Code Playgroud) 我在不同的目录中有多个具有相同名称的项目.
如何在Eclipse中的相同工作区中导入它们?
实际上这个restTemplate.exchange()
方法做了什么?
@RequestMapping(value = "/getphoto", method = RequestMethod.GET)
public void getPhoto(@RequestParam("id") Long id, HttpServletResponse response) {
logger.debug("Retrieve photo with id: " + id);
// Prepare acceptable media type
List<MediaType> acceptableMediaTypes = new ArrayList<MediaType>();
acceptableMediaTypes.add(MediaType.IMAGE_JPEG);
// Prepare header
HttpHeaders headers = new HttpHeaders();
headers.setAccept(acceptableMediaTypes);
HttpEntity<String> entity = new HttpEntity<String>(headers);
// Send the request as GET
ResponseEntity<byte[]> result =
restTemplate.exchange("http://localhost:7070/spring-rest-provider/krams/person/{id}",
HttpMethod.GET, entity, byte[].class, id);
// Display the image
Writer.write(response, result.getBody());
}
Run Code Online (Sandbox Code Playgroud) 我是JAX-RS的新手,我正在努力理解@Context
注释应该如何工作.
在javadoc的有六类(列表Application
,UriInfo
,Request
,HttpHeaders
,SecurityContext
,Providers
).但是,我在Web上找到了使用此注释与其他类型的代码,例如:
@GET
public String something(@Context HttpServletRequest req) {
}
Run Code Online (Sandbox Code Playgroud)
是否有可用于此注释的受支持类型列表?此列表是否在标准的实施之间发生变化?
我正在尝试使用Jersey,我担心我会编写无法移植到其他JAX-RS实现的代码.
是否可以在JAX-RS下的REST方法中访问Request对象?
我刚刚发现
@Context Request request;
Run Code Online (Sandbox Code Playgroud) java ×7
eclipse ×2
jax-rs ×2
rest ×2
ejb-3.0 ×1
http ×1
iframe ×1
jekyll ×1
jersey ×1
liquid ×1
maven ×1
resteasy ×1
resttemplate ×1
selenium ×1
templates ×1
templating ×1
thread-local ×1
web-services ×1