code
stringlengths
73
34.1k
label
stringclasses
1 value
private String getApiId(Contract contract) { return getApiId(contract.getApiOrgId(), contract.getApiId(), contract.getApiVersion()); }
java
public static final String produceToken(String principal, Set<String> roles, int expiresInMillis) { AuthToken authToken = createAuthToken(principal, roles, expiresInMillis); String json = toJSON(authToken); return StringUtils.newStringUtf8(Base64.encodeBase64(StringUtils.getBytesUtf8(json))); ...
java
public static final void validateToken(AuthToken token) throws IllegalArgumentException { if (token.getExpiresOn().before(new Date())) { throw new IllegalArgumentException("Authentication token expired: " + token.getExpiresOn()); //$NON-NLS-1$ } String validSig = generateSignature(to...
java
public static final AuthToken createAuthToken(String principal, Set<String> roles, int expiresInMillis) { AuthToken token = new AuthToken(); token.setIssuedOn(new Date()); token.setExpiresOn(new Date(System.currentTimeMillis() + expiresInMillis)); token.setPrincipal(principal); t...
java
public static final void signAuthToken(AuthToken token) { String signature = generateSignature(token); token.setSignature(signature); }
java
private static String generateSignature(AuthToken token) { StringBuilder builder = new StringBuilder(); builder.append(token.getPrincipal()); builder.append("||"); //$NON-NLS-1$ builder.append(token.getExpiresOn().getTime()); builder.append("||"); //$NON-NLS-1$ builder.ap...
java
public static final String toJSON(AuthToken token) { try { return mapper.writer().writeValueAsString(token); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static final AuthToken fromJSON(String json) { try { return mapper.reader(AuthToken.class).readValue(json); } catch (Exception e) { throw new RuntimeException(e); } }
java
@Override public final IEngine createEngine() { IPluginRegistry pluginRegistry = createPluginRegistry(); IDataEncrypter encrypter = createDataEncrypter(pluginRegistry); CurrentDataEncrypter.instance = encrypter; IRegistry registry = createRegistry(pluginRegistry, encrypter); ...
java
protected Map<String, String> getPrefixedProperties(String prefix) { Map<String, String> rval = new HashMap<>(); Iterator<String> keys = getConfig().getKeys(); while (keys.hasNext()) { String key = keys.next(); if (key.startsWith(prefix)) { String value = ...
java
protected static RateBucketPeriod getPeriod(RateLimitingConfig config) { RateLimitingPeriod period = config.getPeriod(); switch (period) { case Second: return RateBucketPeriod.Second; case Day: return RateBucketPeriod.Day; case Hour: return Rat...
java
private void setConnectTimeout(HttpURLConnection connection) { try { Map<String, String> endpointProperties = this.api.getEndpointProperties(); if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$ int connectTimeoutMs = new Integer(endpointProperties.ge...
java
public static final void main(String [] args) throws Exception { ManagerApiMicroService microService = new ManagerApiMicroService(); microService.start(); microService.join(); }
java
public static int length(String... args) { if (args == null) return 0; int acc = 0; for (String arg : args) { acc += arg.length(); } return acc; }
java
private static void outputMessages(TreeMap<String, String> strings, File outputFile) throws FileNotFoundException { PrintWriter writer = new PrintWriter(new FileOutputStream(outputFile)); for (Entry<String, String> entry : strings.entrySet()) { String key = entry.getKey(); String...
java
private static File getPluginDir() { String dataDirPath = System.getProperty("jboss.server.data.dir"); //$NON-NLS-1$ File dataDir = new File(dataDirPath); if (!dataDir.isDirectory()) { throw new RuntimeException("Failed to find WildFly data directory at: " + dataDirPath); //$NON-NLS-...
java
public JestClient createClient(Map<String, String> config, String defaultIndexName) { JestClient client; String indexName = config.get("client.index"); //$NON-NLS-1$ if (indexName == null) { indexName = defaultIndexName; } client = createLocalClient(config, indexName,...
java
public JestClient createLocalClient(Map<String, String> config, String indexName, String defaultIndexName) { String clientLocClassName = config.get("client.class"); //$NON-NLS-1$ String clientLocFieldName = config.get("client.field"); //$NON-NLS-1$ return createLocalClient(clientLocClassName, cl...
java
public JestClient createLocalClient(String className, String fieldName, String indexName, String defaultIndexName) { String clientKey = "local:" + className + '/' + fieldName; //$NON-NLS-1$ synchronized (clients) { if (clients.containsKey(clientKey)) { return clients.get(clie...
java
protected ClientVersionBean createClientVersionInternal(NewClientVersionBean bean, ClientBean client) throws StorageException { if (!BeanUtils.isValidVersion(bean.getVersion())) { throw new StorageException("Invalid/illegal client version: " + bean.getVersion()); //$NON-NLS-1$ } ...
java
protected ContractBean createContractInternal(String organizationId, String clientId, String version, NewContractBean bean) throws StorageException, Exception { ContractBean contract; ClientVersionBean cvb; cvb = storage.getClientVersion(organizationId, clientId, version); if...
java
private boolean contractAlreadyExists(String organizationId, String clientId, String version, NewContractBean bean) { try { List<ContractSummaryBean> contracts = query.getClientContracts(organizationId, clientId, version); for (ContractSummaryBean contract : contracts) { ...
java
protected ApiRegistryBean getApiRegistry(String organizationId, String clientId, String version, boolean hasPermission) throws ClientNotFoundException, NotAuthorizedException { // Try to get the client first - will throw a ClientNotFoundException if not found. ClientVersionBean clientVersion...
java
protected PlanVersionBean createPlanVersionInternal(NewPlanVersionBean bean, PlanBean plan) throws StorageException { if (!BeanUtils.isValidVersion(bean.getVersion())) { throw new StorageException("Invalid/illegal plan version: " + bean.getVersion()); //$NON-NLS-1$ } Pla...
java
protected PolicyBean doGetPolicy(PolicyType type, String organizationId, String entityId, String entityVersion, long policyId) throws PolicyNotFoundException { try { storage.beginTx(); PolicyBean policy = storage.getPolicy(type, organizationId, entityId, entityVersion, policy...
java
private void decryptEndpointProperties(ApiVersionBean versionBean) { Map<String, String> endpointProperties = versionBean.getEndpointProperties(); if (endpointProperties != null) { for (Entry<String, String> entry : endpointProperties.entrySet()) { DataEncryptionContext ctx =...
java
private DateTime parseFromDate(String fromDate) { // Default to the last 30 days DateTime defaultFrom = new DateTime().withZone(DateTimeZone.UTC).minusDays(30).withHourOfDay(0) .withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0); return parseDate(fromDate, defaultFro...
java
private DateTime parseToDate(String toDate) { // Default to now return parseDate(toDate, new DateTime().withZone(DateTimeZone.UTC), false); }
java
private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) { if ("now".equals(dateStr)) { //$NON-NLS-1$ return new DateTime(); } if (dateStr.length() == 10) { DateTime parsed = ISODateTimeFormat.date().withZone(DateTimeZone.UTC).parseDateTime(d...
java
private void validateMetricRange(DateTime from, DateTime to) throws InvalidMetricCriteriaException { if (from.isAfter(to)) { throw ExceptionFactory.invalidMetricCriteriaException(Messages.i18n.format("OrganizationResourceImpl.InvalidMetricDateRange")); //$NON-NLS-1$ } }
java
private void validateTimeSeriesMetric(DateTime from, DateTime to, HistogramIntervalType interval) throws InvalidMetricCriteriaException { long millis = to.getMillis() - from.getMillis(); long divBy = ONE_DAY_MILLIS; switch (interval) { case day: divBy = ONE_DAY_MI...
java
private void validateEndpoint(String endpoint) { try { new URL(endpoint); } catch (MalformedURLException e) { throw new InvalidParameterException(Messages.i18n.format("OrganizationResourceImpl.InvalidEndpointURL")); //$NON-NLS-1$ } }
java
public <T> void delete(T bean) throws StorageException { EntityManager entityManager = getActiveEntityManager(); try { entityManager.remove(bean); } catch (Throwable t) { logger.error(t.getMessage(), t); throw new StorageException(t); } }
java
protected <T> SearchResultsBean<T> find(SearchCriteriaBean criteria, Class<T> type) throws StorageException { SearchResultsBean<T> results = new SearchResultsBean<>(); EntityManager entityManager = getActiveEntityManager(); try { // Set some default in the case that paging informatio...
java
protected <T> int executeCountQuery(SearchCriteriaBean criteria, EntityManager entityManager, Class<T> type) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> countQuery = builder.createQuery(Long.class); Root<T> from = countQuery.from(type); countQuery....
java
public boolean hasQualifiedPermission(PermissionType permissionName, String orgQualifier) { String key = createQualifiedPermissionKey(permissionName, orgQualifier); return qualifiedPermissions.contains(key); }
java
public Set<String> getOrgQualifiers(PermissionType permissionName) { Set<String> orgs = permissionToOrgsMap.get(permissionName); if (orgs == null) orgs = Collections.EMPTY_SET; return Collections.unmodifiableSet(orgs); }
java
private void index(Set<PermissionBean> permissions) { for (PermissionBean permissionBean : permissions) { PermissionType permissionName = permissionBean.getName(); String orgQualifier = permissionBean.getOrganizationId(); String qualifiedPermission = createQualifiedPermission...
java
public boolean isOverwrite() { Boolean booleanObject = BooleanUtils.toBooleanObject(System.getProperty(OVERWRITE)); if (booleanObject == null) { booleanObject = Boolean.FALSE; } return booleanObject; }
java
public void start() { logger.info("----------------------------"); //$NON-NLS-1$ logger.info(Messages.i18n.format("StorageImportDispatcher.StartingImport")); //$NON-NLS-1$ policyDefIndex.clear(); currentOrg = null; currentPlan = null; currentApi = null; currentCl...
java
private PolicyDefinitionBean updatePluginIdInPolicyDefinition(PolicyDefinitionBean policyDef) { if (pluginBeanIdMap.containsKey(policyDef.getPluginId())){ try { Map.Entry<String, String> pluginCoordinates = pluginBeanIdMap.get(policyDef.getPluginId()); PluginBean plug...
java
private void publishApis() throws StorageException { logger.info(Messages.i18n.format("StorageExporter.PublishingApis")); //$NON-NLS-1$ try { for (EntityInfo info : apisToPublish) { logger.info(Messages.i18n.format("StorageExporter.PublishingApi", info)); //$NON-NLS-1$ ...
java
private List<Policy> aggregateContractPolicies(ContractBean contractBean, EntityInfo clientInfo) throws StorageException { List<Policy> policies = new ArrayList<>(); PolicyType [] types = new PolicyType[] { PolicyType.Client, PolicyType.Plan, PolicyType.Api }; for (Policy...
java
protected void doLoadFromClasspath(String policyImpl, IAsyncResultHandler<IPolicy> handler) { IPolicy rval; String classname = policyImpl.substring(6); Class<?> c = null; // First try a simple Class.forName() try { c = Class.forName(classname); } catch (ClassNotFoundException e)...
java
private void doLoadFromPlugin(final String policyImpl, final IAsyncResultHandler<IPolicy> handler) { PluginCoordinates coordinates = PluginCoordinates.fromPolicySpec(policyImpl); if (coordinates == null) { handler.handle(AsyncResultImpl.<IPolicy>create(new PolicyNotFoundException(policyImpl)...
java
private <T> T unmarshalAs(String valueAsString, Class<T> asClass) throws IOException { return mapper.reader(asClass).readValue(valueAsString); }
java
protected void doApply(ApiResponse response, IPolicyContext context, C config, IPolicyChain<ApiResponse> chain) { chain.doApply(response); }
java
protected void doProcessFailure(PolicyFailure failure, IPolicyContext context, C config, IPolicyFailureChain chain) { chain.doFailure(failure); }
java
protected SecurityHandler createSecurityHandler() throws Exception { HashLoginService l = new HashLoginService(); // UserStore is now separate store entity and must be added to HashLoginService UserStore userStore = new UserStore(); l.setUserStore(userStore); for (User user : Use...
java
private static BucketSizeType bucketSizeFromInterval(HistogramIntervalType interval) { BucketSizeType bucketSize; switch (interval) { case minute: bucketSize = BucketSizeType.Minute; break; case hour: bucketSize = BucketSizeType.Hour; break...
java
@SuppressWarnings("nls") private void doInit() { QueryRunner run = new QueryRunner(ds); Boolean isInitialized; try { isInitialized = run.query("SELECT * FROM gw_apis", new ResultSetHandler<Boolean>() { @Override public Boolean handle(Resul...
java
private boolean satisfiesAnyPath(IgnoredResourcesConfig config, String destination, String verb) { if (destination == null || destination.trim().length() == 0) { destination = "/"; //$NON-NLS-1$ } for (IgnoredResource resource : config.getRules()) { String resourceVerb = ...
java
private PublishingException readPublishingException(HttpResponse response) { InputStream is = null; PublishingException exception; try { is = response.getEntity().getContent(); GatewayApiErrorBean error = mapper.reader(GatewayApiErrorBean.class).readValue(is); ...
java
protected static StackTraceElement[] parseStackTrace(String stacktrace) { try (BufferedReader reader = new BufferedReader(new StringReader(stacktrace))) { List<StackTraceElement> elements = new ArrayList<>(); String line; // Example lines: // \tat io.apiman.gatewa...
java
protected <T extends IComponent> void addComponent(Class<T> componentType, T component) { components.put(componentType, component); }
java
public static final void main(String [] args) throws Exception { GatewayMicroService microService = new GatewayMicroService(); microService.start(); microService.join(); }
java
@Override public IApiConnector createConnector(ApiRequest req, Api api, RequiredAuthType authType, boolean hasDataPolicy, IConnectorConfig connectorConfig) { return (request, resultHandler) -> { // Apply options from config as our base case ApimanHttpConnectorOptions httpOptions = ne...
java
private void setAttributesFromApiEndpointProperties(Api api, ApimanHttpConnectorOptions options) { try { Map<String, String> endpointProperties = api.getEndpointProperties(); if (endpointProperties.containsKey("timeouts.read")) { //$NON-NLS-1$ int connectTimeoutMs = Integ...
java
public <T extends IComponent> T createAndRegisterComponent(Class<T> componentType) throws ComponentNotFoundException { try { synchronized (components) { Class<? extends T> componentClass = engineConfig.getComponentClass(componentType, pluginRegistry); Map<String, Stri...
java
protected void addComponentMapping(Class<? extends IComponent> klazz, IComponent component) { components.put(klazz, component); }
java
protected void registerRateLimiterComponent() { String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + IRateLimiterComponent.class.getSimpleName(); setConfigProperty(componentPropName, ESRateLimiterComponent.class.getName()); setConfigProperty(componentPropName + "...
java
protected void registerSharedStateComponent() { String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + ISharedStateComponent.class.getSimpleName(); setConfigProperty(componentPropName, ESSharedStateComponent.class.getName()); setConfigProperty(componentPropName + "...
java
protected void registerCacheStoreComponent() { String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + ICacheStoreComponent.class.getSimpleName(); setConfigProperty(componentPropName, ESCacheStoreComponent.class.getName()); setConfigProperty(componentPropName + ".cl...
java
protected void registerJdbcComponent() { String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + IJdbcComponent.class.getSimpleName(); setConfigProperty(componentPropName, DefaultJdbcComponent.class.getName()); }
java
protected void registerLdapComponent() { String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + ILdapComponent.class.getSimpleName(); setConfigProperty(componentPropName, DefaultLdapComponent.class.getName()); }
java
protected void configureConnectorFactory() { setConfigProperty(GatewayConfigProperties.CONNECTOR_FACTORY_CLASS, HttpConnectorFactory.class.getName()); setConfigProperty(GatewayConfigProperties.CONNECTOR_FACTORY_CLASS + ".http.timeouts.read", "25"); setConfigProperty(GatewayConfigProperties.CONNE...
java
protected void configureRegistry() { setConfigProperty(GatewayConfigProperties.REGISTRY_CLASS, PollCachingESRegistry.class.getName()); setConfigProperty(GatewayConfigProperties.REGISTRY_CLASS + ".client.type", "jest"); setConfigProperty(GatewayConfigProperties.REGISTRY_CLASS + ".client.protocol"...
java
protected void configureMetrics() { setConfigProperty(GatewayConfigProperties.METRICS_CLASS, ESMetrics.class.getName()); setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.type", "jest"); setConfigProperty(GatewayConfigProperties.METRICS_CLASS + ".client.protocol", "${apiman.es.p...
java
protected void setConfigProperty(String propName, String propValue) { if (System.getProperty(propName) == null) { System.setProperty(propName, propValue); } }
java
public boolean resetIfNecessary(RateBucketPeriod period) { long periodBoundary = getLastPeriodBoundary(period); if (System.currentTimeMillis() >= periodBoundary) { setCount(0); return true; } return false; }
java
public long getResetMillis(RateBucketPeriod period) { long now = System.currentTimeMillis(); long periodBoundary = getPeriodBoundary(now, period); return periodBoundary - now; }
java
private static long getPeriodBoundary(long timestamp, RateBucketPeriod period) { Calendar lastCal = Calendar.getInstance(); lastCal.setTimeInMillis(timestamp); switch (period) { case Second: lastCal.set(Calendar.MILLISECOND, 0); lastCal.add(Calendar.SECOND, 1); ...
java
private PluginRegistryBean loadRegistry(URI registryUrl) { PluginRegistryBean fromCache = registryCache.get(registryUrl); if (fromCache != null) { return fromCache; } try { PluginRegistryBean registry = mapper.reader(PluginRegistryBean.class).readValue(registryUrl...
java
public static final PoliciesBean from(PolicyBean policy) { PoliciesBean rval = new PoliciesBean(); rval.setType(policy.getType()); rval.setOrganizationId(policy.getOrganizationId()); rval.setEntityId(policy.getEntityId()); rval.setEntityVersion(policy.getEntityVersion()); ...
java
public static VersionMigratorChain chain(String fromVersion, String toVersion) { List<IVersionMigrator> matchedMigrators = new ArrayList<>(); for (Entry entry : migrators) { if (entry.isBetween(fromVersion, toVersion)) { matchedMigrators.add(entry.migrator); } ...
java
public void createTenant(String tenantId) { TenantBean tenant = new TenantBean(tenantId); try { URL endpoint = serverUrl.toURI().resolve("tenants").toURL(); //$NON-NLS-1$ Request request = new Request.Builder() .url(endpoint) .post(toBody(t...
java
public List<MetricBean> listCounterMetrics(String tenantId) { try { URL endpoint = serverUrl.toURI().resolve("counters").toURL(); //$NON-NLS-1$ Request request = new Request.Builder() .url(endpoint) .header("Accept", "application/json") //$NON-NLS-...
java
public DataPointLongBean addCounterDataPoint(String tenantId, String counterId, Date timestamp, long value) { List<DataPointLongBean> dataPoints = new ArrayList<>(); DataPointLongBean dataPoint = new DataPointLongBean(timestamp, value); dataPoints.add(dataPoint); addCounterDataPoints(ten...
java
public void addMultipleCounterDataPoints(String tenantId, List<MetricLongBean> data) { try { URL endpoint = serverUrl.toURI().resolve("counters/raw").toURL(); //$NON-NLS-1$ Request request = new Request.Builder() .url(endpoint) .post(toBody(data)) ...
java
public static Map<String, String> tags(String ... strings) { Map<String, String> tags = new HashMap<>(); for (int i = 0; i < strings.length - 1; i+=2) { String key = strings[i]; String value = strings[i + 1]; if (key != null && value != null) { tags.pu...
java
protected static String encodeTags(Map<String, String> tags) { if (tags == null) { return null; } try { StringBuilder builder = new StringBuilder(); boolean first = true; for (Entry<String, String> entry : tags.entrySet()) { if (!fi...
java
protected void startCacheInvalidator() { polling = true; Thread thread = new Thread(new Runnable() { @Override public void run() { // Wait for 30s on startup before starting to poll. try { Thread.sleep(startupDelayMillis); } catch (InterruptedExcep...
java
public void chainPolicyHandlers() { IReadWriteStream<H> previousHandler = null; Iterator<PolicyWithConfiguration> iterator = iterator(); while (iterator.hasNext()) { final PolicyWithConfiguration pwc = iterator.next(); final IPolicy policy = pwc.getPolicy(); f...
java
public static KeyManager[] getKeyManagers(Info pathInfo) throws Exception { if (pathInfo.store == null) { return null; } File clientKeyStoreFile = new File(pathInfo.store); if (!clientKeyStoreFile.isFile()) { throw new Exception("No KeyManager: " + pathInfo.store ...
java
public static TrustManager[] getTrustManagers(Info pathInfo) throws Exception { File trustStoreFile = new File(pathInfo.store); if (!trustStoreFile.isFile()) { throw new Exception("No TrustManager: " + pathInfo.store + " does not exist."); } String trustStorePassword = pathIn...
java
private void popLastItem() { KeyValue<K,V> lastKV = items.last(); items.remove(lastKV); index.remove(lastKV.key); }
java
private void validateCredentials(String username, String password, ApiRequest request, IPolicyContext context, BasicAuthenticationConfig config, IAsyncResultHandler<Boolean> handler) { if (config.getStaticIdentity() != null) { staticIdentityValidator.validate(username, password, request,...
java
protected void sendAuthFailure(IPolicyContext context, IPolicyChain<?> chain, BasicAuthenticationConfig config, int reason) { IPolicyFailureFactoryComponent pff = context.getComponent(IPolicyFailureFactoryComponent.class); PolicyFailure failure = pff.createFailure(PolicyFailureType.Authentication, reaso...
java
private String getApiIdx(String orgId, String apiId, String version) { return "API::" + orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
java
protected void unregisterApiContracts(Client client, Connection connection) throws SQLException { QueryRunner run = new QueryRunner(); run.update(connection, "DELETE FROM contracts WHERE client_org_id = ? AND client_id = ? AND client_version = ?", //$NON-NLS-1$ client.getOrganizationId(...
java
protected Api getApiInternal(String organizationId, String apiId, String apiVersion) throws SQLException { QueryRunner run = new QueryRunner(ds); return run.query("SELECT bean FROM gw_apis WHERE org_id = ? AND id = ? AND version = ?", //$NON-NLS-1$ Handlers.API_HANDLER, organizationId, a...
java
protected Client getClientInternal(String apiKey) throws SQLException { QueryRunner run = new QueryRunner(ds); return run.query("SELECT bean FROM gw_clients WHERE api_key = ?", //$NON-NLS-1$ Handlers.CLIENT_HANDLER, apiKey); }
java
protected void doBasicAuth(Creds credentials, HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { try { if (credentials.username.equals(request.getRemoteUser())) { // Already logged in as this user - do nothi...
java
protected void doFilterChain(ServletRequest request, ServletResponse response, FilterChain chain, AuthPrincipal principal) throws IOException, ServletException { if (principal == null) { chain.doFilter(request, response); } else { HttpServletRequest hsr; h...
java
private HttpServletRequest wrapTheRequest(final ServletRequest request, final AuthPrincipal principal) { HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper((HttpServletRequest) request) { @Override public Principal getUserPrincipal() { return principal; ...
java
private Creds parseAuthorizationBasic(String authHeader) { String userpassEncoded = authHeader.substring(6); String data = StringUtils.newStringUtf8(Base64.decodeBase64(userpassEncoded)); int sepIdx = data.indexOf(':'); if (sepIdx > 0) { String username = data.substring(0, se...
java
private AuthToken parseAuthorizationToken(String authHeader) { try { String tokenEncoded = authHeader.substring(11); return AuthTokenUtil.consumeToken(tokenEncoded); } catch (IllegalArgumentException e) { // TODO log this error return null; } }
java
private void sendAuthResponse(HttpServletResponse response) throws IOException { response.setHeader("WWW-Authenticate", String.format("Basic realm=\"%1$s\"", realm)); //$NON-NLS-1$ //$NON-NLS-2$ response.sendError(HttpServletResponse.SC_UNAUTHORIZED); }
java
private void replaceHeaders(URLRewritingConfig config, HeaderMap headers) { for (Entry<String, String> entry : headers) { String key = entry.getKey(); String value = entry.getValue(); value = doHeaderReplaceAll(value, config.getFromRegex(), config.getToReplacement()); ...
java
private String doHeaderReplaceAll(String headerValue, String fromRegex, String toReplacement) { return headerValue.replaceAll(fromRegex, toReplacement); }
java