小编cas*_*lin的帖子

如何在jekyll上显示我主页上的最新帖子?

<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)

这显示了我的所有帖子,我只想展示最新的帖子.

templates templating liquid-layout liquid jekyll

48
推荐指数
3
解决办法
1万
查看次数

如何使用java在Selenium WebDriver中处理iframe

<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(&quot;/libs/cq/ui/widgets/themes/default/ext/form/text-bg.gif&quot;); background-repeat: repeat-x; background-attachment: fixed;">
        <p>4t43t4<br></p>
      </body >
    </iframe>
  </iframe>    
</div> 
Run Code Online (Sandbox Code Playgroud)

在这种情况下有一个iframeiframe.而且我必须选择外部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']找不到元素.

我尝试使用索引,父,亲,但没有运气. …

java iframe selenium selenium-webdriver

36
推荐指数
4
解决办法
13万
查看次数

ThreadLocal的目的?

这里给出的ThreadLocal的目的表明该变量是访问包含ThreadLocal变量的对象的任何Thread的本地变量.将ThreadLocal变量作为类的成员然后将其作为Thread的本地变量而不是将本地变量赋予Thread本身,它会有什么不同?

java multithreading thread-local

33
推荐指数
4
解决办法
2万
查看次数

在Maven中成功构建仍然在Eclipse中显示错误

我在这里有一些非常特殊的东西,当我输入"mvn clean install"时,我的构建在maven中成功,但是一旦导入到Eclipse中它就会显示错误.

你自己看:

mvn clean install

日食

我想从`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)

编辑

如你所见,石英在这里: 石英

java eclipse maven ejb-3.0

33
推荐指数
6
解决办法
6万
查看次数

什么是HTTP方法的幂等性?

我已阅读HTTP文档,但我无法理解Idempotency是什么.请有人帮帮忙.提前致谢.

http

28
推荐指数
2
解决办法
2万
查看次数

使用JAX-RS在一个位置记录请求和响应

我有一个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)

java rest jax-rs resteasy

27
推荐指数
1
解决办法
3万
查看次数

在Eclipse中导入具有相同名称的多个项目

我在不同的目录中有多个具有相同名称的项目.

如何在Eclipse中的相​​同工作区中导入它们?

java eclipse

25
推荐指数
4
解决办法
2万
查看次数

什么是restTemplate.exchange()方法?

实际上这个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)

rest resttemplate

25
推荐指数
3
解决办法
6万
查看次数

我可以使用@Context注释注入哪些对象?

我是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实现的代码.

java jax-rs jersey

25
推荐指数
3
解决办法
4万
查看次数

来自REST的Access Request对象

是否可以在JAX-RS下的REST方法中访问Request对象?

我刚刚发现

@Context Request request;
Run Code Online (Sandbox Code Playgroud)

java web-services

24
推荐指数
2
解决办法
5万
查看次数