Rest API的Java日期如下:周一,1990年1月1日00:00:00 GMT

时间:2018-06-04 06:26:08

标签: java rest

在我的Java代码中,我有这个:

<div class="container">


  <div>
  
    <div class="panel-group wrap" id="accordion" role="tablist" aria-multiselectable="true">
      <div class="panel">
        <div class="panel-heading" role="tab" id="headingOne">
          <h4 class="panel-title">
        <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
        tt
       <i class="material-icons add-icon add">add</i>
       <i class="material-icons add-icon remove">remove</i>
        </a>
      </h4>
        </div>
        <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
          <div class="panel-body">
            tekst
          </div>
        </div>
      </div>
      <!-- end of panel -->

      <div class="panel">
        <div class="panel-heading" role="tab" id="headingTwo">
          <h4 class="panel-title">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
         text
          <i class="material-icons add-icon add">add</i>
          <i class="material-icons add-icon remove">remove</i>
        </a>
      </h4>
        </div>
        <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
          <div class="panel-body">
           tekst tekst
          </div>
        </div>
      </div>
      <!-- end of panel -->

      <div class="panel">
        <div class="panel-heading" role="tab" id="headingThree">
          <h4 class="panel-title">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
         tee
          <i class="material-icons add-icon add">add</i>
          <i class="material-icons add-icon remove">remove</i>
        </a>
      </h4>
        </div>
        <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
          <div class="panel-body">
            tekst tekst
          </div>
        </div>
      </div>
      <!-- end of panel -->

   
      <!-- end of panel -->

    </div>

但是将过期日期设置回来是否正确?它不应该像现在+ 1小时或什么?

如何正确获取日期格式(1990年1月1日星期一00:00:00 GMT)?

1 个答案:

答案 0 :(得分:0)

过去指定Expire - 标题是完全正确的。正如您从代码段的其他标题中看到的那样,客户端根本不应该缓存页面。

三个给定的标题都表示相同(冗余),但有些用于较旧的HTTP规范(例如https://stackoverflow.com/a/10314289/1164913https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires

如果要启用资源缓存,则需要查找RFC-850日期格式。 (https://tools.ietf.org/html/rfc7231#section-7.1.1.1引用https://tools.ietf.org/html/rfc5322#section-3.3,源自https://tools.ietf.org/html/rfc850#section-2.1.4