341736 Split jetty-nested out of war module

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2959 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-04-04 05:19:17 +00:00
parent d99f4e276b
commit 2ca6b4521b
15 changed files with 78 additions and 18 deletions

View File

@ -22,6 +22,7 @@ jetty-7.4.0-SNAPSHOT
+ 341394 Remove 'Unavailable' JMX attributes of WebAppContext MBean
+ 341439 Blocking HttpClient does not use soTimeout for timeouts
+ 341561 Exception when adding o.e.j.s.DoSFilter as managed attribute
+ 341736 Split jetty-nested out of war module
+ JETTY-1245 Pooled Buffers implementation
+ JETTY-1354 Added jetty-nested
+ Ensure generated fragment names are unique

View File

@ -8,7 +8,7 @@
</parent>
<artifactId>jetty-nested</artifactId>
<name>Jetty :: Nested</name>
<packaging>war</packaging>
<packaging>jar</packaging>
<build>
<plugins>
</plugins>
@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<artifactId>jetty-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@ -26,7 +26,7 @@ public class NestedConnection extends HttpConnection
super(connector,
endp,
connector.getServer(),
new NestedParser(request),
new NestedParser(),
new NestedGenerator(connector.getResponseBuffers(),endp,response,nestedIn),
new NestedRequest());
@ -56,7 +56,7 @@ public class NestedConnection extends HttpConnection
// System.err.println(fields.toString());
}
public void handle2() throws IOException, ServletException
void service() throws IOException, ServletException
{
setCurrentConnection(this);
try
@ -81,4 +81,13 @@ public class NestedConnection extends HttpConnection
return ((NestedEndPoint)_endp).getServletInputStream();
}
/* (non-Javadoc)
* @see org.eclipse.jetty.server.HttpConnection#handle()
*/
@Override
public Connection handle() throws IOException
{
throw new IllegalStateException();
}
}

View File

@ -1,10 +1,27 @@
package org.eclipse.jetty.nested;
import java.io.IOException;
import org.eclipse.jetty.server.AbstractConnector;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.AbstractConnector;
import org.eclipse.jetty.server.Connector;
/**
* Nested Jetty Connector
* <p>
* This Jetty {@link Connector} allows a jetty instance to be nested inside another servlet container.
* Requests received by the outer servlet container should be passed to jetty using the {@link #service(ServletRequest, ServletResponse)} method of this connector.
*
*/
public class NestedConnector extends AbstractConnector
{
String _serverInfo;
public NestedConnector()
{
setAcceptors(0);
@ -34,4 +51,19 @@ public class NestedConnector extends AbstractConnector
throw new IllegalStateException();
}
/**
* Service a request of the outer servlet container by passing it to the nested instance of Jetty.
* @param outerRequest
* @param outerResponse
* @throws IOException
* @throws ServletException
*/
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);
connection.service();
}
}

View File

@ -9,38 +9,31 @@ import org.eclipse.jetty.http.Parser;
public class NestedParser implements Parser
{
public NestedParser(HttpServletRequest request)
public NestedParser()
{
// TODO Auto-generated constructor stub
}
public void reset(boolean returnBuffers)
{
// TODO Auto-generated method stub
}
public boolean isComplete()
{
// TODO Auto-generated method stub
return false;
}
public int parseAvailable() throws IOException
{
// TODO Auto-generated method stub
return 0;
}
public boolean isMoreInBuffer() throws IOException
{
// TODO Auto-generated method stub
return false;
}
public boolean isIdle()
{
// TODO Auto-generated method stub
return false;
}

View File

@ -312,6 +312,7 @@
<module>test-continuation-jetty6</module>
<module>test-jetty-servlet</module>
<module>test-jetty-webapp</module>
<module>test-jetty-nested</module>
<module>example-jetty-embedded</module>
<module>tests</module>
</modules>

28
test-jetty-nested/pom.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>7.4.0-SNAPSHOT</version>
</parent>
<artifactId>test-jetty-nested</artifactId>
<name>Jetty :: Nested Test</name>
<packaging>war</packaging>
<build>
<plugins>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-nested</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -102,11 +102,7 @@ public class NestedJettyServlet implements Servlet
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
{
HttpServletRequest request = (HttpServletRequest)req;
HttpServletResponse response = (HttpServletResponse)res;
NestedConnection connection=new NestedConnection(_connector,new NestedEndPoint(request,response),request,response,_context.getServerInfo());
connection.handle2();
_connector.service(req,res);
}
public String getServletInfo()