All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.khubla.pragmatach.plugin.jsp.JSPResponse Maven / Gradle / Ivy

package com.khubla.pragmatach.plugin.jsp;

import java.util.Map;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.khubla.pragmatach.framework.api.PragmatachException;
import com.khubla.pragmatach.framework.controller.impl.AbstractResponse;

/**
 * @author tome
 */
public class JSPResponse extends AbstractResponse {
   /**
    * httpServlet
    */
   private final HttpServlet httpServlet;
   /**
    * request
    */
   private final HttpServletRequest httpServletRequest;

   public JSPResponse(Map cacheHeaders, HttpServlet httpServlet, HttpServletRequest httpServletRequest) {
      super(cacheHeaders);
      this.httpServlet = httpServlet;
      this.httpServletRequest = httpServletRequest;
   }

   @Override
   public String getContentType() throws PragmatachException {
      return CONTENT_TYPE_HTML;
   }

   @Override
   public Map getHeaders() throws PragmatachException {
      return super.getCacheHeaders();
   }

   @Override
   public void render(HttpServletResponse httpServletResponse) throws PragmatachException {
      try {
         httpServlet.service(httpServletRequest, httpServletResponse);
      } catch (final Exception e) {
         throw new PragmatachException("Exception in render", e);
      }
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy