
December 15th, 2005, 02:54 PM
|
|
Contributing User
|
|
Join Date: Aug 2004
Posts: 279
 
Time spent in forums: 2 Days 17 h 31 m 46 sec
Reputation Power: 5
|
|
Java Servlet Redirect exceptionHelper.Java
This should be pretty simple... but my experience with java is low. I have a servlet in a portal that displays an error when the portal can't load. Instead of displaying this error to the end-user, I'd like to instead, redirect the user to a different URL.
I've tried adding this to line 348, but the file won't compile...
Code:
response.sendRedirect(response.encodeRedirectURL(' http://dev.sheridan.edu/uportal/errors/') );
error msg:
Code:
C:\Uportal-VT\uPortal_rel-2-4-2>ant deploy
Buildfile: build.xml
prepare:
compile:
[javac] Compiling 1 source file to C:\Uportal-VT\uPortal_rel-2-4-2\build\WEB
-INF\classes
[javac] C:\Uportal-VT\uPortal_rel-2-4-2\source\org\jasig\portal\ExceptionHel
per.java:347: unclosed character literal
[javac] response.sendRedirect(response.encodeRedirectURL
('http://dev.sheridan.edu/uportal/errors/') );
[javac]
^
[javac] C:\Uportal-VT\uPortal_rel-2-4-2\source\org\jasig\portal\ExceptionHel
per.java:348: ')' expected
[javac] PrintWriter out = resp.getWriter();
[javac] ^
[javac] 2 errors
BUILD FAILED
C:\Uportal-VT\uPortal_rel-2-4-2\build.xml:460: Compile failed; see the compiler
error output for details.
Total time: 11 seconds
So, I'm kinda stuck.
Thank you for your help.
First few lines of Exception.java handler file... the forum won't let me post the whole thing:
Code:
package org.jasig.portal;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ExceptionHelper {
private static final Log log = LogFactory.getLog(ExceptionHelper.class);
// List of strings to match in traceback for various containers
// This array must be expanded as additional Application Server
// containers become better known
public static final String boundaries[] =
{
"at javax.servlet.http.HttpServlet."
};
}
|