Merge remote-tracking branch 'origin/jetty-7' into jetty-8
This commit is contained in:
commit
0ad8913034
|
@ -65,8 +65,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
|||
private boolean _newSession;
|
||||
private int _requests;
|
||||
|
||||
// TODO remove this.
|
||||
protected final Map<String,Object> _jdbcAttributes=_attributes;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
protected AbstractSession(AbstractSessionManager abstractSessionManager, HttpServletRequest request)
|
||||
|
@ -255,6 +254,18 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
|||
return (String[])_attributes.keySet().toArray(a);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected Map<String,Object> getAttributeMap ()
|
||||
{
|
||||
return _attributes;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void addAttributes(Map<String,Object> map)
|
||||
{
|
||||
_attributes.putAll(map);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected boolean access(long time)
|
||||
|
|
|
@ -267,7 +267,8 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
private static final long serialVersionUID = 5208464051134226143L;
|
||||
private final SessionData _data;
|
||||
private boolean _dirty=false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Session from a request.
|
||||
*
|
||||
|
@ -276,7 +277,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
protected Session (HttpServletRequest request)
|
||||
{
|
||||
super(JDBCSessionManager.this,request);
|
||||
_data = new SessionData(getClusterId(),_jdbcAttributes);
|
||||
_data = new SessionData(getClusterId(),getAttributeMap());
|
||||
if (_dftMaxIdleSecs>0)
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||
_data.setCanonicalContext(canonicalize(_context.getContextPath()));
|
||||
|
@ -286,18 +287,18 @@ public class JDBCSessionManager extends AbstractSessionManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Session restored in database.
|
||||
* @param data
|
||||
*/
|
||||
protected Session (long accessed, SessionData data)
|
||||
{
|
||||
super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId());
|
||||
_data=data;
|
||||
if (_dftMaxIdleSecs>0)
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||
_jdbcAttributes.putAll(_data.getAttributeMap());
|
||||
_data.setAttributeMap(_jdbcAttributes);
|
||||
}
|
||||
* Session restored in database.
|
||||
* @param data
|
||||
*/
|
||||
protected Session (long accessed, SessionData data)
|
||||
{
|
||||
super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId());
|
||||
_data=data;
|
||||
if (_dftMaxIdleSecs>0)
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||
addAttributes(_data.getAttributeMap());
|
||||
_data.setAttributeMap(getAttributeMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute (String name, Object value)
|
||||
|
|
|
@ -50,6 +50,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
|||
private static final Logger LOG = Log.getLogger(ErrorPageErrorHandler.class);
|
||||
|
||||
public final static String ERROR_PAGE="org.eclipse.jetty.server.error_page";
|
||||
public final static String GLOBAL_ERROR_PAGE = "org.eclipse.jetty.server.error_page.global";
|
||||
|
||||
protected ServletContext _servletContext;
|
||||
private final Map<String,String> _errorPages= new HashMap<String,String>(); // code or exception to URL
|
||||
|
@ -120,6 +121,12 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//try new servlet 3.0 global error page
|
||||
if (error_page == null)
|
||||
{
|
||||
error_page = _errorPages.get(GLOBAL_ERROR_PAGE);
|
||||
}
|
||||
|
||||
if (error_page!=null)
|
||||
{
|
||||
|
|
|
@ -1099,16 +1099,18 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
String error = node.getString("error-code", false, true);
|
||||
int code=0;
|
||||
if (error == null || error.length() == 0)
|
||||
{
|
||||
error = node.getString("exception-type", false, true);
|
||||
if (error == null || error.length() == 0)
|
||||
error = ErrorPageErrorHandler.GLOBAL_ERROR_PAGE;
|
||||
}
|
||||
else
|
||||
code=Integer.valueOf(error);
|
||||
|
||||
String location = node.getString("location", false, true);
|
||||
|
||||
|
||||
ErrorPageErrorHandler handler = (ErrorPageErrorHandler)context.getErrorHandler();
|
||||
|
||||
|
||||
Origin o = context.getMetaData().getOrigin("error."+error);
|
||||
|
||||
switch (o)
|
||||
{
|
||||
case NotSet:
|
||||
|
@ -1128,11 +1130,16 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
//an error page setup was set in web.xml, only allow other web xml descriptors to override it
|
||||
if (!(descriptor instanceof FragmentDescriptor))
|
||||
{
|
||||
if (code>0)
|
||||
handler.addErrorPage(code,location);
|
||||
if (descriptor instanceof OverrideDescriptor || descriptor instanceof DefaultsDescriptor)
|
||||
{
|
||||
if (code>0)
|
||||
handler.addErrorPage(code,location);
|
||||
else
|
||||
handler.addErrorPage(error,location);
|
||||
context.getMetaData().setOrigin("error."+error, descriptor);
|
||||
}
|
||||
else
|
||||
handler.addErrorPage(error,location);
|
||||
context.getMetaData().setOrigin("error."+error, descriptor);
|
||||
throw new IllegalStateException("Duplicate global error-page "+location);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue