Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply project settings to o.e.equinox.http.servlet.tests #355

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.http.servlet.tests/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ <h3>License</h3>
</p>

</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class AbstractTestResource {
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
HttpService service = getHttpService();
String alias = getAlias();
service.registerResources(alias, getName() , null);
service.registerResources(alias, getName(), null);
}

protected final String createDefaultAlias() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public void deactivate() {
}

@Override
protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected final void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try (PrintWriter writer = response.getWriter()) {
handleDoGet(request, writer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ public void destroy() {
}

@Override
public void doFilter(
ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {

CharResponseWrapper charResponseWrapper = new CharResponseWrapper(
(HttpServletResponse) response);
CharResponseWrapper charResponseWrapper = new CharResponseWrapper((HttpServletResponse) response);

chain.doFilter(request, charResponseWrapper);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class AbstractWhiteboardTestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try (PrintWriter writer = response.getWriter()) {
handleDoGet(request, writer);
}
Expand All @@ -40,4 +41,4 @@ protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throw
writer.print(AbstractTestServlet.STATUS_OK);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
public class TestErrorPage1 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {
Dictionary<String, String> servletProps = new Hashtable<>();
Expand All @@ -47,7 +48,7 @@ public void activate(ComponentContext componentContext) {
registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps));
Dictionary<String, Object> errorProps = new Hashtable<>();
errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E1");
errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, new String[] {"403", "404"});
errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, new String[] { "403", "404" });
registrations.add(componentContext.getBundleContext().registerService(Servlet.class, errorServlet, errorProps));
}

Expand All @@ -59,8 +60,7 @@ public void deactivate() {
}

@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

response.sendError(403);
}
Expand All @@ -69,9 +69,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
private static final long serialVersionUID = 1L;

@Override
protected void service(
HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

if (response.isCommitted()) {
System.out.println("Problem?");
Expand All @@ -81,8 +79,8 @@ protected void service(

PrintWriter writer = response.getWriter();

String requestURI = (String)request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
Integer status = (Integer)request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
String requestURI = (String) request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
Integer status = (Integer) request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);

writer.print(status + " ERROR : " + requestURI);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
public class TestErrorPage2 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {
Dictionary<String, String> servletProps = new Hashtable<>();
Expand All @@ -50,7 +51,8 @@ public void activate(ComponentContext componentContext) {
registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps));
Dictionary<String, Object> errorProps = new Hashtable<>();
errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E1");
errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, new String[] {MyException.class.getName()});
errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE,
new String[] { MyException.class.getName() });
registrations.add(componentContext.getBundleContext().registerService(Servlet.class, errorServlet, errorProps));
}

Expand All @@ -62,8 +64,7 @@ public void deactivate() {
}

@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException {

throw new MyException();
}
Expand All @@ -73,9 +74,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
private static final long serialVersionUID = 1L;

@Override
protected void service(
HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

if (response.isCommitted()) {
System.out.println("Problem?");
Expand All @@ -85,8 +84,8 @@ protected void service(

PrintWriter writer = response.getWriter();

String requestURI = (String)request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
String exception = (String)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE);
String requestURI = (String) request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
String exception = (String) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE);

writer.print(exception + " ERROR : " + requestURI);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
public class TestErrorPage3 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {
Dictionary<String, String> servletProps = new Hashtable<>();
Expand All @@ -59,8 +60,7 @@ public void deactivate() {
}

@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

response.sendError(400);
}
Expand All @@ -69,9 +69,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
private static final long serialVersionUID = 1L;

@Override
protected void service(
HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

if (response.isCommitted()) {
System.out.println("Problem?");
Expand All @@ -81,8 +79,8 @@ protected void service(

PrintWriter writer = response.getWriter();

String requestURI = (String)request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
Integer status = (Integer)request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
String requestURI = (String) request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
Integer status = (Integer) request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);

writer.print(status + " ERROR : " + requestURI);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
public class TestErrorPage4 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {
Dictionary<String, String> servletProps = new Hashtable<>();
Expand All @@ -59,8 +60,7 @@ public void deactivate() {
}

@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

response.setStatus(401);

Expand All @@ -71,9 +71,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
private static final long serialVersionUID = 1L;

@Override
protected void service(
HttpServletRequest request, HttpServletResponse response)
throws IOException {
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

if (response.isCommitted()) {
System.out.println("Problem?");
Expand All @@ -83,8 +81,8 @@ protected void service(

PrintWriter writer = response.getWriter();

String requestURI = (String)request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
Integer status = (Integer)request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
String requestURI = (String) request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
Integer status = (Integer) request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);

writer.print(status + " ERROR : " + requestURI);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public class TestFilter1 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(regexAlias(), this, null, null);
service.registerFilter(regexAlias(), f1, new Hashtable<>(), null);
}

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(regexAlias());
service.unregisterFilter(f1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
public class TestFilter10 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {
Dictionary<String, String> servletProps = new Hashtable<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
public class TestFilter12 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
public class TestFilter13 extends AbstractTestServlet {
private static final long serialVersionUID = 1L;
private final Collection<ServiceRegistration<?>> registrations = new ArrayList<>();

@Override
public void activate(ComponentContext componentContext) {
Dictionary<String, String> servletProps = new Hashtable<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public class TestFilter2 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(regexAlias(), this, null, null);
service.registerFilter(regexAlias(), f1, new Hashtable<>(), null);
service.registerFilter(regexAlias(), f2, new Hashtable<>(), null);
}

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(regexAlias());
service.unregisterFilter(f1);
service.unregisterFilter(f2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class TestFilter3 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(regexAlias(), this, null, null);
service.registerFilter(regexAlias(), f1, new Hashtable<>(), null);
service.registerFilter(regexAlias(), f2, new Hashtable<>(), null);
Expand All @@ -45,7 +45,7 @@ public void activate(ComponentContext componentContext) throws ServletException,

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(regexAlias());
service.unregisterFilter(f1);
service.unregisterFilter(f2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class TestFilter4 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(regexAlias(), this, null, null);
service.registerFilter(regexAlias(), f1, new Hashtable<>(), null);
service.registerFilter(regexAlias(), f2, new Hashtable<>(), null);
Expand All @@ -47,7 +47,7 @@ public void activate(ComponentContext componentContext) throws ServletException,

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(regexAlias());
service.unregisterFilter(f1);
service.unregisterFilter(f2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public class TestFilter5 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(extensionAlias(), this, null, null);
service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null);
}

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(extensionAlias());
service.unregisterFilter(f1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public class TestFilter6 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(extensionAlias(), this, null, null);
service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null);
service.registerFilter(extensionAlias(), f2, new Hashtable<>(), null);
}

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(extensionAlias());
service.unregisterFilter(f1);
service.unregisterFilter(f2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class TestFilter7 extends AbstractTestServlet {

@Override
public void activate(ComponentContext componentContext) throws ServletException, NamespaceException {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.registerServlet(extensionAlias(), this, null, null);
service.registerFilter(extensionAlias(), f1, new Hashtable<>(), null);
service.registerFilter(extensionAlias(), f2, new Hashtable<>(), null);
Expand All @@ -45,7 +45,7 @@ public void activate(ComponentContext componentContext) throws ServletException,

@Override
public void deactivate() {
ExtendedHttpService service = (ExtendedHttpService)getHttpService();
ExtendedHttpService service = (ExtendedHttpService) getHttpService();
service.unregister(extensionAlias());
service.unregisterFilter(f1);
service.unregisterFilter(f2);
Expand Down
Loading
Loading