当前位置: 首页>>代码示例>>Java>>正文


Java ServletException.getMessage方法代码示例

本文整理汇总了Java中javax.servlet.ServletException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ServletException.getMessage方法的具体用法?Java ServletException.getMessage怎么用?Java ServletException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.ServletException的用法示例。


在下文中一共展示了ServletException.getMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loginUser

import javax.servlet.ServletException; //导入方法依赖的package包/类
void loginUser(VOUser voUser, String password,
        HttpServletRequest httpRequest, HttpSession session)
        throws LoginException, CommunicationException {
    ServiceAccess serviceAccess = ServiceAccess
            .getServiceAcccessFor(session);
    IdentityService service = getIdService();

    // authenticate the user
    httpRequest.getSession();
    try {
        httpRequest.login(String.valueOf(voUser.getKey()), password);
    } catch (ServletException e) {
        throw new LoginException(e.getMessage());
    }
    serviceAccess.login(voUser, password, httpRequest, getResponse());

    // log info on the successful login
    logger.logInfo(Log4jLogger.ACCESS_LOG,
            LogMessageIdentifier.INFO_USER_LOGIN_SUCCESS,
            voUser.getUserId(), IPResolver.resolveIpAddress(httpRequest),
            voUser.getTenantId());

    // read the user details value object and store it in the session
    session.setAttribute(Constants.SESS_ATTR_USER,
            service.getCurrentUserDetails());
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:27,代码来源:ConfirmationBean.java

示例2: dispatch

import javax.servlet.ServletException; //导入方法依赖的package包/类
@Override
public void dispatch(final String path) throws IOException, FacesException
{
  _checkRequest();
  _checkResponse();
  final RequestDispatcher requestDispatcher = _servletRequest.getRequestDispatcher(path);

  // If there is no dispatcher, send NOT_FOUND
  if (requestDispatcher == null)
  {
    if (_httpServletResponse != null)
    {
      _httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
    }

    return;
  }

  try
  {
    requestDispatcher.forward(_servletRequest, _servletResponse);
  }
  catch (final ServletException e)
  {
    if (e.getMessage() != null)
    {
      throw new FacesException(e.getMessage(), e);
    }
    else
    {
      throw new FacesException(e);
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:35,代码来源:ServletExternalContext.java

示例3: getFileText

import javax.servlet.ServletException; //导入方法依赖的package包/类
public String getFileText( String originalPath, boolean virtual ) throws IOException {
try {
    ServletContextAndPath csAndP = getServletContextAndPath( originalPath, virtual );
    ServletContext context = csAndP.getServletContext();
    String path = csAndP.getPath();

    RequestDispatcher rd =
	context.getRequestDispatcher( path );
    if ( rd == null ) {
	throw new IOException("Couldn't get request dispatcher for path: " + path );
    }
    ByteArrayServletOutputStream basos = new ByteArrayServletOutputStream();
    ResponseIncludeWrapper responseIncludeWrapper =
	new ResponseIncludeWrapper(res, basos );
    rd.include(req, responseIncludeWrapper );

    //We can't assume the included servlet flushed its output
    responseIncludeWrapper.flushOutputStreamOrWriter();
    byte[] bytes = basos.toByteArray();

    //Assume that the default encoding is what was used to encode the bytes. Questionable.
    String retVal = new String( bytes );

    //make an assumption that an empty response is a failure.  This is a problem if a truly empty file 
    //were included, but not sure how else to tell.
    if ( retVal.equals("") ) {
	throw new IOException("Couldn't find file: " + path );
    }
    return retVal;
} catch (ServletException e) {
    throw new IOException("Couldn't include file: " + originalPath + " because of ServletException: " + e.getMessage() );
}
   }
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:34,代码来源:SSIServletExternalResolver.java

示例4: getFileText

import javax.servlet.ServletException; //导入方法依赖的package包/类
@Override
public String getFileText(String originalPath, boolean virtual) throws IOException {
	try {
		ServletContextAndPath csAndP = getServletContextAndPath(originalPath, virtual);
		ServletContext context = csAndP.getServletContext();
		String path = csAndP.getPath();
		RequestDispatcher rd = context.getRequestDispatcher(path);
		if (rd == null) {
			throw new IOException("Couldn't get request dispatcher for path: " + path);
		}
		ByteArrayServletOutputStream basos = new ByteArrayServletOutputStream();
		ResponseIncludeWrapper responseIncludeWrapper = new ResponseIncludeWrapper(context, req, res, basos);
		rd.include(req, responseIncludeWrapper);
		// We can't assume the included servlet flushed its output
		responseIncludeWrapper.flushOutputStreamOrWriter();
		byte[] bytes = basos.toByteArray();

		// Assume platform default encoding unless otherwise specified
		String retVal;
		if (inputEncoding == null) {
			retVal = new String(bytes);
		} else {
			retVal = new String(bytes, B2CConverter.getCharset(inputEncoding));
		}

		// make an assumption that an empty response is a failure. This is
		// a problem
		// if a truly empty file
		// were included, but not sure how else to tell.
		if (retVal.equals("") && !req.getMethod().equalsIgnoreCase(org.apache.coyote.http11.Constants.HEAD)) {
			throw new IOException("Couldn't find file: " + path);
		}
		return retVal;
	} catch (ServletException e) {
		throw new IOException(
				"Couldn't include file: " + originalPath + " because of ServletException: " + e.getMessage());
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:39,代码来源:SSIServletExternalResolver.java

示例5: getFileText

import javax.servlet.ServletException; //导入方法依赖的package包/类
@Override
public String getFileText(String originalPath, boolean virtual)
        throws IOException {
    try {
        ServletContextAndPath csAndP = getServletContextAndPath(
                originalPath, virtual);
        ServletContext context = csAndP.getServletContext();
        String path = csAndP.getPath();
        RequestDispatcher rd = context.getRequestDispatcher(path);
        if (rd == null) {
            throw new IOException(
                    "Couldn't get request dispatcher for path: " + path);
        }
        ByteArrayServletOutputStream basos =
            new ByteArrayServletOutputStream();
        ResponseIncludeWrapper responseIncludeWrapper =
            new ResponseIncludeWrapper(context, req, res, basos);
        rd.include(req, responseIncludeWrapper);
        //We can't assume the included servlet flushed its output
        responseIncludeWrapper.flushOutputStreamOrWriter();
        byte[] bytes = basos.toByteArray();

        //Assume platform default encoding unless otherwise specified
        String retVal;
        if (inputEncoding == null) {
            retVal = new String( bytes );
        } else {
            retVal = new String (bytes,
                    B2CConverter.getCharset(inputEncoding));
        }

        //make an assumption that an empty response is a failure. This is
        // a problem
        // if a truly empty file
        //were included, but not sure how else to tell.
        if (retVal.equals("") && !req.getMethod().equalsIgnoreCase(
                org.apache.coyote.http11.Constants.HEAD)) {
            throw new IOException("Couldn't find file: " + path);
        }
        return retVal;
    } catch (ServletException e) {
        throw new IOException("Couldn't include file: " + originalPath
                + " because of ServletException: " + e.getMessage());
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:46,代码来源:SSIServletExternalResolver.java

示例6: getFileText

import javax.servlet.ServletException; //导入方法依赖的package包/类
public String getFileText(String originalPath, boolean virtual)
        throws IOException {
    try {
        ServletContextAndPath csAndP = getServletContextAndPath(
                originalPath, virtual);
        ServletContext context = csAndP.getServletContext();
        String path = csAndP.getPath();
        RequestDispatcher rd = context.getRequestDispatcher(path);
        if (rd == null) {
            throw new IOException(
                    "Couldn't get request dispatcher for path: " + path);
        }
        ByteArrayServletOutputStream basos =
            new ByteArrayServletOutputStream();
        ResponseIncludeWrapper responseIncludeWrapper =
            new ResponseIncludeWrapper(context, req, res, basos);
        rd.include(req, responseIncludeWrapper);
        //We can't assume the included servlet flushed its output
        responseIncludeWrapper.flushOutputStreamOrWriter();
        byte[] bytes = basos.toByteArray();

        //Assume platform default encoding unless otherwise specified
        String retVal;
        if (inputEncoding == null) {
            retVal = new String( bytes );
        } else {
            retVal = new String (bytes, inputEncoding);
        }

        //make an assumption that an empty response is a failure. This is
        // a problem
        // if a truly empty file
        //were included, but not sure how else to tell.
        if (retVal.equals("") && !req.getMethod().equalsIgnoreCase(
                org.apache.coyote.http11.Constants.HEAD)) {
            throw new IOException("Couldn't find file: " + path);
        }
        return retVal;
    } catch (ServletException e) {
        throw new IOException("Couldn't include file: " + originalPath
                + " because of ServletException: " + e.getMessage());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:44,代码来源:SSIServletExternalResolver.java


注:本文中的javax.servlet.ServletException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。