简体   繁体   English

Weblogic从服务器下载文件并在JSP中读取

[英]Weblogic download file from server and read in JSP

I have a java application deployed in weblogic where in I have a requirement for which I need to download a JS file in java class and save it in some location. 我在weblogic中部署了一个Java应用程序,其中有一个要求,我需要下载Java类中的JS文件并将其保存在某个位置。 Later when a particular JSP file is loaded the previously downloaded JS file should be accessible to this JSP. 稍后,当加载特定的JSP文件时,此JSP应该可以访问以前下载的JS文件。 How can i achieve this? 我怎样才能做到这一点?

I am not sure how to or which location I should save the file so that it would be accessible both in the JSP and java files. 我不确定如何保存文件或将文件保存在哪个位置,以便可以同时在JSP和Java文件中访问它。

My application uses JSON and due to other constraints I am not able to pass the JS file as byte array. 我的应用程序使用JSON,由于其他限制,我无法将JS文件作为字节数组传递。

Thanks Paddy 谢谢帕迪

It's not so difficult. 没那么难。 For example you may create folder in the root of file system (or prefer other location) and fix it in your code or application environment, change access mode of this folder to resolve write\\read access for user under which weblogic is running. 例如,您可以在文件系统的根目录(或首选其他位置)中创建文件夹,并在代码或应用程序环境中对其进行修复,更改此文件夹的访问方式以解决运行weblogic的用户的写/读访问。 Then you can work with this folder from application deployed in weblogic as well as from normal standalone application. 然后,您可以从Weblogic中部署的应用程序以及普通的独立应用程序中使用此文件夹。

Finally I solved this by fetchingthe result and storing it in a byte array which the JSP could process. 最后,我通过获取结果并将其存储在JSP可以处理的字节数组中来解决此问题。 Dont have the exact code as I dont have access to it anymore. 没有确切的代码,因为我无法再访问它。 But will try to write it up and post here. 但是会尝试将其编写并在此处发布。

For now, my problem is resolved. 目前,我的问题已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM