1
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.servlet.StringServletResponse;
18 import com.liferay.taglib.util.IncludeTag;
19
20 import javax.servlet.RequestDispatcher;
21 import javax.servlet.ServletContext;
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24 import javax.servlet.jsp.JspException;
25
26
32 public class WebDAVTag extends IncludeTag {
33
34 public static void doTag(
35 String path, ServletContext servletContext,
36 HttpServletRequest request, HttpServletResponse response)
37 throws Exception {
38
39 doTag(_PAGE, path, servletContext, request, response);
40 }
41
42 public static void doTag(
43 String page, String path, ServletContext servletContext,
44 HttpServletRequest request, HttpServletResponse response)
45 throws Exception {
46
47 request.setAttribute("liferay-ui:webdav:path", path);
48
49 RequestDispatcher requestDispatcher =
50 servletContext.getRequestDispatcher(page);
51
52 requestDispatcher.include(request, response);
53 }
54
55 public int doEndTag() throws JspException {
56 try {
57 ServletContext servletContext = getServletContext();
58 HttpServletRequest request = getServletRequest();
59 StringServletResponse stringResponse = getServletResponse();
60
61 doTag(getPage(), _path, servletContext, request, stringResponse);
62
63 pageContext.getOut().print(stringResponse.getString());
64
65 return EVAL_PAGE;
66 }
67 catch (Exception e) {
68 throw new JspException(e);
69 }
70 }
71
72 public void setPath(String path) {
73 _path = path;
74 }
75
76 protected String getDefaultPage() {
77 return _PAGE;
78 }
79
80 private static final String _PAGE = "/html/taglib/ui/webdav/page.jsp";
81
82 private String _path;
83
84 }