Examples of SWORDErrorDocument


Examples of org.purl.sword.base.SWORDErrorDocument

   * @throws IOException
   */
  protected void makeErrorDocument(String errorURI, int status, String summary,
                             HttpServletRequest request, HttpServletResponse response) throws IOException
  {
    SWORDErrorDocument sed = new SWORDErrorDocument(errorURI);
    Title title = new Title();
    title.setContent("ERROR");
    sed.setTitle(title);
    Calendar calendar = Calendar.getInstance();
    String utcformat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
    SimpleDateFormat zulu = new SimpleDateFormat(utcformat);
    String serializeddate = zulu.format(calendar.getTime());
    sed.setUpdated(serializeddate);
    Summary sum = new Summary();
    sum.setContent(summary);
    sed.setSummary(sum);
    if (request.getHeader(HttpHeaders.USER_AGENT.toString()) != null) {
      sed.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT.toString()));
    }
    response.setStatus(status);
      response.setContentType("application/atom+xml; charset=UTF-8");
    PrintWriter out = response.getWriter();
      out.write(sed.marshall().toXML());
    out.flush();
  }
View Full Code Here

Examples of org.purl.sword.base.SWORDErrorDocument

   * @throws IOException
   */
  protected void makeErrorDocument(String errorURI, int status, String summary,
                             HttpServletRequest request, HttpServletResponse response) throws IOException
  {
    SWORDErrorDocument sed = new SWORDErrorDocument(errorURI);
    Title title = new Title();
    title.setContent("ERROR");
    sed.setTitle(title);
    Calendar calendar = Calendar.getInstance();
    String utcformat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
    SimpleDateFormat zulu = new SimpleDateFormat(utcformat);
    String serializeddate = zulu.format(calendar.getTime());
    sed.setUpdated(serializeddate);
    Summary sum = new Summary();
    sum.setContent(summary);
    sed.setSummary(sum);
    if (request.getHeader(HttpHeaders.USER_AGENT.toString()) != null) {
      sed.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT.toString()));
    }
    response.setStatus(status);
      response.setContentType("application/atom+xml; charset=UTF-8");
    PrintWriter out = response.getWriter();
      out.write(sed.marshall().toXML());
    out.flush();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.