Package org.purl.sword.base

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


   * @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

Related Classes of org.purl.sword.base.SWORDErrorDocument

Copyright © 2018 www.massapicom. 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.