Package org.jboss.jdf.examples.pastecode.model

Examples of org.jboss.jdf.examples.pastecode.model.CodeFragment


    private final CodeFragment codeFragmentPrototype;

    private int page = 0;

    public History() {
        this.codeFragmentPrototype = new CodeFragment();
    }
View Full Code Here


    @Inject
    private CodeFragmentManager codeFragmentManager;

    public PasteWindow() {
        this.codeFragment = new CodeFragment();
        this.theme = Theme.DEFAULT;
    }
View Full Code Here

                throw new RuntimeException("No such fragment!");
            } else {
                return fragments.get(0);
            }
        } else {
            CodeFragment c = entityManager.find(CodeFragment.class, Long.parseLong(id));
            if (c == null) {
                throw new RuntimeException("No such fragment!");
            }
            // If no hash was set, then this is not a private fragment, return it!
            if (c.getHash() == null) {
                return c;
            } else {
                throw new RuntimeException("Access denied!");
            }
        }
View Full Code Here

    private CodeFragmentManager codeFragmentManager;

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        CodeFragment c = codeFragmentManager.getCodeFragment(id);
        String fileName = c.getUser() + "." + c.getLanguage();
        String txt = c.getText();

        response.setContentType("text/plain");
        response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
        response.setContentLength(txt.length());
View Full Code Here

TOP

Related Classes of org.jboss.jdf.examples.pastecode.model.CodeFragment

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.