Skip to content

Commit

Permalink
Merge 3fbfd15 into 8a1d9ca
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Jan 12, 2015
2 parents 8a1d9ca + 3fbfd15 commit f8ec6d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/source/manual/core.rst
Expand Up @@ -393,13 +393,13 @@ Serving Assets
Either your application or your static assets can be served from the root path, but
not both. The latter is useful when using Dropwizard to back a Javascript
application. To enable it, move your application to a sub-URL.
application. To enable it, move your Jersey resources to a sub-URL.
.. code-block:: yaml
server:
type: simple
rootPath: /application/*
rootPath: /resources/*
Then use an extended ``AssetsBundle`` constructor to serve resources in the
``assets`` folder from the root path. ``index.htm`` is served as the default
Expand Down
Expand Up @@ -233,7 +233,7 @@ public abstract class AbstractServerFactory implements ServerFactory {
private Set<String> allowedMethods = AllowedMethodsFilter.DEFAULT_ALLOWED_METHODS;

@NotEmpty
private String jerseyRootPath = "/*";
private String jerseyRootPath = "/";

@JsonIgnore
@ValidationMethod(message = "must have a smaller minThreads than maxThreads")
Expand Down Expand Up @@ -459,7 +459,14 @@ protected Handler createAppServlet(Server server,
handler.addFilter(holder, "/*", EnumSet.allOf(DispatcherType.class));
}
if (jerseyContainer != null) {
jersey.setUrlPattern(jerseyRootPath);
String urlPattern = jerseyRootPath;
if (!urlPattern.endsWith("/")) {
urlPattern += "/";
}
if (!urlPattern.endsWith("*")) {
urlPattern += "*";
}
jersey.setUrlPattern(urlPattern);
jersey.register(new JacksonMessageBodyProvider(objectMapper, validator));
if (registerDefaultExceptionMappers == null || registerDefaultExceptionMappers) {
jersey.register(new LoggingExceptionMapper<Throwable>() {
Expand Down
Expand Up @@ -34,7 +34,7 @@ public class DropwizardResourceConfig extends ResourceConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(DropwizardResourceConfig.class);
private static final String NEWLINE = String.format("%n");

private String urlPattern;
private String urlPattern = "/*";

public DropwizardResourceConfig(MetricRegistry metricRegistry) {
this(false, metricRegistry);
Expand All @@ -52,8 +52,6 @@ public DropwizardResourceConfig(boolean testOnly, MetricRegistry metricRegistry)
metricRegistry = new MetricRegistry();
}

urlPattern = "/*";

property(ServerProperties.WADL_FEATURE_DISABLE, Boolean.TRUE);
if (!testOnly) {
// create a subclass to pin it to Throwable
Expand Down

0 comments on commit f8ec6d5

Please sign in to comment.