Package io.fabric8.gateway.model

Examples of io.fabric8.gateway.model.HttpProxyRule


  }

  @Override
  public INodeStatistics getNodeStats(String nodeId) {
    if (nodeId != null) {
      CamelProcessorMBean processorMBean = camelContextNode.getProcessorMBean(nodeId);
      if (processorMBean != null) {
        return new ProcessorNodeStatistics(processorMBean);
      }
    }
    return null;
View Full Code Here


        TcpClientRequestFacade requestFacade = new TcpClientRequestFacade(socket);
        String path = pathLoadBalancer.choose(paths, requestFacade);
        if (path != null) {
            List<ServiceDetails> services = serviceMap.getServices(path);
            if (!services.isEmpty()) {
                ServiceDetails serviceDetails = serviceLoadBalancer.choose(services, requestFacade);
                if (serviceDetails != null) {
                    List<String> urlStrings = serviceDetails.getServices();
                    for (String urlString : urlStrings) {
                        if (Strings.notEmpty(urlString)) {
                            // lets create a client for this request...
                            try {
                                URI uri = new URI(urlString);
View Full Code Here

            JsonNode config = OM.readTree(in);
            JsonNode globalCookiePath = config.get("cookiePath");
            JsonNode globalDomain = config.get("cookieDomain");
            for (JsonNode entry : getRuleBase(config)) {
                String rule = entry.get("rule").asText();
                map.put(rule, new HttpProxyRule(rule)
                        .to(entry.get("to").asText())
                        .setCookiePath(getGlobal(entry, globalCookiePath, "cookiePath"))
                        .setCookieDomain(getGlobal(entry, globalDomain, "cookieDomain")));
            }
            return map;
View Full Code Here

    public void parseWithCookiePath() throws Exception {
        final InputStream in = JsonRuleBaseBuilder.newRuleBase()
                .rule("/foo/{path}", "https://foo.com/cheese/{path}", "/cookiePath")
                .inputStream();
        final Map<String, HttpProxyRule> rules = JsonRuleBaseReader.parseJson(in);
        final HttpProxyRule httpProxyRule = rules.get("/foo/{path}");
        assertThat(httpProxyRule.getCookiePath(), equalTo("/cookiePath"));
    }
View Full Code Here

    public void parseWithCookiePathAndCookieDomain() throws Exception {
        final InputStream in = JsonRuleBaseBuilder.newRuleBase()
                .rule("/foo/{path}", "https://foo.com/cheese/{path}", "/cookiePath", ".domain.com")
                .inputStream();
        final Map<String, HttpProxyRule> rules = JsonRuleBaseReader.parseJson(in);
        final HttpProxyRule httpProxyRule = rules.get("/foo/{path}");
        assertThat(httpProxyRule.getCookiePath(), equalTo("/cookiePath"));
        assertThat(httpProxyRule.getCookieDomain(), equalTo(".domain.com"));
    }
View Full Code Here

        }
    }

    protected ProxyDetails createProxyDetails(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        HttpMappingResult mappingRule = getResolver().findMappingRule(httpServletRequest, httpServletResponse);
        final HttpProxyRule proxyRule = mappingRule.getProxyRule();
        if (mappingRule != null) {
            String destinationUrl = mappingRule.getDestinationUrl(new HttpClientRequestFacade(httpServletRequest, httpServletResponse));
            if (destinationUrl != null) {
                return new ProxyDetails(true, destinationUrl, proxyRule);
            }
View Full Code Here

        // Pass response headers back to the client
        Header[] headerArrayResponse = httpMethodProxyRequest.getResponseHeaders();
        for (Header header : headerArrayResponse) {
            if (!ProxySupport.isHopByHopHeader(header.getName())) {
                if (ProxySupport.isSetCookieHeader(header)) {
                    HttpProxyRule proxyRule = proxyDetails.getProxyRule();
                    String setCookie = ProxySupport.replaceCookieAttributes(header.getValue(),
                            proxyRule.getCookiePath(),
                            proxyRule.getCookieDomain());
                    httpServletResponse.setHeader(header.getName(), setCookie);
                } else {
                    httpServletResponse.setHeader(header.getName(), header.getValue());
                }
            }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
   */
  @Override
  public Image getImage(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return getLevelImage(le);
    }
    return super.getImage(element);
  }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
   */
  @Override
  public String getText(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return le.getLevel();
    }
    return super.getText(element);
  }
View Full Code Here

   * org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.
   * Object)
   */
  @Override
  public String getToolTipText(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return le.getMessage();
    }
    return super.getToolTipText(element);
  }
View Full Code Here

TOP

Related Classes of io.fabric8.gateway.model.HttpProxyRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.