private void encodeGetEcho(Request request) { // grab the full request url HttpServletRequest httpRequest = request.getHttpRequest(); String fullRequest = httpRequest.getRequestURL().toString(); String queryString = httpRequest.getQueryString(); // odd check, used because the mock http request used for testing // actually includes the query string in the request url if (queryString != null && !fullRequest.contains("?")) { fullRequest += "?" + queryString; } // build the ows:Get element AttributesImpl attributes = new AttributesImpl(); addAttribute(attributes, "xlink:type", "simple"); addAttribute(attributes, "xlink:href", fullRequest); element("ows:Get", null, attributes); }
private void encodeGetEcho(Request request) { // grab the full request url HttpServletRequest httpRequest = request.getHttpRequest(); String fullRequest = httpRequest.getRequestURL().toString(); String queryString = httpRequest.getQueryString(); // odd check, used because the mock http request used for testing // actually includes the query string in the request url if (queryString != null && !fullRequest.contains("?")) { fullRequest += "?" + queryString; } // build the ows:Get element AttributesImpl attributes = new AttributesImpl(); addAttribute(attributes, "xlink:type", "simple"); addAttribute(attributes, "xlink:href", fullRequest); element("ows:Get", null, attributes); }
@Override public void encode(Object o) throws IllegalArgumentException { AttributesImpl attributes = new AttributesImpl(); addAttribute(attributes, "xmlns:csw", CSW.NAMESPACE); addAttribute(attributes, "xmlns:ows", OWS.NAMESPACE); addAttribute(attributes, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); addAttribute(attributes, "xmlns:xlink", XLINK.NAMESPACE); String locationAtt = "xsi:schemaLocation"; StringBuilder locationDef = new StringBuilder(); locationDef.append(CSW.NAMESPACE).append(" "); locationDef.append(cswSchemaLocation("record.xsd")); addAttribute(attributes, locationAtt, locationDef.toString()); addAttribute(attributes, "timeStamp", Converters.convert(new Date(), String.class)); start("csw:Acknowledgement", attributes); start("csw:EchoedRequest"); Request request = Dispatcher.REQUEST.get(); if (request.isGet()) { encodeGetEcho(request); } else { encodePostEcho(); } end("csw:EchoedRequest"); end("csw:Acknowledgement"); }
@Override public void encode(Object o) throws IllegalArgumentException { AttributesImpl attributes = new AttributesImpl(); addAttribute(attributes, "xmlns:csw", CSW.NAMESPACE); addAttribute(attributes, "xmlns:ows", OWS.NAMESPACE); addAttribute(attributes, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); addAttribute(attributes, "xmlns:xlink", XLINK.NAMESPACE); String locationAtt = "xsi:schemaLocation"; StringBuilder locationDef = new StringBuilder(); locationDef.append(CSW.NAMESPACE).append(" "); locationDef.append(cswSchemaLocation("record.xsd")); addAttribute(attributes, locationAtt, locationDef.toString()); addAttribute(attributes, "timeStamp", Converters.convert(new Date(), String.class)); start("csw:Acknowledgement", attributes); start("csw:EchoedRequest"); Request request = Dispatcher.REQUEST.get(); if (request.isGet()) { encodeGetEcho(request); } else { encodePostEcho(); } end("csw:EchoedRequest"); end("csw:Acknowledgement"); }