net.lightbody.bmp.proxy.RewriteRule Java Examples

The following examples show how to use net.lightbody.bmp.proxy.RewriteRule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrowserMobProxyServer.java    From CapturePacket with MIT License 5 votes vote down vote up
@Override
public void rewriteUrls(Map<String, String> rewriteRules) {
    List<RewriteRule> newRules = new ArrayList<>(rewriteRules.size());
    for (Map.Entry<String, String> rewriteRule : rewriteRules.entrySet()) {
        RewriteRule newRule = new RewriteRule(rewriteRule.getKey(), rewriteRule.getValue());
        newRules.add(newRule);
    }

    this.rewriteRules = new CopyOnWriteArrayList<>(newRules);
}
 
Example #2
Source File: BrowserMobProxyServer.java    From CapturePacket with MIT License 5 votes vote down vote up
@Override
public Map<String, String> getRewriteRules() {
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    for (RewriteRule rewriteRule : rewriteRules) {
        builder.put(rewriteRule.getPattern().pattern(), rewriteRule.getReplace());
    }

    return builder.build();
}
 
Example #3
Source File: BrowserMobProxyServer.java    From CapturePacket with MIT License 5 votes vote down vote up
@Override
public void removeRewriteRule(String urlPattern) {
    // normally removing elements from the list we are iterating over would not be possible, but since this is a CopyOnWriteArrayList
    // the iterator it returns is a "snapshot" of the list that will not be affected by removal (and that does not support removal, either)
    for (RewriteRule rewriteRule : rewriteRules) {
        if (rewriteRule.getPattern().pattern().equals(urlPattern)) {
            rewriteRules.remove(rewriteRule);
        }
    }
}
 
Example #4
Source File: RewriteUrlFilter.java    From CapturePacket with MIT License 5 votes vote down vote up
public RewriteUrlFilter(HttpRequest originalRequest, ChannelHandlerContext ctx, Collection<RewriteRule> rewriterules) {
    super(originalRequest, ctx);

    if (rewriterules != null) {
        this.rewriteRules = rewriterules;
    } else {
        this.rewriteRules = Collections.emptyList();
    }
}
 
Example #5
Source File: BrowserMobProxyServer.java    From Dream-Catcher with MIT License 5 votes vote down vote up
@Override
public void rewriteUrls(Map<String, String> rewriteRules) {
    List<RewriteRule> newRules = new ArrayList<>(rewriteRules.size());
    for (Map.Entry<String, String> rewriteRule : rewriteRules.entrySet()) {
        RewriteRule newRule = new RewriteRule(rewriteRule.getKey(), rewriteRule.getValue());
        newRules.add(newRule);
    }

    this.rewriteRules = new CopyOnWriteArrayList<>(newRules);
}
 
Example #6
Source File: BrowserMobProxyServer.java    From Dream-Catcher with MIT License 5 votes vote down vote up
@Override
public Map<String, String> getRewriteRules() {
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    for (RewriteRule rewriteRule : rewriteRules) {
        builder.put(rewriteRule.getPattern().pattern(), rewriteRule.getReplace());
    }

    return builder.build();
}
 
Example #7
Source File: BrowserMobProxyServer.java    From Dream-Catcher with MIT License 5 votes vote down vote up
@Override
public void removeRewriteRule(String urlPattern) {
    // normally removing elements from the list we are iterating over would not be possible, but since this is a CopyOnWriteArrayList
    // the iterator it returns is a "snapshot" of the list that will not be affected by removal (and that does not support removal, either)
    for (RewriteRule rewriteRule : rewriteRules) {
        if (rewriteRule.getPattern().pattern().equals(urlPattern)) {
            rewriteRules.remove(rewriteRule);
        }
    }
}
 
Example #8
Source File: RewriteUrlFilter.java    From Dream-Catcher with MIT License 5 votes vote down vote up
public RewriteUrlFilter(HttpRequest originalRequest, ChannelHandlerContext ctx, Collection<RewriteRule> rewriterules) {
    super(originalRequest, ctx);

    if (rewriterules != null) {
        this.rewriteRules = rewriterules;
    } else {
        this.rewriteRules = Collections.emptyList();
    }
}
 
Example #9
Source File: BrowserMobProxyServer.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
public void rewriteUrls(Map<String, String> rewriteRules) {
    List<RewriteRule> newRules = new ArrayList<>(rewriteRules.size());
    for (Map.Entry<String, String> rewriteRule : rewriteRules.entrySet()) {
        RewriteRule newRule = new RewriteRule(rewriteRule.getKey(), rewriteRule.getValue());
        newRules.add(newRule);
    }

    this.rewriteRules = new CopyOnWriteArrayList<>(newRules);
}
 
Example #10
Source File: BrowserMobProxyServer.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
public Map<String, String> getRewriteRules() {
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    for (RewriteRule rewriteRule : rewriteRules) {
        builder.put(rewriteRule.getPattern().pattern(), rewriteRule.getReplace());
    }

    return builder.build();
}
 
Example #11
Source File: BrowserMobProxyServer.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
public void removeRewriteRule(String urlPattern) {
    // normally removing elements from the list we are iterating over would not be possible, but since this is a CopyOnWriteArrayList
    // the iterator it returns is a "snapshot" of the list that will not be affected by removal (and that does not support removal, either)
    for (RewriteRule rewriteRule : rewriteRules) {
        if (rewriteRule.getPattern().pattern().equals(urlPattern)) {
            rewriteRules.remove(rewriteRule);
        }
    }
}
 
Example #12
Source File: RewriteUrlFilter.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
public RewriteUrlFilter(HttpRequest originalRequest, ChannelHandlerContext ctx, Collection<RewriteRule> rewriterules) {
    super(originalRequest, ctx);

    if (rewriterules != null) {
        this.rewriteRules = rewriterules;
    } else {
        this.rewriteRules = Collections.emptyList();
    }
}
 
Example #13
Source File: BrowserMobProxyServer.java    From CapturePacket with MIT License 4 votes vote down vote up
@Override
public void rewriteUrl(String pattern, String replace) {
    rewriteRules.add(new RewriteRule(pattern, replace));
}
 
Example #14
Source File: BrowserMobProxyServer.java    From Dream-Catcher with MIT License 4 votes vote down vote up
@Override
public void rewriteUrl(String pattern, String replace) {
    rewriteRules.add(new RewriteRule(pattern, replace));
}
 
Example #15
Source File: BrowserMobProxyServer.java    From AndroidHttpCapture with MIT License 4 votes vote down vote up
@Override
public void rewriteUrl(String pattern, String replace) {
    rewriteRules.add(new RewriteRule(pattern, replace));
}