當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。