根据交银施罗德真实环境已测试通过,此过程可以作为非J2EE部署的典型案例,主要是针对某些对安全性要求较高的解决方案:

基本的实现原理和部分代码如下:

1.客户端访问交银.net系统,由该系统发送请求,访问方式为:http://润乾报表服务器ip:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb38


2.由index.jsp接收到传过来的token值(系统唯一值),

3.根据传过来的token值调用.net系统的定义的WebServices的http://portal.jysld.com/jyportalinterface/

reportrights.asmx方法,此方法里相关有用的信息

index.jsp部分代码:

<%

String token = request.getParameter(“token”);

System.out.println(“传过来的token:” + token);

ReportRightsClient client = new ReportRightsClient();

ReportRightsSoap service = client.getReportRightsSoap();

ReportRightResult reportResult=service.getRight(token);

String displayName= reportResult.getDisplayName();

String Account=reportResult.getAccount();

String raq= reportResult.getReportName();

boolean flag=reportResult.isRight();

session.setAttribute(“flag”, flag);

System.out.println(“别名:”+displayName);

System.out.println(“ACount:”+Account);

System.out.println(“报表名:”+raq);

System.out.println(“是否有权限:”+flag);

%>

4.对WebServices方法的处理两个基本java类:ReportRightsClient.java代码如下:

package com;

import java.net.MalformedURLException;

import java.util.Collection;

import java.util.HashMap;

import javax.xml.namespace.QName;

import org.codehaus.xfire.XFireRuntimeException;

import org.codehaus.xfire.aegis.AegisBindingProvider;

import org.codehaus.xfire.annotations.AnnotationServiceFactory;

import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;

import org.codehaus.xfire.client.XFireProxyFactory;

import org.codehaus.xfire.jaxb2.JaxbTypeRegistry;

import org.codehaus.xfire.service.Endpoint;

import org.codehaus.xfire.service.Service;

import org.codehaus.xfire.soap.AbstractSoapBinding;

import org.codehaus.xfire.transport.TransportManager;

import org.tempuri.ReportRightResult;

public class ReportRightsClient {

private static XFireProxyFactory proxyFactory = new XFireProxyFactory();

private HashMap endpoints = new HashMap();

private Service service0;

public ReportRightsClient() {

create0();

Endpoint ReportRightsSoapLocalEndpointEP = service0 .addEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”), new QName(“http://tempuri.org/”, “ReportRightsSoapLocalBinding”), “xfire.local://ReportRights”);


endpoints.put(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”), ReportRightsSoapLocalEndpointEP);


Endpoint ReportRightsSoapEP = service0 .addEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoap”), new QName(“http://tempuri.org/”, “ReportRightsSoap”), “http://portal.jysld.com/jyportalinterface/reportrights.asmx”);


endpoints.put(new QName(“http://tempuri.org/”, “ReportRightsSoap”), ReportRightsSoapEP);


public Object getEndpoint(Endpoint endpoint) {

try {

return proxyFactory.create((endpoint).getBinding(), (endpoint).getUrl());

} catch (MalformedURLException e) {

throw new XFireRuntimeException(“Invalid URL”, e);

public Object getEndpoint(QName name) {

Endpoint endpoint = ((Endpoint) endpoints.get((name)));

if ((endpoint) == null) {

throw new IllegalStateException(“No such endpoint!”);

return getEndpoint((endpoint));

public Collection getEndpoints() {

return endpoints.values();

private void create0() {

TransportManager tm = (org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager());


HashMap props = new HashMap();

props.put(“annotations.allow.interface”, true);

AnnotationServiceFactory asf = new AnnotationServiceFactory(new Jsr181WebAnnotations(), tm, new AegisBindingProvider(new JaxbTypeRegistry()));


asf.setBindingCreationEnabled(false);

service0 = asf.create((com.ReportRightsSoap.class), props);

AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName(“http://tempuri.org/”, “ReportRightsSoapLocalBinding”), “urn:xfire:transport:local”);


AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName(“http://tempuri.org/”, “ReportRightsSoap”), “http://schemas.xmlsoap.org/soap/http”);


public ReportRightsSoap getReportRightsSoapLocalEndpoint() {

return ((ReportRightsSoap)(this).getEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”)));


public ReportRightsSoap getReportRightsSoapLocalEndpoint(String url) {

ReportRightsSoap var = getReportRightsSoapLocalEndpoint();

org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);

return var;

public ReportRightsSoap getReportRightsSoap() {

return ((ReportRightsSoap)(this).getEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoap”)));


public ReportRightsSoap getReportRightsSoap(String url) {

ReportRightsSoap var = getReportRightsSoap();

org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);

return var;

public static void main(String[] args) {

ReportRightsClient client = new ReportRightsClient();

//create a default service endpoint

ReportRightsSoap service = client.getReportRightsSoap();

//TODO: Add custom client code here

//

//service.yourServiceOperationHere();

ReportRightResult reportResult=service.getRight(“b96335b0db0347bf9b98c4fb2a3fdb38″);


String displayName= reportResult.getDisplayName();

String Account=reportResult.getAccount();

String reportName= reportResult.getReportName();

boolean flag=reportResult.isRight();

System.out.println(“别名:”+displayName);

System.out.println(“ACount:”+Account);

System.out.println(“报表名:”+reportName);

System.out.println(“是否有权限:”+flag);

//测试:

//http://localhost:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb38


//http://localhost:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb36


System.exit(0);

ReportRightsSoap.java代码如下:

package com;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebResult;

import javax.jws.WebService;

import javax.jws.soap.SOAPBinding;

import org.tempuri.ReportRightResult;

@WebService(name = “ReportRightsSoap”, targetNamespace = “http://tempuri.org/”)

@SOAPBinding(use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)


public interface ReportRightsSoap {

@WebMethod(operationName = “GetRight”, action = “http://tempuri.org/GetRight”)

@WebResult(name = “GetRightResult”, targetNamespace = “http://tempuri.org/”)

public ReportRightResult getRight(

@WebParam(name = “token”, targetNamespace = “http://tempuri.org/”)

String token);

5.根据调用的WebServices对其返回的ReportRightResult结果集得到相关的信息

ReportRightResult reportResult=service.getRight(token);

String displayName= reportResult.getDisplayName();//别名

String Account=reportResult.getAccount();//ACount

String raq= reportResult.getReportName();//报表名

boolean flag=reportResult.isRight();//是否有权限

session.setAttribute(“flag”, flag);

6.由返回的权限判断通过Filter进行页面和数据的过滤

OnlineFilter.java的代码:

package filter;

import java.io.IOException;

import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.RequestDispatcher;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.*;

public class OnlineFilter extends HttpServlet implements Filter {

private static final long serialVersionUID = 1L;

// private String loginUrl = “”;

public void init(FilterConfig filterConfig) throws ServletException {

// loginUrl = filterConfig.getInitParameter(“exceptUrl”);

public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain) throws IOException, ServletException,

NullPointerException {

RequestDispatcher dispatcher = request

.getRequestDispatcher(“myErrorPage.jsp”);

HttpServletRequest req = (HttpServletRequest) request;

HttpServletResponse res = (HttpServletResponse) response;

HttpSession session = req.getSession(true);

// 从session里取的权限判断信息

boolean flag = (Boolean) session.getAttribute(“flag”);

System.out.println(“flag:” + flag);

if (!flag) {

// 跳转到登陆页面

dispatcher.forward(request, response);

res.setHeader(“Cache-Control”, “no-store”);

res.setDateHeader(“Expires”, 0);

res.setHeader(“Pragma”, “no-cache”);

System.out.println(“用户没有登陆,不允许操作”);

return;

} else {

chain.doFilter(request, response);

System.out.println(“用户已经登陆,允许操作”);

public void destroy() {

過濾器在web.xml配置如下:

<filter>

<filter-name>onlineFilter</filter-name>

<filter-class>filter.OnlineFilter</filter-class>

<!–

<init-param>

<param-name>exceptUrl</param-name>

<param-value>index.jsp</param-value>

</init-param>

–>

</filter>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/reportJsp/*</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/jsp/*</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/reportServlet</url-pattern>

</filter-mapping>

7.通过获取的权限最终达到数据的完整交互 index.jsp部分代码:

<%

String realPath = “http://”

+ request.getServerName()

+ “:”

+ request.getServerPort()

+ request.getContextPath()

+ request.getServletPath().substring(0,

request.getServletPath().lastIndexOf(“/”) + 1);

String fullfilePath = realPath + “reportJsp/showReport.jsp?raq=”

+ raq;

System.out.println(“fullfilePath:” + fullfilePath);

response.sendRedirect(fullfilePath);

%>

优点:1.权限安全系数更高,只保证当前用户有权限操作,防止了部分通过新开IE记住URL的方式访问,包括

想通过查看源文件里对servlet的处理等,

2.权限的配置,操作完全交给.net系统处理,对报表的应用只要告诉我有没有权限执行当前的操作,要用的报

表,当前的用户信息即可,通用性好,耦合度低,易于集成

缺点:由于是跨语言,跨服务器集成操作,多多少少网络可能会阻止一些访问效率和响应时间等

难点:对WebServices代码的操作过程…

非J2EE部署解决方案的更多相关文章

  1. Eclipse(非J2EE版本)配置Extjs环境以及安装部署Tomcat

    Eclipse(非J2EE版本)配置Extjs环境(Spket) 1. 安装spket插件,帮助->安装新软件->http://www.agpad.com/update. 2. 设置Spk ...

  2. 部署解决方案包 (SharePoint Server 2010)

    转:http://technet.microsoft.com/zh-cn/library/cc262995(v=office.14).aspx 本文介绍各个解决方案包,及其在 Microsoft Sh ...

  3. 【G】开源的分布式部署解决方案(一) - 开篇

    做这个开源项目的意义是什么?(口水自问自答,不喜可略过) 从功能上来说,请参考 预告篇,因自知当时预告片没有任何含金量,所以并没有主动推送到首页,而是私下的给一些人发的. 从个人角度上来说,我希望.n ...

  4. 【G】开源的分布式部署解决方案 - 预告篇

    为什么想到要做分布式部署解决方案? 当项目越做越大以后,你会发现部署变成一件极其头疼的事情.当然头疼的绝不仅仅在部署一个环节,比如新服务器环境搭建当中就许多坑要踩.各种重复性的工作,包括但不仅限于增加 ...

  5. 【G】开源的分布式部署解决方案(三) - 一期规划定稿与初步剖析

    G.系列导航 [G]开源的分布式部署解决方案 - 预告篇 [G]开源的分布式部署解决方案(一) - 开篇 [G]开源的分布式部署解决方案(二) - 好项目是从烂项目基础上重构出来的 [G]开源的分布式 ...

  6. 【G】开源的分布式部署解决方案文档 - 手动安装

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 序言 因各种原因,决定先写使用文档.也证明下项目没有太监.至于安装过程复杂,是因为还没有做一键安装,这个现阶段确实没精力. 项目进度 (点击图片 ...

  7. 【G】开源的分布式部署解决方案文档 - 使用手册

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 已知问题 导航没有联动 因为权限只是做了基础的登录校验,考虑到后面导航要跟权限关联上暂时是写死的. 只有部分界面使用了Vue.js 因为刚开始没 ...

  8. 【G】开源的分布式部署解决方案文档 - Web Deploy

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 微软官方部署方式 右键项目->发布 这个大家应该再熟悉不过,在部署前有个预览界面可以看本次更新到底更新哪些文件. 既然它可以预览部署结果, ...

  9. 【G】开源的分布式部署解决方案文档 - 部署Console & 控制负载均衡 & 跳转持续集成控制台

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 设置项目部署流程 项目类型:选择Console,这个跟功能无关,只是做项目分类,后面会有后续功能 宿主:选择Console 部署方式:选择原始, ...

随机推荐

  1. 理解JavaScript的数值型数据类型

    分享一些在JavaScript中遇到的一些实用的技巧. 理解JavaScript的数值型数据类型 JavaScript的数值型数据类型只有一种:number.即不管是整数还是浮点数,JavaScrip ...

  2. manifest.xml

    main action 和 laucher的categoty If either the MAIN action or LAUNCHER category are not declared for o ...

  3. 散列表碰撞处理、开链法、HashTable散列

    散列表碰撞处理.开链法.HashTable散列 /** * 散列表碰撞处理.开链法.HashTable散列. * 将数组里的元素位置,也设置为数组,当两个数据的散列在同一个位置时, * 就可以放在这个 ...

  4. vue、react、angular三大框架对比 && 与jQuery的对比

    前端当前最火的三大框架当属vue.react以及angular了. 但是在做项目的时候,我们怎么去选择呢?  这里做一个比较,希望大家可以有一个比较清晰的认识. vue与react vue和react ...

  5. Netty核心概念(8)之Netty线程模型

    1.前言 第7节初步学习了一下Java原本的线程池是如何工作的,以及Future的为什么能够达到其效果,这些知识对于理解本章有很大的帮助,不了解的可以先看上一节. Netty为什么会高效?回答就是良好 ...

  6. [Python] 记录

    错误处理 virtualenv 报错: 在中文文件夹中 unicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 17 ...

  7. Vue.js系列之一初识Vue

    在看vue.js之前,可以先看这两篇文章,对于为什么要使用vue会有一定帮助 1.Vue.js !important 2.界面之下:还原真实的MV*模式 !important 3.web前端优化之re ...

  8. linux把程序添加到全局环境变量

    比如把, nginx服务放到全局变量 ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/ /usr/local/bin/就是环境变量目录

  9. Mac下TensorFlow安装及环境搭建

    在学习了一段时间台大李宏毅关于deep learning的课程,以及一些其他机器学习的书之后,终于打算开始动手进行一些实践了. 感觉保完研之后散养状态下,学习效率太低了,于是便想白天学习,晚上对白天学 ...

  10. Chapter 3 Phenomenon——18

    My intuition flickered; the doctor was in on it. 我的直觉告诉我:这个医生也参与了. 我灵光一闪:这医生熟悉内情. "I'm afraid t ...