@Override
    protected void doGet(final HttpServletRequest _req,
                         final HttpServletResponse _res)
        throws ServletException
    {
        HelpServlet.LOG.debug("Recieved Request for Help Servlet: {}", _req);
        try {
            final List<String> wikis = new ArrayList<String>();
            String path = _req.getPathInfo().substring(1);
            final String end = path.substring(path.lastIndexOf("."), path.length());
            if (end.equalsIgnoreCase(".png") || end.equalsIgnoreCase(".jpg") || end.equalsIgnoreCase(".jpeg")
                            || end.equalsIgnoreCase(".gif")) {
                final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiImage);
                queryBldr.addWhereAttrEqValue("Name", path);
                final MultiPrintQuery multi = queryBldr.getPrint();
                multi.addAttribute("FileLength");
                multi.execute();
                if (multi.next()) {
                    final Long length = multi.<Long>getAttribute("FileLength");
                    final Checkout checkout = new Checkout(multi.getCurrentInstance());
                    _res.setContentType(getServletContext().getMimeType(end));
                    _res.setContentLength(length.intValue());
                    _res.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000));
                    _res.setHeader("Cache-Control", "max-age=3600");
                    checkout.execute(_res.getOutputStream());
                    checkout.close();
                }
            } else {
                if (!path.contains(".")) {
                    String referer = _req.getHeader("Referer");
                    if (referer.contains(":")) {
                        final String[] paths = referer.split(":");
                        referer = paths[0];
                    }
                    final String[] pack = referer.substring(referer.lastIndexOf("/") + 1).split("\\.");
                    final StringBuilder newPath = new StringBuilder();
                    for (int i = 0; i < pack.length - 2; i++) {
                        newPath.append(pack[i]).append(".");
                    }
                    newPath.append(path).append(".wiki");
                    path = newPath.toString();
                    wikis.add(path);
                } else if (path.contains(":")) {
                    final String[] paths = path.split(":");
                    for (final String apath : paths) {
                        wikis.add(apath);
                    }
                } else {
                    wikis.add(path);
                }

                final String menuStr;
                if (Context.getThreadContext().containsSessionAttribute(HelpServlet.MENU_SESSION_KEY)) {
                    menuStr = (String) Context.getThreadContext().getSessionAttribute(HelpServlet.MENU_SESSION_KEY);
                } else {
                    menuStr = getMenu();
                    Context.getThreadContext().setSessionAttribute(HelpServlet.MENU_SESSION_KEY, menuStr);
                }

                final StringBuilder html = new StringBuilder();
                html.append("<html><head>")
                    .append("<script type=\"text/javascript\" src=\"../../wicket/resource/")
                    .append(AbstractDojoBehavior.JS_DOJO.getScope().getName()).append("/")
                    .append(AbstractDojoBehavior.JS_DOJO.getName())
                    .append("\" data-dojo-config=\"async: true,parseOnLoad: true\"></script>\n")
                    .append("<script type=\"text/javascript\" >")
                    .append("/*<![CDATA[*/\n")
                    .append("require([\"dijit/layout/BorderContainer\",\"dijit/layout/ContentPane\",")
                    .append(" \"dojo/parser\"]);\n")
                    .append("/*]]>*/")
                    .append("</script>\n")
                    .append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../wicket/resource/")
                    .append(AbstractDojoBehavior.CSS_TUNDRA.getScope().getName()).append("/")
                    .append(AbstractDojoBehavior.CSS_TUNDRA.getName())
                    .append("\" />")
                    .append("<link rel=\"stylesheet\" type=\"text/css\" ")
                    .append(" href=\"../../servlet/static/org.efaps.help.Help.css?")
                    .append("\" />")
                    .append("</head><body>")
                    .append("<div data-dojo-type=\"dijit/layout/BorderContainer\" ")
                    .append("data-dojo-props=\"design: &#039;sidebar&#039;\"")
                    .append(" class=\"tundra\" ")
                    .append("style=\"width: 100%; height: 99%;\">")
                    .append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
                    .append("data-dojo-props=\"region: &#039;leading&#039;,splitter: true\" ")
                    .append("style=\"width: 200px\">")
                    .append("<div class=\"eFapsHelpMenu\">")
                    .append(menuStr)
                    .append("</div></div>")
                    .append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
                    .append("data-dojo-props=\"region: &#039;center&#039;\" ")
                    .append("><div class=\"eFapsWikiPage\">");

                for (final String wiki : wikis) {
                    final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiCompiled);
                    queryBldr.addWhereAttrEqValue("Name", wiki);
                    final InstanceQuery query = queryBldr.getQuery();
                    query.execute();
                    if (query.next()) {
                        final Checkout checkout = new Checkout(query.getCurrentValue());
                        final InputStreamReader in = new InputStreamReader(checkout.execute(), "UTF8");
                        if (in != null) {
                            final BufferedReader reader = new BufferedReader(in);
                            String line = null;
                            while ((line = reader.readLine()) != null) {
                                html.append(line);
                            }
                        }
                    }
                }
                html.append("</div></div></body></html>");
                _res.setContentType("text/html;charset=UTF-8");
                _res.setContentLength(html.length());
                _res.getOutputStream().write(html.toString().getBytes("UTF8"));
            }
        } catch (final EFapsException e) {
            throw new ServletException(e);
        } catch (final IOException e) {
            throw new ServletException(e);
        }
    }
@Override
    protected void doGet(final HttpServletRequest _req,
                         final HttpServletResponse _res)
        throws ServletException
    {
        HelpServlet.LOG.debug("Recieved Request for Help Servlet: {}", _req);
        try {
            final List<String> wikis = new ArrayList<String>();
            String path = _req.getPathInfo().substring(1);
            final String end = path.substring(path.lastIndexOf("."), path.length());
            if (end.equalsIgnoreCase(".png") || end.equalsIgnoreCase(".jpg") || end.equalsIgnoreCase(".jpeg")
                            || end.equalsIgnoreCase(".gif")) {
                final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiImage);
                queryBldr.addWhereAttrEqValue("Name", path);
                final MultiPrintQuery multi = queryBldr.getPrint();
                multi.addAttribute("FileLength");
                multi.execute();
                if (multi.next()) {
                    final Long length = multi.<Long>getAttribute("FileLength");
                    final Checkout checkout = new Checkout(multi.getCurrentInstance());
                    _res.setContentType(getServletContext().getMimeType(end));
                    _res.setContentLength(length.intValue());
                    _res.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000));
                    _res.setHeader("Cache-Control", "max-age=3600");
                    checkout.execute(_res.getOutputStream());
                    checkout.close();
                }
            } else {
                if (!path.contains(".")) {
                    String referer = _req.getHeader("Referer");
                    if (referer.contains(":")) {
                        final String[] paths = referer.split(":");
                        referer = paths[0];
                    }
                    final String[] pack = referer.substring(referer.lastIndexOf("/") + 1).split("\\.");
                    final StringBuilder newPath = new StringBuilder();
                    for (int i = 0; i < pack.length - 2; i++) {
                        newPath.append(pack[i]).append(".");
                    }
                    newPath.append(path).append(".wiki");
                    path = newPath.toString();
                    wikis.add(path);
                } else if (path.contains(":")) {
                    final String[] paths = path.split(":");
                    for (final String apath : paths) {
                        wikis.add(apath);
                    }
                } else {
                    wikis.add(path);
                }

                final String menuStr;
                if (Context.getThreadContext().containsSessionAttribute(HelpServlet.MENU_SESSION_KEY)) {
                    menuStr = (String) Context.getThreadContext().getSessionAttribute(HelpServlet.MENU_SESSION_KEY);
                } else {
                    menuStr = getMenu();
                    Context.getThreadContext().setSessionAttribute(HelpServlet.MENU_SESSION_KEY, menuStr);
                }

                final StringBuilder html = new StringBuilder();
                html.append("<html><head>")
                    .append("<script type=\"text/javascript\" src=\"../../wicket/resource/")
                    .append(AbstractDojoBehavior.JS_DOJO.getScope().getName()).append("/")
                    .append(AbstractDojoBehavior.JS_DOJO.getName())
                    .append("\" data-dojo-config=\"async: true,parseOnLoad: true\"></script>\n")
                    .append("<script type=\"text/javascript\" >")
                    .append("\n")
                    .append("require([\"dijit/layout/BorderContainer\",\"dijit/layout/ContentPane\",")
                    .append(" \"dojo/parser\"]);\n")
                    .append("")
                    .append("</script>\n")
                    .append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../wicket/resource/")
                    .append(AbstractDojoBehavior.CSS_TUNDRA.getScope().getName()).append("/")
                    .append(AbstractDojoBehavior.CSS_TUNDRA.getName())
                    .append("\" />")
                    .append("<link rel=\"stylesheet\" type=\"text/css\" ")
                    .append(" href=\"../../servlet/static/org.efaps.help.Help.css?")
                    .append("\" />")
                    .append("</head><body>")
                    .append("<div data-dojo-type=\"dijit/layout/BorderContainer\" ")
                    .append("data-dojo-props=\"design: &#039;sidebar&#039;\"")
                    .append(" class=\"tundra\" ")
                    .append("style=\"width: 100%; height: 99%;\">")
                    .append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
                    .append("data-dojo-props=\"region: &#039;leading&#039;,splitter: true\" ")
                    .append("style=\"width: 200px\">")
                    .append("<div class=\"eFapsHelpMenu\">")
                    .append(menuStr)
                    .append("</div></div>")
                    .append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
                    .append("data-dojo-props=\"region: &#039;center&#039;\" ")
                    .append("><div class=\"eFapsWikiPage\">");

                for (final String wiki : wikis) {
                    final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiCompiled);
                    queryBldr.addWhereAttrEqValue("Name", wiki);
                    final InstanceQuery query = queryBldr.getQuery();
                    query.execute();
                    if (query.next()) {
                        final Checkout checkout = new Checkout(query.getCurrentValue());
                        final InputStreamReader in = new InputStreamReader(checkout.execute(), "UTF8");
                        if (in != null) {
                            final BufferedReader reader = new BufferedReader(in);
                            String line = null;
                            while ((line = reader.readLine()) != null) {
                                html.append(line);
                            }
                        }
                    }
                }
                html.append("</div></div></body></html>");
                _res.setContentType("text/html;charset=UTF-8");
                _res.setContentLength(html.length());
                _res.getOutputStream().write(html.toString().getBytes("UTF8"));
            }
        } catch (final EFapsException e) {
            throw new ServletException(e);
        } catch (final IOException e) {
            throw new ServletException(e);
        }
    }
@ Override protected void doGet ( final HttpServletRequest _req , final HttpServletResponse _res ) throws ServletException { HelpServlet . LOG . debug ( "Recieved Request for Help Servlet: {}" , _req ) ; try { final List < String > wikis = new ArrayList < String > ( ) ; String path = _req . getPathInfo ( ) . substring ( 1 ) ; final String end = path . substring ( path . lastIndexOf ( "." ) , path . length ( ) ) ; if ( end . equalsIgnoreCase ( ".png" ) || end . equalsIgnoreCase ( ".jpg" ) || end . equalsIgnoreCase ( ".jpeg" ) || end . equalsIgnoreCase ( ".gif" ) ) { final QueryBuilder queryBldr = new QueryBuilder ( CIAdminProgram . WikiImage ) ; queryBldr . addWhereAttrEqValue ( "Name" , path ) ; final MultiPrintQuery multi = queryBldr . getPrint ( ) ; multi . addAttribute ( "FileLength" ) ; multi . execute ( ) ; if ( multi . next ( ) ) { final Long length = multi . < Long > getAttribute ( "FileLength" ) ; final Checkout checkout = new Checkout ( multi . getCurrentInstance ( ) ) ; _res . setContentType ( getServletContext ( ) . getMimeType ( end ) ) ; _res . setContentLength ( length . intValue ( ) ) ; _res . setDateHeader ( "Expires" , System . currentTimeMillis ( ) + ( 3600 * 1000 ) ) ; _res . setHeader ( "Cache-Control" , "max-age=3600" ) ; checkout . execute ( _res . getOutputStream ( ) ) ; checkout . close ( ) ; } } else { if ( ! path . contains ( "." ) ) { String referer = _req . getHeader ( "Referer" ) ; if ( referer . contains ( ":" ) ) { final String [ ] paths = referer . split ( ":" ) ; referer = paths [ 0 ] ; } final String [ ] pack = referer . substring ( referer . lastIndexOf ( "/" ) + 1 ) . split ( "\\." ) ; final StringBuilder newPath = new StringBuilder ( ) ; for ( int i = 0 ; i < pack . length - 2 ; i ++ ) { newPath . append ( pack [ i ] ) . append ( "." ) ; } newPath . append ( path ) . append ( ".wiki" ) ; path = newPath . toString ( ) ; wikis . add ( path ) ; } else if ( path . contains ( ":" ) ) { final String [ ] paths = path . split ( ":" ) ; for ( final String apath : paths ) { wikis . add ( apath ) ; } } else { wikis . add ( path ) ; } final String menuStr ; if ( Context . getThreadContext ( ) . containsSessionAttribute ( HelpServlet . MENU_SESSION_KEY ) ) { menuStr = ( String ) Context . getThreadContext ( ) . getSessionAttribute ( HelpServlet . MENU_SESSION_KEY ) ; } else { menuStr = getMenu ( ) ; Context . getThreadContext ( ) . setSessionAttribute ( HelpServlet . MENU_SESSION_KEY , menuStr ) ; } final StringBuilder html = new StringBuilder ( ) ; html . append ( "<html><head>" ) . append ( "<script type=\"text/javascript\" src=\"../../wicket/resource/" ) . append ( AbstractDojoBehavior . JS_DOJO . getScope ( ) . getName ( ) ) . append ( "/" ) . append ( AbstractDojoBehavior . JS_DOJO . getName ( ) ) . append ( "\" data-dojo-config=\"async: true,parseOnLoad: true\"></script>\n" ) . append ( "<script type=\"text/javascript\" >" ) . append ( "/*<![CDATA[*/\n" ) . append ( "require([\"dijit/layout/BorderContainer\",\"dijit/layout/ContentPane\"," ) . append ( " \"dojo/parser\"]);\n" ) . append ( "/*]]>*/" ) . append ( "</script>\n" ) . append ( "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../wicket/resource/" ) . append ( AbstractDojoBehavior . CSS_TUNDRA . getScope ( ) . getName ( ) ) . append ( "/" ) . append ( AbstractDojoBehavior . CSS_TUNDRA . getName ( ) ) . append ( "\" />" ) . append ( "<link rel=\"stylesheet\" type=\"text/css\" " ) . append ( " href=\"../../servlet/static/org.efaps.help.Help.css?" ) . append ( "\" />" ) . append ( "</head><body>" ) . append ( "<div data-dojo-type=\"dijit/layout/BorderContainer\" " ) . append ( "data-dojo-props=\"design: &#039;sidebar&#039;\"" ) . append ( " class=\"tundra\" " ) . append ( "style=\"width: 100%; height: 99%;\">" ) . append ( "<div data-dojo-type=\"dijit/layout/ContentPane\" " ) . append ( "data-dojo-props=\"region: &#039;leading&#039;,splitter: true\" " ) . append ( "style=\"width: 200px\">" ) . append ( "<div class=\"eFapsHelpMenu\">" ) . append ( menuStr ) . append ( "</div></div>" ) . append ( "<div data-dojo-type=\"dijit/layout/ContentPane\" " ) . append ( "data-dojo-props=\"region: &#039;center&#039;\" " ) . append ( "><div class=\"eFapsWikiPage\">" ) ; for ( final String wiki : wikis ) { final QueryBuilder queryBldr = new QueryBuilder ( CIAdminProgram . WikiCompiled ) ; queryBldr . addWhereAttrEqValue ( "Name" , wiki ) ; final InstanceQuery query = queryBldr . getQuery ( ) ; query . execute ( ) ; if ( query . next ( ) ) { final Checkout checkout = new Checkout ( query . getCurrentValue ( ) ) ; final InputStreamReader in = new InputStreamReader ( checkout . execute ( ) , "UTF8" ) ; if ( in != null ) { final BufferedReader reader = new BufferedReader ( in ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { html . append ( line ) ; } } } } html . append ( "</div></div></body></html>" ) ; _res . setContentType ( "text/html;charset=UTF-8" ) ; _res . setContentLength ( html . length ( ) ) ; _res . getOutputStream ( ) . write ( html . toString ( ) . getBytes ( "UTF8" ) ) ; } } catch ( final EFapsException e ) { throw new ServletException ( e ) ; } catch ( final IOException e ) { throw new ServletException ( e ) ; } }
The method checks the file from the object out and returns them in a
output stream to the web client. The object id must be given with
paramter {@link #PARAM_OID}.<br/>

@param _req request variable
@param _res response variable
@throws ServletException on error
The method checks the file from the object out and returns them in a output stream to the web client . The object id must be given with paramter { @link #PARAM_OID } . <br / >