Add CSS File to WebCenter Sites application - webcenter

I have a WebCenter Sites installation. Separately, I have site.js and site.css files. How can I make a WebCenter Sites template use these two files? Where do i put those files so they can be consumed?
What I've done so far is set up a simple HTTP server outside of WebCenter Sites and used <link> and <script> tags to point to those files on the external server. This does indeed work, but I prefer having the files served from the sites application.
I see sites exposes a CSS type asset, but it seems to be tied to their widget framework. I was thinking to just make an empty widget with CSS, then I could reference the widget/asset in the <link href=. Again there aren't many examples of this online.
Can anyone give me some ideas on how to serve files from within WebCenter Sites?

There are alternatives to storing files directly in the webapp, such as using a custom basic assettype to contain the files, and then delivering them via blobserver (or just rendering inline). The advantage to this is that you are managing assets to keep environments in sync, rather than updating the webapp & redeploying.

The path needs to be relative to the web application context. There are probably better ways to reference it in Sites, but the lowest-common denominator approach that will work for all J2EE web applications is to use pageContext.request.contextPath, so the link would look like:
href="${pageContext.request.contextPath}/src/stylesheets/css/styles.css"
So if this were used with a JSK, the src folder would be under [JSK_HOME]\App_Server\apache-tomcat-7.0.42\Sites\webapps\cs

Related

How to go fully static in Nuxt.js including download links, images, background images?

I can not figure out how to make nuxt generate fully static website. It makes api call static and that is awesome. But all images, and download links still making request to a remote server.
Is it possible to generate fully static website where all links to external files(<img src="remote.jpg">, <a href="remote.pdf", background-image: url('remote.jpg')) will be downloaded and placed in local folder and then every url will be replaced to local files? Or nuxt does SSG only for APIs?
You could totally optimize and put all of your assets into the /static directory indeed.
It will require some CI or any kind of build step to have them properly updated, organized etc but nothing impossible (this will keep everything in the same place). Meanwhile, having resources outside of your server is not bad in the principle itself neither.

How would I host the static HTML, CSS, and JS files to host Swagger UI without using Node?

I want to host the Swagger UI behind the same webserver our API is running on (at least on dev and staging). Is it possible to do that without having to use Node whatsoever? I feel that it should be possible to host the static HTML, CSS and JS files but I can't see how.
This page* on Github suggests that swagger-ui-dist is designed for this scenario but the related page** doesn't really explain how to implement it but seems to show that Node is still required anyway.
I find the docs quite confusing.
*https://github.com/swagger-api/swagger-ui
**https://www.npmjs.com/package/swagger-ui-dist
I just worked it out. All the static files I require are in the dist directory.

Path problems with running a sub application (umbraco) inside my MVC4 web application

I have this MVC4 web application, I run it locally at mySite.local/. I created an application in IIS 7, mapping to mySite.local/corporateSite/. I point that application to an Umbraco (CMS) installation I have locally.
This works pretty well.
I have these UI images and .css files that were in my corporate site and were linked-to by absolute urls (Examples: /css/myCss.css, /media/ui/myFunLogo.png, etc.).
Now this "/" root has changed, if I want my css and images to work, I have to use /corporateSite/cssmyCss.css... this is logical.
How can I change my configuration or sites setup or code so that I don't have to write that whenever I'm linking to a file like that. Should I use rewrite rules to prepend the application url?
How to people integrate these elements normally ? I know a lot go through subdomains, but this would not be ideal for us at the moment.
Thanks for the help!
(I think my question is related to this one how to integrate umbraco with mvc4 but in some different aspects. And the answers are not good for me.)
In umbracoSettings.config, there is a setting for "ResolveUrlsFromTextString".
Setting it to true should tell Umbraco to add the virtual directory name to links and images.

Pull/Display a list of MHTML files in the Public folder and embed them as IFrames in my Rails application views

I have a client that uses SQL Server Reporting Services to generate reports and exports them in MHTML. The Client wants to just push the MHTML in a pre-defined directory structure to my Rails public/reports folder.
Is there any way in Rails to "Take in" the directory structure, create a list of files recursively, generate an unordered list and then create routes dynamically for each MHTML file? I know MHTML files can be embedded with Iframes (although with limited browser support, this is not an issue for me)
The predefined Directory structure is Public/Reports/Dashboard/Exceptions/
Dashboard will contain 1 MHTML file and exceptions (which will be a sort of subnav or child of Dashboard) will contain an undefined amount.
The layout template will be a sort of wrapper.
Anyone who has experience with Rails know the best way of achieving the desired result?
Any help will be sincerely appreciated. I am using Rails 3.0.20 (which doesn't have the Asset pipeline), this will won't be hosted on Heroku (I am aware of no-write permissions)
(Sorry, I'm not super familiar with MHTML files, so I'm going to assume these are just static files that a browser can interpret.)
There is nothing in particular in Rails that provides the behavior that you're referring to. Rails is just a framework to help serve dynamic responses, and the functionality you want is in relation to the filesystem, which Rails mostly abstracts away.
There's a couple options I can think of.
Roll your own
Ruby has file and directory utilities which you could use to read in the contents of a directory in public and render the kind of response you'd like. I would start here:
http://www.ruby-doc.org/core-1.9.3/Dir.html
And play around with ruby's directory globbing to get a file listing.
Use Rack
Rails is built ontop of Rack, a standard webserver interface that most ruby application server implement now. Rack provides some libraries that make serving static assets like a traditional web server a little easier.
Here's a couple of resources to check out:
http://quickleft.com/blog/rack-130-serving-static-files
http://edgeguides.rubyonrails.org/rails_on_rack.html

Apache attack on compromised server, iframe injected by string replace

My server has been compromised recently. This morning, I have discovered that the intruder is injecting an iframe into each of my HTML pages. After testing, I have found out that the way he does that is by getting Apache (?) to replace every instance of
<body>
by
<iframe link to malware></iframe></body>
For example if I browse a file residing on the server consisting of:
</body>
</body>
Then my browser sees a file consisting of:
<iframe link to malware></iframe></body>
<iframe link to malware></iframe></body>
I have immediately stopped Apache to protect my visitors, but so far I have not been able to find what the intruder has changed on the server to perform the attack. I presume he has modified an Apache config file, but I have no idea which one. In particular, I have looked for recently modified files by time-stamp, but did not find anything noteworthy.
Thanks for any help.
Tuan.
PS: I am in the process of rebuilding a new server from scratch, but in the while, I would like to keep the old one running, since this is a business site.
I don't know the details of your compromised server. While this is a fairly standard drive-by attack against Apache that you can, ideally, resolve by rolling back to a previous version of your web content and server configuration (if you have a colo, contact the technical team responsible for your backups), let's presume you're entirely on your own and need to fix the problem yourself.
Pulling from StopBadware.org's documentation on the most common drive-by scenarios and resolution cases:
Malicious scripts
Malicious scripts are often used to redirect site visitors to a
different website and/or load badware from another source. These
scripts will often be injected by an attacker into the content of your
web pages, or sometimes into other files on your server, such as
images and PDFs. Sometimes, instead of injecting the entire script
into your web pages, the attacker will only inject a pointer to a .js
or other file that the attacker saves in a directory on your web
server.
Many malicious scripts use obfuscation to make them more difficult for
anti-virus scanners to detect:
Some malicious scripts use names that look like they’re coming from
legitimate sites (note the misspelling of “analytics”):
.htaccess redirects
The Apache web server, which is used by many hosting providers, uses a
hidden server file called .htaccess to configure certain access
settings for directories on the website. Attackers will sometimes
modify an existing .htaccess file on your web server or upload new
.htaccess files to your web server containing instructions to redirect
users to other websites, often ones that lead to badware downloads or
fraudulent product sales.
Hidden iframes
An iframe is a section of a web page that loads content from another
page or site. Attackers will often inject malicious iframes into a web
page or other file on your server. Often, these iframes will be
configured so they don’t show up on the web page when someone visits
the page, but the malicious content they are loading will still load,
hidden from the visitor’s view.
How to look for it
If your site was reported as a badware site by Google, you can use
Google’s Webmaster Tools to get more information about what was
detected. This includes a sampling of pages on which the badware was
detected and, using a Labs feature, possibly even a sample of the bad
code that was found on your site. Certain information can also be
found on the Google Diagnostics page, which can be found by replacing
example.com in the following URL with your own site’s URL:
www.google.com/safebrowsing/diagnostic?site=example.com
There exist several free and paid website scanning services on the
Internet that can help you zero in on specific badware on your site.
There are also tools that you can use on your web server and/or on a
downloaded copy of the files from your website to search for specific
text. StopBadware does not list or recommend such services, but the
volunteers in our online community will be glad to point you to their
favorites.
In short, use the stock-standard tools and scanners provided by Google first. If the threat can't otherwise be identified, you'll need to backpath through the code of your CMS, Apache configuration, SQL setup, and remaining content of your website to determine where you were compromised and what the right remediation steps should be.
Best of luck handling your issue!