/** * Create a registration from the mapping {@link String}. * The part of the <tt>mapping</tt> before the second slash '/' occurrence will * be treated as <tt>context-path</tt> and the remainder will be treated as * a <tt>url-pattern</tt>. * For example: * 1) "" will be treated as context-path("") and url-pattern(""); * 2) "/" will be treated as context-path("") and url-pattern("/"); * 3) "/a/b/c" will be treated as context-path("/a") and url-pattern("/b/c"); * 4) "/*" will be treated as context-path("") and url-pattern("/*") * 5) "*.jpg" will be treated as context-path("") and url-pattern("*.jpg") * * @param mapping the {@link String} * @return {@link HttpHandlerRegistration} */ public static HttpHandlerRegistration fromString(final String mapping) { if (mapping == null) { return ROOT; } final String contextPath = getContextPath(mapping); return new HttpHandlerRegistration(contextPath, getWrapperPath(contextPath, mapping)); }
/** * @return the <tt>HttpHandlerRegistration</tt> builder. * * @deprecated typo :( */ public static Builder bulder() { return builder(); }
config.addHttpHandler(handler, HttpHandlerRegistration.bulder().contextPath(contextPath).build());
final String contextPath = regs[i].getContextPath(); final String urlPattern = regs[i].getUrlPattern();
public HttpHandlerRegistration build() { if (contextPath == null) { contextPath = ""; } if (urlPattern == null) { urlPattern = "/"; } return new HttpHandlerRegistration(contextPath, urlPattern); } }
/** * Adds the specified {@link HttpHandler} * with its associated mapping(s). Requests will be dispatched to a * {@link HttpHandler} based on these mapping * values. * * @param httpHandler a {@link HttpHandler} * @param mappings context path mapping information. */ public void addHttpHandler(final HttpHandler httpHandler, final String... mappings) { if (mappings == null || mappings.length == 0) { addHttpHandler(httpHandler, ROOT_MAPPING); return; } final HttpHandlerRegistration[] registrations = new HttpHandlerRegistration[mappings.length]; for (int i = 0; i < mappings.length; i++) { registrations[i] = HttpHandlerRegistration.fromString(mappings[i]); } addHttpHandler(httpHandler, registrations); }
final String contextPath = regs[i].getContextPath(); final String urlPattern = regs[i].getUrlPattern();
public HttpHandlerRegistration build() { if (contextPath == null) { contextPath = ""; } if (urlPattern == null) { urlPattern = "/"; } return new HttpHandlerRegistration(contextPath, urlPattern); } }
/** * Adds the specified {@link HttpHandler} * with its associated mapping(s). Requests will be dispatched to a * {@link HttpHandler} based on these mapping * values. * * @param httpHandler a {@link HttpHandler} * @param mappings context path mapping information. */ public void addHttpHandler(final HttpHandler httpHandler, final String... mappings) { if (mappings == null || mappings.length == 0) { addHttpHandler(httpHandler, ROOT_MAPPING); return; } final HttpHandlerRegistration[] registrations = new HttpHandlerRegistration[mappings.length]; for (int i = 0; i < mappings.length; i++) { registrations[i] = HttpHandlerRegistration.fromString(mappings[i]); } addHttpHandler(httpHandler, registrations); }
final String contextPath = regs[i].getContextPath(); final String urlPattern = regs[i].getUrlPattern();
/** * Create a registration from the mapping {@link String}. * The part of the <tt>mapping</tt> before the second slash '/' occurrence will * be treated as <tt>context-path</tt> and the remainder will be treated as * a <tt>url-pattern</tt>. * For example: * 1) "" will be treated as context-path("") and url-pattern(""); * 2) "/" will be treated as context-path("") and url-pattern("/"); * 3) "/a/b/c" will be treated as context-path("/a") and url-pattern("/b/c"); * 4) "/*" will be treated as context-path("") and url-pattern("/*") * 5) "*.jpg" will be treated as context-path("") and url-pattern("*.jpg") * * @param mapping the {@link String} * @return {@link HttpHandlerRegistration} */ public static HttpHandlerRegistration fromString(final String mapping) { if (mapping == null) { return ROOT; } final String contextPath = getContextPath(mapping); return new HttpHandlerRegistration(contextPath, getWrapperPath(contextPath, mapping)); }
/** * @return the <tt>HttpHandlerRegistration</tt> builder. * * @deprecated typo :( */ public static Builder bulder() { return builder(); }
public HttpHandlerRegistration build() { if (contextPath == null) { contextPath = ""; } if (urlPattern == null) { urlPattern = "/"; } return new HttpHandlerRegistration(contextPath, urlPattern); } }
/** * Adds the specified {@link HttpHandler} * with its associated mapping(s). Requests will be dispatched to a * {@link HttpHandler} based on these mapping * values. * * @param httpHandler a {@link HttpHandler} * @param mappings context path mapping information. */ public void addHttpHandler(final HttpHandler httpHandler, final String... mappings) { if (mappings == null || mappings.length == 0) { addHttpHandler(httpHandler, ROOT_MAPPING); return; } final HttpHandlerRegistration[] registrations = new HttpHandlerRegistration[mappings.length]; for (int i = 0; i < mappings.length; i++) { registrations[i] = HttpHandlerRegistration.fromString(mappings[i]); } addHttpHandler(httpHandler, registrations); }
private void addJerseyHandler(ResourceConfig resourceConfig, String mapping) { HttpHandler handler = ContainerFactory.createContainer(HttpHandler.class, resourceConfig); httpServer.getServerConfiguration().addHttpHandler(handler, HttpHandlerRegistration.bulder().contextPath(mapping).build()); LOG.log(Level.INFO, I18NBundle.getBundle().getMessage( LocalStringKeys.HTTP_REST_REGISTER_APPLICATION, resourceConfig.getApplication().getClass().getName(), mapping)); }
final String contextPath = regs[i].getContextPath(); final String urlPattern = regs[i].getUrlPattern();
/** * Create a registration from the mapping {@link String}. * The part of the <tt>mapping</tt> before the second slash '/' occurrence will * be treated as <tt>context-path</tt> and the remainder will be treated as * a <tt>url-pattern</tt>. * For example: * 1) "" will be treated as context-path("") and url-pattern(""); * 2) "/" will be treated as context-path("") and url-pattern("/"); * 3) "/a/b/c" will be treated as context-path("/a") and url-pattern("/b/c"); * 4) "/*" will be treated as context-path("") and url-pattern("/*") * 5) "*.jpg" will be treated as context-path("") and url-pattern("*.jpg") * * @param mapping the {@link String} * @return {@link HttpHandlerRegistration} */ public static HttpHandlerRegistration fromString(final String mapping) { if (mapping == null) { return ROOT; } final String contextPath = getContextPath(mapping); return new HttpHandlerRegistration(contextPath, getWrapperPath(contextPath, mapping)); }
/** * @return the <tt>HttpHandlerRegistration</tt> builder. * * @deprecated typo :( */ public static Builder bulder() { return builder(); }
public HttpHandlerRegistration build() { if (contextPath == null) { contextPath = ""; } if (urlPattern == null) { urlPattern = "/"; } return new HttpHandlerRegistration(contextPath, urlPattern); } }
/** * Adds the specified {@link HttpHandler} * with its associated mapping(s). Requests will be dispatched to a * {@link HttpHandler} based on these mapping * values. * * @param httpHandler a {@link HttpHandler} * @param mappings context path mapping information. */ public void addHttpHandler(final HttpHandler httpHandler, final String... mappings) { if (mappings == null || mappings.length == 0) { addHttpHandler(httpHandler, ROOT_MAPPING); return; } final HttpHandlerRegistration[] registrations = new HttpHandlerRegistration[mappings.length]; for (int i = 0; i < mappings.length; i++) { registrations[i] = HttpHandlerRegistration.fromString(mappings[i]); } addHttpHandler(httpHandler, registrations); }