Search in sources :

Example 1 with MappedResource

use of org.eclipse.jetty.http.pathmap.MappedResource in project jetty.project by eclipse.

the class DefaultServlet method getWelcomeFile.

/* ------------------------------------------------------------ */
@Override
public String getWelcomeFile(String pathInContext) {
    if (_welcomes == null)
        return null;
    String welcome_servlet = null;
    for (int i = 0; i < _welcomes.length; i++) {
        String welcome_in_context = URIUtil.addPaths(pathInContext, _welcomes[i]);
        Resource welcome = getResource(welcome_in_context);
        if (welcome != null && welcome.exists())
            return _welcomes[i];
        if ((_welcomeServlets || _welcomeExactServlets) && welcome_servlet == null) {
            MappedResource<ServletHolder> entry = _servletHandler.getHolderEntry(welcome_in_context);
            if (entry != null && entry.getResource() != _defaultHolder && (_welcomeServlets || (_welcomeExactServlets && entry.getPathSpec().getDeclaration().equals(welcome_in_context))))
                welcome_servlet = welcome_in_context;
        }
    }
    return welcome_servlet;
}
Also used : MappedResource(org.eclipse.jetty.http.pathmap.MappedResource) Resource(org.eclipse.jetty.util.resource.Resource)

Example 2 with MappedResource

use of org.eclipse.jetty.http.pathmap.MappedResource in project jetty.project by eclipse.

the class NativeWebSocketConfiguration method removeMapping.

@Override
public boolean removeMapping(String rawspec) {
    PathSpec pathSpec = toPathSpec(rawspec);
    boolean removed = false;
    for (Iterator<MappedResource<WebSocketCreator>> iterator = mappings.iterator(); iterator.hasNext(); ) {
        MappedResource<WebSocketCreator> mapping = iterator.next();
        if (mapping.getPathSpec().equals(pathSpec)) {
            iterator.remove();
            removed = true;
        }
    }
    return removed;
}
Also used : WebSocketCreator(org.eclipse.jetty.websocket.servlet.WebSocketCreator) RegexPathSpec(org.eclipse.jetty.http.pathmap.RegexPathSpec) ServletPathSpec(org.eclipse.jetty.http.pathmap.ServletPathSpec) UriTemplatePathSpec(org.eclipse.jetty.http.pathmap.UriTemplatePathSpec) PathSpec(org.eclipse.jetty.http.pathmap.PathSpec) MappedResource(org.eclipse.jetty.http.pathmap.MappedResource)

Aggregations

MappedResource (org.eclipse.jetty.http.pathmap.MappedResource)2 PathSpec (org.eclipse.jetty.http.pathmap.PathSpec)1 RegexPathSpec (org.eclipse.jetty.http.pathmap.RegexPathSpec)1 ServletPathSpec (org.eclipse.jetty.http.pathmap.ServletPathSpec)1 UriTemplatePathSpec (org.eclipse.jetty.http.pathmap.UriTemplatePathSpec)1 Resource (org.eclipse.jetty.util.resource.Resource)1 WebSocketCreator (org.eclipse.jetty.websocket.servlet.WebSocketCreator)1