"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/com/openkm/servlet/SyntaxHighlighterServlet.java" between
OpenKM-document-management-system-6.3.10.tar.gz and OpenKM-document-management-system-6.3.11.tar.gz

About: OpenKM (Knowledge Management) is a document management system that allows easy management of documents, users, roles and finding your enterprise documents and records. Community version (source code).

SyntaxHighlighterServlet.java  (OpenKM-document-management-system-6.3.10):SyntaxHighlighterServlet.java  (OpenKM-document-management-system-6.3.11)
skipping to change at line 47 skipping to change at line 47
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
/** /**
* Syntax Highlighter Servlet * Syntax Highlighter Servlet
*/ */
public class SyntaxHighlighterServlet extends BaseServlet { public class SyntaxHighlighterServlet extends BaseServlet {
private static Logger log = LoggerFactory.getLogger(SyntaxHighlighterServ let.class); private static final Logger log = LoggerFactory.getLogger(SyntaxHighlight erServlet.class);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
public void doGet(HttpServletRequest request, HttpServletResponse respons e) throws IOException, ServletException { public void doGet(HttpServletRequest request, HttpServletResponse respons e) throws IOException, ServletException {
log.debug("doGet({}, {})", request, response); log.debug("doGet({}, {})", request, response);
String path = WebUtils.getString(request, "docPath"); String path = WebUtils.getString(request, "docPath");
String mimeType = WebUtils.getString(request, "mimeType"); String mimeType = WebUtils.getString(request, "mimeType");
String core = WebUtils.getString(request, "core"); String core = WebUtils.getString(request, "core");
String theme = WebUtils.getString(request, "theme"); String theme = WebUtils.getString(request, "theme");
CharsetDetector detector = new CharsetDetector(); CharsetDetector detector = new CharsetDetector();
InputStream fis = null; InputStream fis = null;
try { try {
fis = OKMDocument.getInstance().getContent(null, path, fa lse); fis = OKMDocument.getInstance().getContent(null, path, fa lse);
detector.setText(new BufferedInputStream(fis)); detector.setText(new BufferedInputStream(fis));
CharsetMatch cm = detector.detect(); CharsetMatch cm = detector.detect();
String content = cm.getString(); String content = cm.getString();
handlePreviewContent(request, response, mimeType, content , core, theme); handlePreviewContent(request, response, mimeType, content , core, theme);
} catch (PathNotFoundException e) { } catch (PathNotFoundException | AccessDeniedException | Database
sendErrorRedirect(request, response, e); Exception | RepositoryException | LockException e) {
} catch (AccessDeniedException e) {
sendErrorRedirect(request, response, e);
} catch (RepositoryException e) {
sendErrorRedirect(request, response, e);
} catch (DatabaseException e) {
sendErrorRedirect(request, response, e); sendErrorRedirect(request, response, e);
} finally { } finally {
IOUtils.closeQuietly(fis); IOUtils.closeQuietly(fis);
} }
} }
/** /**
* Used when syntax highlight * Used when syntax highlight
*/ */
private void sendHighlight(HttpServletRequest request, HttpServletRespons e response, String brushType, String brush, private void sendHighlight(HttpServletRequest request, HttpServletRespons e response, String brushType, String brush,
skipping to change at line 98 skipping to change at line 92
sc.setAttribute("brush", brush); sc.setAttribute("brush", brush);
sc.setAttribute("cssCore", core); sc.setAttribute("cssCore", core);
sc.setAttribute("cssTheme", theme); sc.setAttribute("cssTheme", theme);
sc.setAttribute("content", content); sc.setAttribute("content", content);
sc.getRequestDispatcher("/syntax_highlighter.jsp").forward(reques t, response); sc.getRequestDispatcher("/syntax_highlighter.jsp").forward(reques t, response);
} }
/** /**
* Used when no syntax highlight * Used when no syntax highlight
*/ */
private void sendContent(HttpServletRequest request, HttpServletResponse private void sendContent(HttpServletRequest request, HttpServletResponse
response, String content) throws ServletException, response, String content) throws IOException {
IOException {
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
out.print(content); out.print(content);
out.flush(); out.flush();
IOUtils.closeQuietly(out); IOUtils.closeQuietly(out);
} }
/** /**
* Handle syntax highlight representation * Handle syntax highlight representation
*/ */
private void handlePreviewContent(HttpServletRequest request, HttpServlet Response response, String mimeType, private void handlePreviewContent(HttpServletRequest request, HttpServlet Response response, String mimeType,
 End of changes. 3 change blocks. 
11 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)