基本的に私はいくつかのサービスをユーザーに示すエンタープライズjsfアプリケーションを持っています。java.lang.IllegalStateException 2つのJava EEアプリケーションの間をナビゲートしようとしています
エンタープライズホストの異なる部門は、単一のWebサーバー上のさまざまなアプリケーションとリンクが、アプリケーションにアクセスするために提供されています。
私が持っている私は、次の異なるapplications.Theへのすべての要求をリダイレクトしています、それを通して自分のアプリケーションにRedirectServletという名前Servlet
は私のredirectservlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOGGER.debug("In doGet()");
try{
if(request.getParameter("URL") != null){
LOGGER.debug("URL Found redirecting forward");
String redirectUrl = request.getParameter("URL");
response.sendRedirect(redirectUrl);
}
}catch(NullPointerException e){
LOGGER.debug("URL not found setting new session parameters & redirecting forward");
HttpSession session = request.getSession(true);
try {
response.sendRedirect(properties.getProperty(REDIRECTURL, true));
} catch (Exception e1) {
LOGGER.debug("Expcetion with propertiesfile: ",e1);
}
}
}
リンクがクリックされた場合にどのような私は上記のやることです(URLパラメータです私は特定のアプリケーションにリダイレクトします。それ以外の場合は、アプリケーションの新しいセッションを作成し、アプリケーションのホームページにリダイレクトします。他のアプリケーションからユーザーlogsoutが、私は自分のアプリケーション に戻ってリダイレクトしていたときに
これは私が自分のアプリケーションに戻ってリダイレクトしています方法です
public void Logout(){
LOGGER.debug("In LogOut");
try
{
HttpServletRequest req = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
HttpServletResponse res = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
HttpSession session = req.getSession(false);
LOGGER.debug("report session id:" + session.getId());
res.sendRedirect(REDIRECTURL);
session.invalidate();
}catch(IllegalStateException e){
LOGGER.debug("Exception in LogOut", e);
}
catch (IOException e){
LOGGER.debug("Exception in LogOut", e);
}
}
私はres.sendRedirect
ラインで次のようにサーバーエラーメッセージを取得しています上記のコードは
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error() that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot forward after response has been committed
javax.faces.webapp.FacesServlet.service(FacesServlet.java:221)
root cause
java.lang.IllegalStateException: Cannot forward after response has been committed
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:368)
org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
org.apache.myfaces.view.jsp.JspViewDeclarationLanguage.buildView(JspViewDeclarationLanguage.java:94)
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:66)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
これは、我々はアプリケーション
間のセッションを管理している方法ですユーザーが最初にアプリケーションにログインすると、DBにいくつかの詳細が格納され、その後、すべてのアプリケーションがその詳細をDBでチェックします。
誰かがthis.Thisを解決するためにどのように役立つJSF 1.2
とApacheのトリニダードを使用している
どちらのアプリケーションの重要な時間があるしてください。
http://stackoverflow.com/質問/ 2123514/java-lang-illegalstateexception-応答後に返信できませんでした –