File class using URI in a web server.
How do I reference a file or directory on a web server using the File class?
For example, if the URL is http://localhost:8080/foo and I want to access the images directory, how would I do it?
This is what I've tried:
URI uri = new URI("http",null,"foo",8080,"/foo/images",null,null);
File file = new File(uri);
I am getting an exception: java.lang.IllegalArgumentException: URI scheme is not "file"
uri.toString() looks good. File just doesn't seem to like a directory within a web server. I don't think I'm going to know the absolute path when I move to the actual web server.
Try to use search FTP in se37 or checkout the below FM
CALL FUNCTION 'EPS_FTP_MPUT'
EXPORTING
RFC_DESTINATION =
* FILE_MASK = ' '
* LOCAL_DIRECTORY = ' '
* REMOTE_DIRECTORY = ' '
* OVERWRITE_MODE = ' '
* TEXT_MODE = ' '
* TRANSMISSION_MONITOR = 'X'
* RECORDS_PER_TRANSFER = 10
* MONITOR_TITLE =
* MONITOR_TEXT1 =
* MONITOR_TEXT2 =
* PROGRESS_TEXT =
* IMPORTING
* LOCAL_DIRECTORY =
* REMOTE_DIRECTORY =
* LOCAL_SYSTEM_INFO =
* REMOTE_SYSTEM_INFO =
* TABLES
* FILE_LIST =
* EXCEPTIONS
* CONNECTION_FAILED = 1
* INVALID_VERSION = 2
* INVALID_ARGUMENTS = 3
* GET_DIR_LIST_FAILED = 4
* FILE_TRANSFER_FAILED = 5
* STOPPED_BY_USER = 6
* OTHERS = 7
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Similar Messages
-
Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.
Hi,
You didnt mention which version of IWS. follow these steps.
(1)Goto Web Server Administration Server, select the server you want to manage.
(2)Select Preference >> Perfomance Tuning.
(3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
(4) Apply changes and restart the server.
*Setting the timeout to a lower value, however, may prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before the connection is closed is 432000 bits (2400 multiplied by 180)
Regards
T.Raghulan
[email protected] -
When using the built in web server, is there a way to specify a different
When using the built in web server, is there a way to specify a different error handler when you try to access a NON .CFM file? Right now I get the standard:
java.io.FileNotFoundException: filename.ext
Is there any setting to override this and direct the message to your own .cfm template? The missing template handler in the CF Admin work only for .cfm files.
ThxThe in-built web server for ColdFusion 8 is JRun. I am on ColdFusion 10, however, and so cannot offer hands-on advice. (CF10 replaced JRun with Tomcat.)
My guess is that you have to modify the file {CF_ROOT}/WEB-INF/web.xml. Don't forget to create a back-up first!
You may then proceed as follows.
1) In the ColdFusion root (CF_ROOT), create the file myCustomFileNotFound.cfm. Give it some content, like
My custom File Not Found page. Current time: <cfoutput>#now()#</cfoutput>
2) Open the file {CF_ROOT}/WEB-INF/web.xml in a text editor. Add the following error-handling specification just before the end tag </web-app>:
<error-page>
<error-code>404</error-code>
<location>/myCustomFileNotFound.cfm</location>
</error-page>
Save the file web.xml.
3) Restart ColdFusion. Test by browsing to a URL requesting filename.ext -
Using Tomcat as a web server at deployment stage
Hi everyone,
Does anyone of you ever used Tomcat as a web server at deployment stage?
Has he then faced performance problems? or any other of any kind?
Was he limited in the number of users to get an acceptable request process time? Is there a special configuration to set in the web.xml file?
Any help would be greatly appreciated.
Thanks in advance.
JenniferWe have a Tomcat server in production (no Apache/IIS, Tomcat is on port 80) and it runs great. We have about 200 heavy use users on it. The server (version 4.18) is on a Windows 2000 Server / 512 Meg RAM / P3-800 DELL Box. Its connected to a SQL 2000 Server on another box through the built in Tomcat DBCP connection pool.
We were initially going to run it through IIS; but we found it such a pain to set up we decided to leave it on Tomcat. For our application it probably would not have shown a difference in speed anyways.
Its very fast and reliable for us.
As far as tuning, there is a document here that will to you what to do; its very basic actually; just two changes.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Production%20Configuration
Also, make sure you don't have any reloadable="true"'s in your Context's.
- Chris -
How to use addwatermarkfromfile on a web server
how to use addwatermarkfromfile on a web server. Where do you put the js on a windows 2008 server, so that the URL can pick it up when a user opens a PDF.
You don't. JS files can exist in three places.
1. In the PDF file
2. In the User Profile
3. In the Application folders
* Note while you can execute some browser based JS to the embedded viewer in a web browser all of the API calls are non-editing. -
How to use fp-2010 as web server
how to use fp-2010 as web server
mazharHi Mazhar,
It is fairly straighforward to set up front panels for your RealTime executable. This knowledgebase has the information on how to do this.
Hope this helps!
Warm regards,
Karunya R
National Instruments
Applications Engineer -
Using WebLogic as a Web Server
Are there any disadvantages to using WebLogic as a Web Server also, if the
majority of the site is not static HTML, as compared to plugging Weblogic
into IIS?
Thanks.
[email protected]There are a lot of benefits using WebLogic as the Web server. For one, it
greatly simplifies deployment and management.
If you already have a Webserver deploy, it sometimes makes sense to
integrate us with that existing server.
Thanks,
Michael
Michael Girdley
BEA Systems Inc
"Marc Lippman" <[email protected]> wrote in message
news:39c90c1b$[email protected]..
Are there any disadvantages to using WebLogic as a Web Server also, if the
majority of the site is not static HTML, as compared to plugging Weblogic
into IIS?
Thanks.
[email protected] -
How to use JSP in apache web server
hi all,
can anybody tell me how to use JSPs in Apache Web Server.
Thanks
sirYou would need a servlet container to run Servlets and JSPs. And Apache's Tomcat is one such free container available. Download Tomcat from http://jakarta.apache.org and integrate with Apache WS
HTH -
File Dialog's using Remote Panels (via web server)
I am aware that the web server remote panel access will not allow us to open a file dialog box on a remote computer. I have read people comment that you should create your own file dialog box, using LabVIEW to use instead of the file dialog box.
Has anyone actually done this? I would like know if anybody has source code for this, rather than re-inventing the wheel. Also, will the sub-vi actually just appear on the webserver? i.e. will it actually work?
Thanks for any help
SladeHi Emilie,
I have a program that I run on an industrial PC, with no keyboard, video or mouse. We currently control the application using the web server. We have a button to load and a button to save settings. If the files are missing for the load & save, it pops up a file open dialog to choose the file to import. However, while we are viewing the page this way, these dialog boxes do not work.
I would like to know if anyone has made up a file dialog box that I could use, that would display correctly in the web server's remote control.
Regards,
Slade -
Can't parse xml file in jar file when can't connect to web server
My JNLP application throw ConnectException when trying to parse xml during web server offline.
Steps,
1. JNLP application has been launched once and all related jar and xml files are already downloaded to local cache.
2. Then I close web server to test offline launch.I launch the JNLP application using shortcut with -offline parameter.
3. However the JRE internal xml parser tries to connect to web server and report connection error as web server is down now.
My concern is the file is already in the cache, why java still try to connect URL. This error happens in JRE 1.5, but it doesn't happen in JRE 1.6. It only happens when web server is down in JRE 1.5.
I think it may be a bug of JRE, do any one can give me some hint about how to resolve?
Thanks in advance!!
I also moved the code piece to a simple web start example, following it the error and code pieces.
Error Trace in Java console,
ava.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at EntXmlUtil.buildDocument(EntXmlUtil.java:57)
at Notepad.testParseXML(Notepad.java:870)
at Notepad.main(Notepad.java:153)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Notepad.java
public void testParseXML() {
URL xmlURL=Notepad.class.getClassLoader().getResource("xml/Login.xml");
try {
org.w3c.dom.Document doc = EntXmlUtil.buildDocument(xmlURL);
System.out.println("Test"+doc);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
EntXMLUtil.java
private static DocumentBuilderFactory dbf = null;
static {
dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setIgnoringComments(true);
dbf.setIgnoringElementContentWhitespace(true);
public static DocumentBuilderFactory getDocBuilderFactory() {
return EntXmlUtil.dbf;
public static Document buildDocument(URL url, String systemId) throws Exception {
DocumentBuilder db;
Document doc;
InputStream is;
String sysId = null;
if(systemId == null)
sysId = url.toExternalForm();
else
sysId = systemId;
db = EntXmlUtil.getDocBuilderFactory().newDocumentBuilder();
is = url.openStream();
doc = db.parse(is, sysId);
is.close();
return doc;
}I finally got a temperary work around for this issue, using JRE5 version lower than update 16(not include update 16).
i found Sun modify the URL which returned by XXX.class.getClassLoader().getResource("xml/Test.xml,") after update 15, previous it is related with the cache path, like C:\Users\epenwei\AppData\LocalLow\Sun\Java\Deployment\cache\javaws\http\Dlocalhost\P80\DMEntriView\DMapp\AMNotepad.jar!/xml/Test.xml, but after it changes to network path, like http://localhost/Notepad/app/notepad.jar!/xml/Test.xml. However, the latter address doesn't work in Sun's own class com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity if offline.It tried to create new URL then connect to web server. So exception is thrown since web server is down.
if (reader == null) {
stream = xmlInputSource.getByteStream();
if(stream != null && encoding != null)
declaredEncoding = true;
if (stream == null) {
URL location = new URL(expandedSystemId);
URLConnection connect = location.openConnection();
if (connect instanceof HttpURLConnection) {
setHttpProperties(connect,xmlInputSource);
I am not sure whether it is a Java new bug since I only read the codes and didn't debug Sun code. But I am very curious that I have already specify <j2se version="1.5.0_12" href="http://java.sun.com/products/autodl/j2se" /> to specify update 12 for my jws application. And I also see the Java console display like following
Java Web Start 1.5.0_18
Using JRE version 1.5.0_12 Java HotSpot(TM) Client VM
Why java still uses my latest jre lib to run my application?
Edited by: wei000 on May 22, 2009 5:32 AM -
Update server classes without restarting sun one web server 6.1
hi,
I'm facing a problem in updating server classes on sun one web server 6.1. i did not deploy any application and we are using simple jdbc+jsp approach.i write a class for db connections and now whenever i made some changes in it i must have to restart web server for changes to take effect. I also delete class files from classcache folder but it doesn't work.
my class is placed on /opt/ and this path is also placed in web server class paths.
i do not want to restart web server again and again. can some one tell me how to solve this problem.
Regards,
Kashif.if you just change your jsp files, you don't need to restart WebServer. WS will automatically recompile your jsps when it find the changes.
You may also use reconfig command to reload server. -
404 File not Found when accessing Video Web server
I am trying to access a Video Web server remotely. Everything works fine on a PC and also on Internet Explorer for Mac.
When I login using Safari I get the error message "404 File not Found" "The requested URL was not found on this server"
I have been successful twice through Safari but after that it doesn't seem to work for days.
I have removed all cookies, emptied the Cache, reset safari, deleted all keychain access references to the website.
It seems to be a security issue but I am not sure what else to do.
Any ideas would be greatly appreciatedTry using open DNS:
Adding Open DNS codes to your Network Preferences, should give good results in terms of speed-up as well as added security:
Open System Preferences/Network. Double click on your connection type, or select it in the drop-down menu, and in the box marked 'DNS Servers' add the following two numbers:
208.67.222.222
208.67.220.220
(You can also enter them if you click on Advanced and then DNS) -
Best Practice for serving static files (gif, css, js) from front web server
I am working on optimization of portal performance by moving static files (gif, css, js) to my front web server (apache) for WLP 10 portal application. I end up with moving whole "framework" folder of the portal WebContent to file system served by apache web server (the one which hosts WLS plugin pointing to my WLP cluster). I use <LocationMatch> directives for that:
Alias /portalapp/framework "/somewhere/servedbyapache/docs/framework"
<Directory "/somewhere/servedbyapache/docs/framework">
<FilesMatch "\.(jsp|jspx|layout|shell|theme|xml)$">
Order allow,deny
Deny from all
</FilesMatch>
</Directory>
<LocationMatch "/partalapp(?!/framework)">
SetHandler weblogic-handler
WLCookieName MYPORTAL
</LocationMatch>
So, now browser gets all static files from apache insted of the app server. However, there are several files from bighorn L&F, which are located in the WLP shared lib: skins/bighorn/ window.css, wsrp.css, menu.css, general.css, colors.css; skins/bighorn/borderless/window.css; skeletons/bighorn/js/ util.js, buttons.js; skeleton/bighorn/css/layout.css
I have to merge these files into the project and physically move them into apache served file system to make mentioned above apache configuration works.
However, this approach makes me exposed bunch of framework resources, which I do not to intend to change and they should not be change (only custom.css is the place to make custom changes to the bighorn skin). Which is obviously not very elegant solution. The other approach would be intend to create more elaborate expression for LocationMatch (I am not sure it's entirely possible giving location of these shared resources). More radical move - stop using bighorn and create totally custom L&F (skin, skeleton) - which is quire a lot of work (plus - bighorn is working just fine for us).
I am wondering what is the "Best Practice Approach" approach recommended by Oracle/BEA - giving the fact that I want to serve all static files from my front end apache server instead fo WLS app server.
Thanks,
Oleg.Oleg,
you might want to have a look at the official WLP performance support pattern (Metalink DocID 761001.1 ) , which contains a section about "Configuring a Fronting Web Server Serving WebLogic Portal 8.1 Static Artifacts ".
It was written for WLP 8.1, but most of the settings / recommendations should also to WLP 10.
--Stefan -
Hi,
we are currently using Netscape Enterprise Server 3.6 as our web
server and WLS 5.1 as web container, both running on AIX 4.3.3.
We want to get rid of the NES (it is buggy and unsupported) but we are
unsure if need to replace it with another web server (e.g. Apache or
iPlanet), or just use WLS 6.1 as both web server and web container.
So the question is: do you have any experience regarding the
performance of the WLS 6.1 web server compared to a standard web
server?
TIA
/\/\orten HindsholmThe main reason that 5.1 is 25% slower than NES or Apache on serving static html
is that NES/Apache do a lot of native I/O and caching ( their code base is C/C++).
6.1 fixed that problem, BEA use native I/O to retrieve static html and img files,
and caching them in memory. Benchmark data shows that they are in par with NES/Apache's
performance. It's pretty safe for you to use 6.1 to host your static contents
and use it as web container at the same time.
My 2 cents.
Jim Zhou.
[email protected] (Morten Hindsholm) wrote:
Hi,
we are currently using Netscape Enterprise Server 3.6 as our web
server and WLS 5.1 as web container, both running on AIX 4.3.3.
We want to get rid of the NES (it is buggy and unsupported) but we are
unsure if need to replace it with another web server (e.g. Apache or
iPlanet), or just use WLS 6.1 as both web server and web container.
So the question is: do you have any experience regarding the
performance of the WLS 6.1 web server compared to a standard web
server?
TIA
/\/\orten Hindsholm -
I'm going to be making a web server/torrent tracker/torrent seed (hopefully) from Arch on an old-ish HP NetServer E 800. I was going to go with Debian, but I like the KISS Arch brings and with a server on the slim hardware I'm using, even Debian is too big esp. compared to Arch. [If the hardware's not up to Arch (highly doubtful) I'll have to resort to *gasp* Gentoo.]
I saw the tutorial on the wiki for Arch with Apache, LAMP, etc. so that's fine. I do, however, have a question about torrent stuff. I'm wanting to track and seed my band's torrents off the same machine (obviously, it won't be the sole tracker; TPB/Mininova/etc.), where its site is (two separate domains: .com for the main site, .org for the email, legal stuff, and BT tracker).
I am planning on using XBTT as the tracker and XBTC + web interface as the seed client. My main (and only, as of yet) problem is that there are no instructions on the XBTT site or Arch wiki for using Arch with XBT(T/C). I guess the only difference is getting the tools needed. Are these included with Arch, in the main repos, or somewhere available for Arch? Also, would there be a conflict seeding from the same machine the tracker is on?
If that doesn't work, I'm thinking Opentracker. I don't expect too many peers but we might get Dugg, Slashdotted, Stumbled, or promoted by TPB (they like when bands release over BT). So, I want a tracker than can handle the unlikely event of a large number of peers.
Also, does anyone know of a Python frontend to XBTT? PHP is fine, but really prefer Python to integrate with the remainder of the site.
Thanks in advance,
Sajromanasij7479 wrote:3.This should be an stfw type of question, but I'm really confused about which way to go for a remote desktop connection.
So, I'd like to hear any experience, positive or negative, on that matter.
Note that my main machine will have an extra monitor,on which I'd like to ocassionaly 'see' the server.
I second/third/forth screen. Ask yourself if you really need a GUI for a server--chances are, the answer is a "no." Screen is handy because you can detach it from anywhere and then resume right where you left off. ctrl+a followed by "d" to detach, screen -r to resume (or -rd if you need to resume and detach a running instance). GUIs are mostly overkill for this use case, IMO.
I have a very similar setup with a cheapish AMD CPU, large disks, and a fair amount of RAM running mostly as a file server/router/miscellaneous box (NFS/SMB, also as a web server, IPv6 gateway, and other odds and ends). I have one of the monitors of my desktop plugged into it in the event I actually need to see it (rare, but can happen if something occurs with the network).
I think you'll find after some experimentation that it's a lot easier to manage and run than you might expect. The same drawbacks that apply to Arch desktops apply to servers as well, probably more so: Regular maintenance updates aren't likely to happen depending on how you use the server, so you need to keep up on the news and bookmark important entries for whenever you do have time to update it. Be extra sure to update it only when you have an hour or two to spare, particularly if you come to rely on that machine to be up and running.
Perhaps the more serious drawback of having an always on (or almost always on) server is that you'll find far more uses for it than you originally anticipated.
Maybe you are looking for
-
Abap - how to get only 1 PO# from an specific material
What I meant was : how to group same PO#s and show in the report that it is only one. Suppose I have: material#1 PO#1 PO#2 PO#3 PO#3 PO#3
-
Is it possible to import a dvd into itunes?
I'd like to add episodes of a tv show from a dvd I purchased to my ipod touch and iphone. Is it possible to do this, and if so, how? Thanks.
-
How many exceptions to be thrown by a DAO method
Suppose I have a DAO method: public Department getDepartmentById( int departmentId) throws DepartmentNotFoundExceptionNow inside this method, if no Department is found having id equal to departmentId then I throw DepartmentNotFoundException. But ther
-
Hi, I am making a checkers game and I want to be able to split the screen up. I want to be able to have the checker board on the left and stats on the right. What should I use for that? I was looking at JPanel, but I can't get it to work. The damb th
-
For first week of use of ipad I could send and receive emails. Now I cannot; I have been through the iPad help system and have failed to get an answer. Grateful for some help please. I only have wifi.