I have recently swopped out SpringFox for SpringDoc.
Previously I was able to exclude paths to be used for the Swagger UI like so:
new Docket(DocumentationType.SWAGGER_2).paths(Predicates.not(PathSelectors.regex("/path1/.*|/path2/.*|/path4/.*")))
In the case above, the Swagger UI would display for path3 and path5.
Making use of the GroupedOpenAPI when using SpringDoc, I have only seen a way to explicitly set which paths should be allowed e.g.
GroupedOpenApi.builder()
.pathsToMatch("/path3/**", "/path5/**")
I would prefer to have a more generic way, whereby I can specify which paths NOT to allow, so if I add further paths they will be allowed by default. Something like:
GroupedOpenApi.builder()
.pathsToMatch("!/path1/**", "!/path2/**", "!/path4/**")
Not sure if there is any functionality like this supported. Any help would be appreciated. Thank you.
You can use the follwoing property, to exclude paths (Tested with v1.2.32)
springdoc.paths-to-exclude= /test
Or:
GroupedOpenApi.builder()
.pathsToExclude("!/path1/**", "!/path2/**", "!/path4/**")
Related
I'd like to use same page for all subdirectories in Razor pages.
I have this in startup:
services.AddRazorPages(options =>
{
options.Conventions.AddPageRoute("/test", "{path?}");
});
But this only matches first subdirectory, such as test/my. Is it possible to match "test/my/many/wishes" and similar requests?
I'd like to avoid url rewriting, as I think using the routing approach then also helps with link formatting etc.
I know, it's a basic one. But I couldn't find it at first - here it is for root:
options.Conventions.AddPageRoute("/index", "{*url}");
https://www.learnrazorpages.com/razor-pages/routing
So the first thing I want to do with a new Polymer app is deploy to a directory on an existing website. The only thing that seems to work is deploying to root /.
Let's take the Shop example. I do:
polymer init and choose shop
polymer build
Robocopy.exe .\build\bundled\ C:\inetpub\wwwroot\p\ /MIR
start http://localhost/p/
You see I'm on Windows. I assume that using IIS is irrelevant, since I'm relying on the server just to serve static content.
What do I need to edit in the shop template to make it work at the url http://localhost/p/?
The polymer-cli created apps came with assumption of serving from root level '/'. In generated project index.html you will find two comments
<!--
The `<base>` tag below is present to support two advanced deployment options:
1) Differential serving. 2) Serving from a non-root path.
Instead of manually editing the `<base>` tag yourself, you should generally either:
a) Add a `basePath` property to the build configuration in your `polymer.json`.
b) Use the `--base-path` command-line option for `polymer build`.
Note: If you intend to serve from a non-root path, see [polymer-root-path] below.
-->
<base href="/">
<!-- ... -->
<script>
/**
* [polymer-root-path]
*
* By default, we set `Polymer.rootPath` to the server root path (`/`).
* Leave this line unchanged if you intend to serve your app from the root
* path (e.g., with URLs like `my.domain/` and `my.domain/view1`).
*
* If you intend to serve your app from a non-root path (e.g., with URLs
* like `my.domain/my-app/` and `my.domain/my-app/view1`), edit this line
* to indicate the path from which you'll be serving, including leading
* and trailing slashes (e.g., `/my-app/`).
*/
window.Polymer = {rootPath: '/'};
// ...
</script>
if in this index.html file you comment out base tag and set window.Polymer rootPath to something like '/0/polymer-test/build/es5-bundled/' you will be able to navigate in app on http://localhost/0/polymer-test/build/es5-bundled/
The Polymer shop-app assumes it will be deployed on the server root. Therefore it has all of the links and routes hard-coded to that assumption.
This means, that you will have to change all of the following:
all absolute links between the pages,
all pattern parameters in app-route elements (this is not necessary when useHashAsPath = true),
all absolute imports, including the lazy ones via importHref,
update the absolute locations within the service worker (use instructions from here) and
all references to static content (CSS, images, JS files)
I'm guessing your main goal isn't porting the shop-app, but rather future proofing your own app so that it can also be deployed to non-root locations on the server.
For this, I will mention two ways, depending on which value of useHashAsPath you use for the app-location element. This setting defaults to false, which means that you must use full URLs, instead of the hashbang equivalents.
Scenario 1: useHashAsPath = true
This is the easiest of both approaches, since you simply treat all URLs between the pages as absolute links. For example: Tabs.
The next step is to reference all static content and imports via relative links.
The last step is to update your service worker as shown here.
Scenario 2: useHashAsPath = false
If you dislike the hashbang URLs, go for this scenario. As you can figure out, this approach is a bit more difficult, but still manageable (especially when you start from scratch).
Firstly, you should still use absolute links, since relative links between a complex routing scheme can quickly cause problems (e.g. when not all pages are on the same directory level).
But since absolute links are a no-go, you will have to add some additional pre-processing upon build time. The point is to prefix all links with, say __ROOT__, and then replace all of those values with your actual document root. The links would then look like something this:
Some page
And you would use gulp-replace or something similar to replace __ROOT_ with /your-document-root across all of your source files in order to produce something like this:
Some page
At this point, you've got your links fixed. But this is only part of the problem. You must also apply the same fix to all of your app-route elements. For example:
<app-route pattern="__ROOT__/some/page" [...]></app-route> // Other parameters ommited
As with other resources, such as images and CSS files, you can also include them as absolute links and add the __ROOT__ prefix, but I would advise against this and would rather use relative paths.
The last step is to update your service worker as shown here.
Read more about routing: https://www.polymer-project.org/1.0/blog/routing
I am using the "main-bower-files" gulp plugin. There is a bower library that is huge... I want to ignore it in my list called "fatjslib.js". My current regex filter is as follows:
var listOfBower = mainBowerFiles({filter: (/.*\.js$/i)});
This picks up "fatjslib.js" and when I print out the above variable, I see:
"\\User\\kmichaels\\storage\\app\\bower_components\\fatjslib\FatJsLib\FatJsLib.js"
How can I specify the filter or change regex, or do something such that the "listOfBower" can ignore the "FatJsLib.js" file? I don't want to specify the whole path if possible, if there is a way to wildcard ignore anything regardless of pathstructure with "FatJsLib", that may be best, but I am open to suggestions. Is the solution flexible to add "AnotherBigLib.js" (should there be a second library under some path structure) to the regex or ignore list?
One way for the "main-bower-files" plugin to stop reading specific bower library is to pass the overrides option in the param or to set the overrides property in bower.json
METHOD 1: To pass the overrides param:
Pass the overrides option to the mainBowerFiles()and set the ignore property to true for the library you wish to ignore.
var listOfBower = mainBowerFiles({"overrides":{"fatjslib":{"ignore":true}}});
METHOD 2: Specify overrides property in bower.json
You can also specify overrides property in bower.json and then there will be no need to pass overrides option as a param. When main-bower-files plugin will read the bower.json file, it will ignore the libraries that are set in overrides property with ignore flag to true.
in bower.json add an overrides property:
"overrides": {
"fatjslib": {
"ignore": true
}
}
in case fatjslib contains multiple js files, and you just want to ignore one while as include another, then you can override main section of the package.
Every package comes with its own bower.json which has a main section. This section contains the file to be injected.
What you can do is, in overrides - override the main section just to keep the files you want to be injected
"overrides": {
"fatjslib": {
"main": ["./dist/another-file.js"]
}
}
and then provide these overrides to mainBowerFiles
How about modifying the regex as follows:
/^(?!.*FatJsLib\.js$).*\.js$/i
And to add more libraries:
/^(?!.*(?:FatJsLib|AnotherBigLib)\.js$).*\.js$/i
Also, if you want to filter anything with FatJsLib in its path try with:
/^(?!.*\\(?:FatJsLib|AnotherBigLib)\\.*$).*\.js$/i
Source: I wrote the regex, you can try it here. Also the main-bower-files documentation states that filter can use any regex.
We want to develop a widget to upload images to containers. This is a very well documented task:
1.- Object Storage Tutorial
2.- Fireware-Wiki
3.- OpenStack Object Storage Docs (Swift)
With all this you can manage to get (download), upload, delete files in a container. This is relatively clear.
On the other hand, we want to develop another widget to display images stored in a container. I think in something like this to show them:
<img src="public_object_url"/>
But I do not know how to do that. Where I get this public URL? Is there a public URL? Is it get in some step during the uploading process?
I am a bit lost how to do that. Any help would be highly appreciated.
Thanks in advance.
EDIT 1
We get blocked displaying images once they are downloaded.
A look inside "img" tags shows this:
what is the string returned by URL.createObjectURL(). If we look inside this link, the browser displays this:
We have decoded the string coming in the property "value" and the image is there!
To get the image from the object storage server we used a very similar code that the one used in the operator Álvaro recommended.
objectstorage.getFile( containerName,
reports[i].urlImagen,{
token: token,
onSuccess: onGetFileSuccess.bind(null, i),
onFailure: onGetFileFailure
});
function onGetFileSuccess(index, picture){
downloadedPicsCont--;
reports[index].urlImagen = URL.createObjectURL(picture);
if(!(downloadedPicsCont > 0)){
MashupPlatform.wiring.pushEvent('reports_output', JSON.stringify(reports));
}
}
The picture variable has the following structure, which seems to be ok too.
What is it happening?
EDIT 2
Finally, we found the reason. We were downloading images that were created directly from the cloud and not with objectStorageAPI. In you upload images from the cloud, when you download them you get them inside cdmi objects so the URL.createObjectURL doesn't not work as expected. In the other hand, if you upload them using objectStorageAPI, when downloading them, they come in raw format, so the method works correctly.
As far as I know, FIWARE Object Storage needs authentication, so there are no such public URL. But... you can download the image using your credentials and then use the URL.createObjectURL method for getting an URL usable in the src attribute of the img element.
It's a bit old, but you can use this operator as reference.
I am writing test scripts for a website using selenium webdriver's perl bindings. The problem I am facing is mentioned below:
I am not able to find some of the web elements (tried every approach: xpath, id, css, etc.) which exist on the web page, although I can click on them as a user.
After debugging through firebug I found that there is a property called base URI. And this has a different value from one web element to another. So whenever BASE URI = URL, I am able find elements and work on them.
But if BASE URI IS NOT EQUAL TO URL I am unable to find web elements.
Here is a sample code for successfull case:
#!/usr/bin/perl -w
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::More "no_plan";
use Test::Exception;
use TAP::Harness;
use Data::Dumper;
use Selenium::Remote::Driver;
use Selenium::Remote::WDKeys;
my $url = 'https://www.xyz.com/';
my $sel = new Selenium::Remote::Driver('browser_name' => 'firefox',
'platform' => 'VISTA');
ok(defined $sel, 'Object loaded fine...');
ok($sel->isa('Selenium::Remote::Driver'), '...and of right type');
$sel->get("$url");
is ($sel->get_title(), 'xyz','Got the right title');
my $elem = $sel->find_element('html/body/div[1]/div/header/div[1]/div/center/div/ul/li[1]/a');
ok(defined $elem, 'packageLink web element defined');
$elem->click();
In this case the DOM structure shows that base uri is the same as url.
Now for unsuccessful the case, the DOM shows the base URI as https://www.xyz.com/epg.php
In the above mentioned code, if I use the $sel->navigate(https://www.xyz.com/epg.php) command just before the find element command then the script will be able to find the elements. But it will be just a static page click and will give no response.
I am a first time user of HTML related tasks. I would appreciate any kind of help.
Thanks,
Abhishek