image on apache or weblogic interview question - html

I was asked an interview question where how can I tell if an image is coming from apache or weblogic. How can I determine if it is not a part of the war file?
Thanks

Usually there is a specific rule within the web server for static images (URI based) so just by looking at the full URL of the image, you should be able to tell if it's from Apache or WebLogic.
If the Apache / WebLogic proxy-plugin configuration seems overly complex, you could just try loading the image and tail the access logs on the WebLogic application server to see if the image is being served from it.
If that doesn't work, you can enabled the debug logs for the WebLogic proxy-plugin on apache and monitor the details of all outgoing connections.

If the question meant, from the front-end i.e. browser, can you tell whether the image was served from Apache or Weblogic - it would be from the URL.
I'm assuming you don't have access to the weblogic logs in this case.
Check the source for the other URLs in the application, such as JSPs and JS files. Usually the JSPs will be prepended by the web-app context-root URL, and if the images are served from weblogic the same context-root will be present.
If they are served from Apache, then it is likely to have no context-root or a different context-root like /static

Related

Local images in HTML

I'm an high school student and I'm working on something for fun. I've linked a local file stored on my computer to my webpage. What can I do to make it possible for other devices to access the local html file? (meme1.html)
<div id="button">
<a href="C:\Users\Desktop\MEME GENERATOR\meme1.html">
<img src="https://openclipart.org/image/2400px/svg_to_png/140365/1306313012.png" alt="Click here!" height="20%" width="20%"></a>
</div>
<div id="wrapper">
<h1><span class="tight-2">Happy Birthday!</h1>
<h2>Go ahead, press the button to generate memes!<span class="tm">™</span>.</h2>
</div>
Basically, when you host the site online you have to change the linked file path to the one of the server instead of your local machine.
Edit: If youre using plain HTML my answer stands, if you use a backend platform like Django, Flask or dotNet Core then the urls are dynamicly stated in your webapp.
By default, the local file is only available to the system it resides on. For instance this link you've created:
<a href="C:\Users\Desktop\MEME GENERATOR\meme1.html">
is telling the browser to look in the C: drive of the machine it's currently installed on. Every other system in your network (and the world, for that matter) will likely not be to pull that file because MEME GENERATOR isn't a folder on their system, so they will see a 404 (file not found) error.
That said, you can load links within your network by using network addresses. This will be the machine's network IP address, typically starting with 192.168.
That said, in order to load the file, the machine that it is running on will need to have a port open for the client machine's browser to connect to. This is typically port 80, unless SSL is in use, in which case it's typically port 8080, for HTTP traffic.
In doing so, the computer that is serving up the files becomes, logically, a 'server'. And this is the core of the client (user) to server relationship that the whole of the internet and networking is built upon.
Since you're on Windows, you can use something like XAMPP or WAMP to run a server locally that will have Apache installed, which can serve files through these ports. You're going to need to read up on these technologies a lot to get a file going, and be forewarned that this will open your system to hacking and the like.
EDIT: rereading your question, you are maybe trying to get this file to load on your website? If this is the case, then you need to upload the file to your website, and then it will have a folder structure similar to a local Windows file. [YOUR.DOMAIN.COM]/[whatever folder you create on your server in the public directory]/meme1.html
Do you mean? That you want other people to access your website?
Few ways to do that.
One thing you could do is to send the whole directory to the individual to who you want to send the webpage to.
Or the other way is what you can do is host the webpage on a hosting website. There are a lot of hosting websites that would host your websites for free.
That way anyone with a given URL can access the website.

Tomcat and Intelij, tomcat doesn't seem to be used, instead intelij's port is used

I have downloaded tomcat, used start.sh and shutdown.sh to display the default localhost:8080 page that states that tomcat is working properly, no problem there. I added tomcat to intelij and i added the artifact that intelij recommended. But when running tomcat, i get no errors in server output, but i can't reach localhost:8080 (404 error), and i tried to run my html pages with tomcat but they seem to only work when tomcat uses the intelij port.
tomcat configuration
program structure
artifact
when i click the browse icon of URL and select the html page, it automatically uses the port that Intelij is running on, and not through 8080. When i try to later reach my servlet through this html page, nothing happens, possibly because tomcat is never used?
the html page when accessed through http://localhost:63342/Diatom/web/html/startrenewed.html works fine.
How do i make intellij use the 8080 port of tomcat? Or if my problem lies in a different area, please support me in finding where the mistake really lies.
I solved the problem after messing around with the artifact some more.
WEB-INF only contained classes and lib, I included both 'WEB-INF' directory contents and Diatom module: 'Web' facet resources. I think one of these isn't needed, but I'm too afraid to break it again by messing around with it, so I will leave it as it is for now.

Why is a razor view of my servicestack site displaying the metadata page on azure only?

I have an application that displays my razor views of servicestack endpoints as expected on localhost. However when deployed to azure websites a particular page displays the metadata page for some reason. I don't know how to work out what has gone wrong as it all works on my machine :).
For reference, the view name matches the return DTO. I've tried the site in release mode on my machine. All other pages display as expected on azure and locally. I've cleared the cache and re-started the site from the control panel. I'm running out of things to try.
Any ideas appreciated.
Some general troubleshooting approaches that might help you:
Use Postman, cURL or Fiddler to watch the HTTP traffic between your computer and the website, looking for clues in HTTP headers, requests and responses.
Using FileZilla, connect to your website via FTP. Download the content of /site/wwwroot to a new directory on your local machine. Add this as a virtual website in IIS and run it locally. You'll be running exactly the same code that is deployed.
Instrument your application with tracing in a similar fashion to ASP.NET Tracing and look for exceptions or any other odd behavior.
Refer to Troubleshooting a Web Site for additional resources.

Location to place favicon for report viewer / report manager

Where do I place a FAVICON.ICO file for SQL server reporting services 2008?
I can find information on the web for 2005 (IIS root and restart IIS) for 2008 R2 (ReportManager directory below RS install and restart service) and 2012 (same as 2008 R2?) but none of these seem to work for 2008.
To restate the question, if you are not using IIS where is the webroot on a server with SSRS 2008?
The favicon won't have anything to do with SSRS by itself, as long as it is in the website's root folder most browsers will automatically retrieve it. The only other way to add the favicon is through adding a <link> tag to the <head> portion of the web page but I do not believe you can modify the report manager website to that extent.
Make sure that you've placed the icon in the actual root of the entire website and not just the root folder of the report manager since it usually maps to http://reportserver/reports/ instead place it in the actual webroot which, as far as I know, the default for IIS is c:\inetpub\wwwroot\
Update:
I was unaware that SSRS 2008+ no longer required IIS. That is interesting.
From 2008 onwards SSRS uses http.sys to server HTTP requests so that it doesn't require IIS. This means that you are severely limited in the ways you can configure it. This forum post on MSDN Social seems to imply that you cannot put anything in the web root unless you have IIS. This this blog article gives a lot more information about http.sys and how it works.
MSDN does have a page about configuring the kernel mode driver http.sys and reserving url namespaces. But these all talk about forwarding the request to the SQL server anyway, so I'm not sure if it would be much help.
You could try changing the virtual directory that SSRS serves from to the webroot itself and place the favicon.ico file in the \Reporting Services\Report Manager\ folder but I'm not sure that will work and I can't test it at the moment.
Of course the easiest solution is to just install IIS and use it. Then it will be simple to add the favicon.ico to the proper location.

Using SSI (Server Side Includes)

I'm trying to learn how to do Server Side Includes because I need them for a project of mine. Now, can I use SSI locally? My site is 100% HTML, Javascript, and CSS, so there is no server running my stuff. I'm just editing the files in notepad. What can I do to allow me to work on SSI before I upload it to the server that I plan on sending it to.
What can I do to allow me to work on SSI before I upload it to the server...?
If you're not running a server, then you can't use server-side includes. The clue is in the name. So if you're testing the page locally without a server, then your SSIs won't work.
The only way you're going to be able to do this is to install a web server on your local PC.
Fortunately this is fairly easy. The two major web servers are Apache and IIS. Apache is free; you can download it and install it for free. IIS is a commercial product (by Microsoft), but there is a cut-down version you can install for free. Pick whichever one is best for you (ie the one which matches your actual web server), and you should be able to get your SSI code working. You'll probably need to do some config to set it up, but as a web developer that's a good thing to know how to do.
You need to run a server locally to make ssi work. You can install just apache, or use XAMPP (lite) to also get PHP and MySQL.
Server Side Includes (SSI) are an optional feature of the web servers helping the developers to include HTML file content from a base file into multiple other HTML files with a single line of code. We need this if we are creating a simple, elegant and fast pure HTML site, without active server computing, just invoking content delivery capabilities of the server.
There are 3 major steps required to get SSI running on IIS 7 and later:
Configure IIS roles,
Extend IIS handlers,
Invoke a SSI call in you HTML code.
HERE is a more detailed explanation.