343083 make socket params available

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3027 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-04-21 00:51:00 +00:00
parent ed46fbf209
commit e38ed57324
4 changed files with 57 additions and 20 deletions

View File

@ -1,5 +1,5 @@
jetty-7.4.1-SNAPSHOT
+ 343083 Set nested dispatch type.
+ 343083 Set nested dispatch type and connection
+ 343277 add support for a context white list
+ 343352 make sure that jetty.osgi.boot is activated when a WAB is registered

View File

@ -33,45 +33,45 @@ import org.eclipse.jetty.util.log.Log;
public class NestedConnection extends HttpConnection
{
protected NestedConnection(final NestedConnector connector, final NestedEndPoint endp, final HttpServletRequest request, HttpServletResponse response,String nestedIn)
protected NestedConnection(final NestedConnector connector, final NestedEndPoint endp, final HttpServletRequest outerRequest, HttpServletResponse outerResponse,String nestedIn)
throws IOException
{
super(connector,
endp,
connector.getServer(),
new NestedParser(),
new NestedGenerator(connector.getResponseBuffers(),endp,response,nestedIn),
new NestedGenerator(connector.getResponseBuffers(),endp,outerResponse,nestedIn),
new NestedRequest());
((NestedRequest)_request).setConnection(this);
// Set the request line
_request.setDispatcherType(DispatcherType.REQUEST);
_request.setScheme(request.getScheme());
_request.setMethod(request.getMethod());
String uri=request.getQueryString()==null?request.getRequestURI():(request.getRequestURI()+"?"+request.getQueryString());
_request.setScheme(outerRequest.getScheme());
_request.setMethod(outerRequest.getMethod());
String uri=outerRequest.getQueryString()==null?outerRequest.getRequestURI():(outerRequest.getRequestURI()+"?"+outerRequest.getQueryString());
_request.setUri(new HttpURI(uri));
_request.setPathInfo(request.getRequestURI());
_request.setQueryString(request.getQueryString());
_request.setProtocol(request.getProtocol());
_request.setPathInfo(outerRequest.getRequestURI());
_request.setQueryString(outerRequest.getQueryString());
_request.setProtocol(outerRequest.getProtocol());
_request.setAttribute("isSecure",new Boolean(request.isSecure()));
_request.setAttribute("isSecure",new Boolean(outerRequest.isSecure()));
// Set the headers
HttpFields fields = getRequestFields();
for (Enumeration<String> e=request.getHeaderNames();e.hasMoreElements();)
for (Enumeration<String> e=outerRequest.getHeaderNames();e.hasMoreElements();)
{
String header=e.nextElement();
String value=request.getHeader(header);
String value=outerRequest.getHeader(header);
fields.add(header,value);
}
_request.setCookies(request.getCookies());
_request.setCookies(outerRequest.getCookies());
for (Enumeration<String> e=request.getAttributeNames();e.hasMoreElements();)
for (Enumeration<String> e=outerRequest.getAttributeNames();e.hasMoreElements();)
{
String attr=e.nextElement();
_request.setAttribute(attr,request.getAttribute(attr));
_request.setAttribute(attr,outerRequest.getAttribute(attr));
}
// System.err.println(_request.getMethod()+" "+_request.getUri()+" "+_request.getProtocol());

View File

@ -72,9 +72,9 @@ public class NestedConnector extends AbstractConnector
*/
public void service(ServletRequest outerRequest, ServletResponse outerResponse) throws IOException, ServletException
{
HttpServletRequest request = (HttpServletRequest)outerRequest;
HttpServletResponse response = (HttpServletResponse)outerResponse;
NestedConnection connection=new NestedConnection(this,new NestedEndPoint(request,response),request,response,_serverInfo);
HttpServletRequest outerServletRequest = (HttpServletRequest)outerRequest;
HttpServletResponse outerServletResponse = (HttpServletResponse)outerResponse;
NestedConnection connection=new NestedConnection(this,new NestedEndPoint(outerServletRequest,outerServletResponse),outerServletRequest,outerServletResponse,_serverInfo);
connection.service();
}

View File

@ -25,15 +25,52 @@ import org.eclipse.jetty.io.bio.StreamEndPoint;
public class NestedEndPoint extends StreamEndPoint
{
public NestedEndPoint(HttpServletRequest request, HttpServletResponse response)
private final HttpServletRequest _outerRequest;
public NestedEndPoint(HttpServletRequest outerRequest, HttpServletResponse outerResponse)
throws IOException
{
super(request.getInputStream(),response.getOutputStream());
super(outerRequest.getInputStream(),outerResponse.getOutputStream());
_outerRequest=outerRequest;
}
public ServletInputStream getServletInputStream()
{
return (ServletInputStream)getInputStream();
}
@Override
public String getLocalAddr()
{
return _outerRequest.getLocalAddr();
}
@Override
public String getLocalHost()
{
return _outerRequest.getLocalName();
}
@Override
public int getLocalPort()
{
return _outerRequest.getLocalPort();
}
@Override
public String getRemoteAddr()
{
return _outerRequest.getRemoteAddr();
}
@Override
public String getRemoteHost()
{
// TODO Auto-generated method stub
return _outerRequest.getRemoteHost();
}
@Override
public int getRemotePort()
{
return _outerRequest.getRemotePort();
}
}