Java Code Examples for javax.servlet.ServletException#initCause()

The following examples show how to use javax.servlet.ServletException#initCause() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void init(FilterConfig config) throws ServletException {
	repositoryPath = config
			.getInitParameter("com.corejsf.UploadFilter.repositoryPath");
	try {
		String paramValue = config
				.getInitParameter("com.corejsf.UploadFilter.sizeThreshold");
		if (paramValue != null)
			sizeThreshold = Integer.parseInt(paramValue);
		paramValue = config.getInitParameter("com.corejsf.UploadFilter.sizeMax");
		if (paramValue != null)
			sizeMax = Long.parseLong(paramValue);
	} catch (NumberFormatException ex) {
		ServletException servletEx = new ServletException();
		servletEx.initCause(ex);
		throw servletEx;
	}
}
 
Example 2
public void init(FilterConfig config) throws ServletException {
    repositoryPath = config.getInitParameter("org.sakaiproject.tool.messageforums.FileUploadFilter.repositoryPath");

    try {
        String paramValue = config.getInitParameter("org.sakaiproject.tool.messageforums.FileUploadFilter.sizeThreshold");

        if (paramValue != null) {
            sizeThreshold = Integer.parseInt(paramValue);
        }
        paramValue = config.getInitParameter("org.sakaiproject.tool.messageforums.FileUploadFilter.sizeMax");
        if (paramValue != null) {
            sizeMax = Long.parseLong(paramValue);
        }
    } catch (NumberFormatException ex) {
        ServletException servletEx = new ServletException();
        servletEx.initCause(ex);
        throw servletEx;
    }
}
 
Example 3
public void init(FilterConfig config) throws ServletException 
{
  repositoryPath = config.getInitParameter("org.sakaiproject.tool.syllabus.FileUploadFilter.repositoryPath");
  
  try 
  {
    String paramValue = config.getInitParameter("org.sakaiproject.tool.syllabus.FileUploadFilter.sizeThreshold");

    if (paramValue != null) 
      sizeThreshold = Integer.parseInt(paramValue);
    paramValue = config.getInitParameter("org.sakaiproject.tool.syllabus.FileUploadFilter.sizeMax");
    if (paramValue != null) 
      sizeMax = Long.parseLong(paramValue);
  }
  catch (NumberFormatException ex) 
  {
    ServletException servletEx = new ServletException();
    servletEx.initCause(ex);
    throw servletEx;
  }
}
 
Example 4
public void init(FilterConfig config) throws ServletException {
	repositoryPath = config
			.getInitParameter("com.corejsf.UploadFilter.repositoryPath");
	try {
		String paramValue = config
				.getInitParameter("com.corejsf.UploadFilter.sizeThreshold");
		if (paramValue != null)
			sizeThreshold = Integer.parseInt(paramValue);
		paramValue = config.getInitParameter("com.corejsf.UploadFilter.sizeMax");
		if (paramValue != null)
			sizeMax = Long.parseLong(paramValue);
	} catch (NumberFormatException ex) {
		ServletException servletEx = new ServletException();
		servletEx.initCause(ex);
		throw servletEx;
	}
}
 
Example 5
public void init(FilterConfig config) throws ServletException {
    repositoryPath = config.getInitParameter("org.sakaiproject.tool.messageforums.FileUploadFilter.repositoryPath");

    try {
        String paramValue = config.getInitParameter("org.sakaiproject.tool.messageforums.FileUploadFilter.sizeThreshold");

        if (paramValue != null) {
            sizeThreshold = Integer.parseInt(paramValue);
        }
        paramValue = config.getInitParameter("org.sakaiproject.tool.messageforums.FileUploadFilter.sizeMax");
        if (paramValue != null) {
            sizeMax = Long.parseLong(paramValue);
        }
    } catch (NumberFormatException ex) {
        ServletException servletEx = new ServletException();
        servletEx.initCause(ex);
        throw servletEx;
    }
}
 
Example 6
public void init(FilterConfig config) throws ServletException 
{
  repositoryPath = config.getInitParameter("org.sakaiproject.tool.syllabus.FileUploadFilter.repositoryPath");
  
  try 
  {
    String paramValue = config.getInitParameter("org.sakaiproject.tool.syllabus.FileUploadFilter.sizeThreshold");

    if (paramValue != null) 
      sizeThreshold = Integer.parseInt(paramValue);
    paramValue = config.getInitParameter("org.sakaiproject.tool.syllabus.FileUploadFilter.sizeMax");
    if (paramValue != null) 
      sizeMax = Long.parseLong(paramValue);
  }
  catch (NumberFormatException ex) 
  {
    ServletException servletEx = new ServletException();
    servletEx.initCause(ex);
    throw servletEx;
  }
}
 
Example 7
/**
 * {@inheritDoc}
 */
@Override
public void init( FilterConfig config ) throws ServletException
{
    _mapLastRequestTimes = new HashMap<>( INITIAL_CAPACITY );
    _listOrderedRequests = new LinkedList<>( );

    try
    {
        String paramValue = config.getInitParameter( "minContentLength" );

        if ( paramValue != null )
        {
            _nMinContentLength = Integer.parseInt( paramValue );
        }

        paramValue = config.getInitParameter( "minInterval" );

        if ( paramValue != null )
        {
            _nMinInterval = Integer.parseInt( paramValue );
        }
    }
    catch( NumberFormatException ex )
    {
        ServletException servletEx = new ServletException( ex.getMessage( ) );
        servletEx.initCause( ex );
        throw servletEx;
    }
}
 
Example 8
/**
 * executed when a post request happens
 *
 * @param request the request object
 * @param response the response object
 * @throws ServletException if a read error occurs
 * @throws IOException if a read error occurs
 */
public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
    throws ServletException, IOException {

    if (log.isDebugEnabled()) {
        log.debug("Entered doPost");
    }

    if (request.getHeader("SOAPAction") != null) {
        passControl(request, response);
        return;
    }

    response.setContentType("text/xml");
    try {
        if (log.isDebugEnabled()) {
            log.debug("Passing control to XmlRpcServer.execute");
        }

        server.execute(request.getInputStream(),
                       response.getWriter(),
                       request.getRemoteAddr(),
                       request.getLocalName(),
                       request.getProtocol());

        /*
         * jesusr - 2007.09.14
         * this is still the case
         *
         * mbowman - 2005.10.06
         * Like we were raised in a barn, we are going to leave here without
         * flushing ;)
         * -- The current thinking is that Tocmat handles the outputStream
         * -- flushing and closing for us. This make sense since after this
         * -- method runs, the response still needs to go back up through
         * -- the filters and out. If things start breaking in the future,
         * -- this is a  good place to start looking.
         */
    }
    // As bad as this is, we have no choice, Marquee-xmlrpc throws
    // Throwable, so we have to catch it.
    catch (Throwable t) {
        // By the time we get here, it can't be a FaultException, so just
        // wrap it in a ServletException and toss.
        ServletException e = new ServletException("Throwable from XmlRpc", t);
        t.printStackTrace();
        if (e.getCause() != t) {
            e.initCause(t);
        }
        throw e;
    }
}
 
Example 9
/**
 * executed when a post request happens
 *
 * @param request the request object
 * @param response the response object
 * @throws ServletException if a read error occurs
 * @throws IOException if a read error occurs
 */
public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
    throws ServletException, IOException {

    if (log.isDebugEnabled()) {
        log.debug("Entered doPost");
    }

    if (request.getHeader("SOAPAction") != null) {
        passControl(request, response);
        return;
    }

    response.setContentType("text/xml");
    try {
        if (log.isDebugEnabled()) {
            log.debug("Passing control to XmlRpcServer.execute");
        }

        server.execute(request.getInputStream(),
                       response.getWriter(),
                       request.getRemoteAddr(),
                       request.getLocalName(),
                       request.getProtocol());

        /*
         * jesusr - 2007.09.14
         * this is still the case
         *
         * mbowman - 2005.10.06
         * Like we were raised in a barn, we are going to leave here without
         * flushing ;)
         * -- The current thinking is that Tocmat handles the outputStream
         * -- flushing and closing for us. This make sense since after this
         * -- method runs, the response still needs to go back up through
         * -- the filters and out. If things start breaking in the future,
         * -- this is a  good place to start looking.
         */
    }
    // As bad as this is, we have no choice, Marquee-xmlrpc throws
    // Throwable, so we have to catch it.
    catch (Throwable t) {
        // By the time we get here, it can't be a FaultException, so just
        // wrap it in a ServletException and toss.
        ServletException e = new ServletException("Throwable from XmlRpc", t);
        t.printStackTrace();
        if (e.getCause() != t) {
            e.initCause(t);
        }
        throw e;
    }
}