Package javax.servlet.http

Examples of javax.servlet.http.HttpServletResponse


     */
    protected void render(JspWriter out, TreeControlNode node,
                          int level, int width, boolean last)
        throws IOException {

        HttpServletResponse response =
            (HttpServletResponse) pageContext.getResponse();
   
        // if the node is root node and the label value is
        // null, then do not render root node in the tree.
       
        if ("ROOT-NODE".equalsIgnoreCase(node.getName()) &&
        (node.getLabel() == null)) {
            // Render the children of this node
            TreeControlNode children[] = node.findChildren();
            int lastIndex = children.length - 1;
            int newLevel = level + 1;
            for (int i = 0; i < children.length; i++) {
                render(out, children[i], newLevel, width, i == lastIndex);
            }
            return;
        }
       
        // Render the beginning of this node
        out.println("  <tr valign=\"middle\">");

        // Create the appropriate number of indents
        for (int i = 0; i < level; i++) {
            int levels = level - i;
            TreeControlNode parent = node;
            for (int j = 1; j <= levels; j++)
                parent = parent.getParent();
            if (parent.isLast())
                out.print("    <td></td>");
            else {
                out.print("    <td><img src=\"");
                out.print(images);
                out.print("/");
                out.print(IMAGE_LINE_VERTICAL);
                out.print("\" border=\"0\"></td>");
            }
            out.println();
        }

        // Render the tree state image for this node

        // HACK to take into account special characters like = and &
        // in the node name, could remove this code if encode URL
        // and later request.getParameter() could deal with = and &
        // character in parameter values.
        String encodedNodeName = URLEncoder.encode(node.getName());

        String action = replace(getAction(), "${name}", encodedNodeName);

       
        String updateTreeAction =
            replace(getAction(), "tree=${name}", "select=" + encodedNodeName);
        updateTreeAction =
            ((HttpServletResponse) pageContext.getResponse()).
            encodeURL(updateTreeAction);

        out.print("    <td>");
        if ((action != null) && !node.isLeaf()) {
            out.print("<a href=\"");
            out.print(response.encodeURL(action));
            out.print("\">");
        }
        out.print("<img src=\"");
        out.print(images);
        out.print("/");
View Full Code Here


    ActionMapping actionConfig = newMock(ActionMapping.class);
    ActionForm actionForm = newMock(ActionForm.class);
    ActionContext actionContext = newMock(ActionContext.class);
    ActionForward forwardConfig = newMock(ActionForward.class);
    HttpServletRequest request = newMock(HttpServletRequest.class);
    HttpServletResponse response = newMock(HttpServletResponse.class);
    ServletContext servletContext = newMock(ServletContext.class);
   
    expect(sac.getRequest()).andReturn(request);
    expect(sac.getResponse()).andReturn(response);
    expect(sac.getContext()).andReturn(servletContext);
View Full Code Here

    View view = createStrictMock(View.class);
    Map model = createStrictMock(Map.class);
    ActionContext context = createStrictMock(ActionContext.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    HttpServletResponse response = createStrictMock(HttpServletResponse.class);

    SpringRenderingViewAdapter va = new SpringRenderingViewAdapter(view, model);

    expect(context.getRequest()).andReturn(request);
    expect(context.getResponse()).andReturn(response);
View Full Code Here

    View view = createStrictMock(View.class);
    Map model = createStrictMock(Map.class);
    ActionContext context = createStrictMock(ActionContext.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    HttpServletResponse response = createStrictMock(HttpServletResponse.class);

    SpringRenderingViewAdapter va = new SpringRenderingViewAdapter(view, model);

    expect(context.getRequest()).andReturn(request);
    expect(context.getResponse()).andReturn(response);
View Full Code Here

    ActionWithResponse action = new ActionWithResponse();

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> inputs = c.getInjectionMap();

    HttpServletResponse response = createMock(HttpServletResponse.class);

    replay(response);

    InjectionWrapper inputWrapper = inputs.get("response");
View Full Code Here

  public void doFilter(ServletRequest req, ServletResponse res,
      FilterChain chain) throws IOException, ServletException {
    if (req instanceof HttpServletRequest) {     
      HttpServletRequest request = (HttpServletRequest) req;
      HttpServletResponse response = (HttpServletResponse) res;
      try{
        String uri = request.getRequestURI().substring(request.getContextPath().length());
        boolean ignore = ignore_pages.contains(uri);
        /*
        if(ignore){
 
View Full Code Here

     * Proxy to HttpServletResponse.addHeader()
     * @param name the header name
     * @param value the header value
     */
    public void addHeader(String name, String value) {
        HttpServletResponse res = getServletResponse();
        if (res != null)
            res.addHeader(name, value);
    }
View Full Code Here

     * Proxy to HttpServletResponse.addDateHeader()
     * @param name the header name
     * @param value the header value
     */
    public void addDateHeader(String name, Date value) {
        HttpServletResponse res = getServletResponse();
        if (res != null)
            res.addDateHeader(name, value.getTime());
    }
View Full Code Here

     * Proxy to HttpServletResponse.setHeader()
     * @param name the header name
     * @param value the header value
     */
    public void setHeader(String name, String value) {
        HttpServletResponse res = getServletResponse();
        if (res != null)
            res.setHeader(name, value);
    }
View Full Code Here

     * Proxy to HttpServletResponse.setDateHeader()
     * @param name the header name
     * @param value the header value
     */
    public void setDateHeader(String name, Date value) {
        HttpServletResponse res = getServletResponse();
        if (res != null)
            res.setDateHeader(name, value.getTime());
    }
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpServletResponse

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.