Package javax.servlet.http

Examples of javax.servlet.http.HttpServletResponse


             * ServletActionContext.
             *
             * todo - determine if there's any reason we can't just always use ServletActionContext
             * -> because we want to be able to use the tags if we went directly to the page
             */
            HttpServletResponse response;
            HttpServletRequest request;

            if (pageContext != null) {
                response = (HttpServletResponse) pageContext.getResponse();
                request = (HttpServletRequest) pageContext.getRequest();
View Full Code Here


            throws Exception
    {
        exporter.afterPropertiesSet();

        HttpServletRequest request = getRequest();
        HttpServletResponse response = new MockHttpServletResponse();
        exporter.handleRequest(request, response);
    }
View Full Code Here

        boolean flag;
        HttpServletRequest request = (HttpServletRequest) adapter.get("req");
        if (request == null)
            throw new IOException("No request object in context.");

        HttpServletResponse response = (HttpServletResponse) adapter.get("res");
        if (response == null)
            throw new IOException("No response object in context.");

        try {
            String decoratorName = (String) node.jjtGetChild(0).value(adapter);
View Full Code Here

  }

  public void service(Context context, Resource resource) throws Exception
  {
    HttpServletRequest request = context.getRequest();
    HttpServletResponse response = context.getResponse();

    context.log().debug(request.getMethod()+' '+context.getAddress().getPathinfo());

    long last_modified = resource.getLastModified();
    if (last_modified > 0) {
      String if_modified_since = request.getHeader("if-modified-since");
      if (if_modified_since != null) {
        HttpDate ifmod = new HttpDate();
        if (ifmod.parse(if_modified_since)) {
          HttpDate mod = new HttpDate(last_modified);
          if (mod.after(ifmod)) {
            response.setStatus(304);
            response.setContentLength(0);
            return;
          }
        }
      }
    }
     
    int contentLength = (int)resource.getLength();
    OutputStream output = context.getOutputStream();
    response.setContentType(resource.getContentType());
    response.setContentLength(contentLength);
    response.setDateHeader("Last-Modified", last_modified);
    resource.writeTo(output);
    output.flush();
    resource.close();
  }
View Full Code Here

        boolean uncompressed = true;
        if (req instanceof HttpServletRequest) {
            HttpServletRequest request = (HttpServletRequest) req;
            if (request.getAttribute(GZIPPED_RESPONSE) == null) {
                request.setAttribute(GZIPPED_RESPONSE, true);
                HttpServletResponse response = (HttpServletResponse) res;
                String ae = request.getHeader("accept-encoding");
                String pathInfo = request.getPathInfo();
                if ((ae != null) && (ae.indexOf("gzip") != -1) && (!GZIPResponseWrapper.class.isInstance(res))) {
                    if (!excludedPath(pathInfo)) {
                        uncompressed = false;
View Full Code Here

    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        if (request instanceof HttpServletRequest) {
            filterChain.doFilter(request, response);
            HttpServletResponse httpResponse = (HttpServletResponse) response;
            httpResponse.setHeader("Pragma", "public");
            Calendar cal = new GregorianCalendar();
            cal.roll(Calendar.SECOND, seconds);
            httpResponse.setHeader("Cache-Control", "PUBLIC, max-age=" + seconds + ", must-revalidate");
            httpResponse.setHeader("Expires", httpDateFormat.format(cal.getTime()));
        }
    }
View Full Code Here

    }

    // portlet-only implementation

    public void include(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
        HttpServletResponse servletResponse = null;
        try {
            HttpServletRequest servletRequest = (HttpServletRequest) ((RenderRequestImpl) request).getRequest();

            ///////////////Fix for WebWork Portal FrameWork//////////////////////////////
            if (response instanceof RenderResponseWrapper)
View Full Code Here

    testEditActionFails("Name=Carol&IsActive=true&Disposition=1", ADD); //duplicate name
  }
 
  public void testList() throws AppException {
    HttpServletRequest req = FakeRequest.forGET(LIST, NO_PARAMS);
    HttpServletResponse resp = new FakeResponse();
    MemberAction action = new MemberAction(new RequestParserImpl(req, resp));
   
    ResponsePage responsePage = action.execute();
    Object item = req.getAttribute(ITEMS_FOR_LISTING);
    assertTrue(item != null);
View Full Code Here

    //log(item);
  }
 
  public void testFetch() throws AppException {
    HttpServletRequest req = FakeRequest.forGET(FETCH, "Id=3");
    HttpServletResponse resp = new FakeResponse();
    MemberAction action = new MemberAction(new RequestParserImpl(req, resp));
   
    ResponsePage responsePage = action.execute();
    Object item = req.getAttribute(ITEM_FOR_EDIT);
    //log(item);
View Full Code Here

      req = FakeRequest.forGET(aServletPath, aQueryString);
    }
    HttpSession session = req.getSession(true); //links request to session
    assertTrue(session != null);
   
    HttpServletResponse resp = new FakeResponse();
    MemberAction action = new MemberAction(new RequestParserImpl(req, resp));
   
    if(aSucceeds) {
      assertActionSucceeds(req, action);
    }
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.